Class Proposition
java.lang.Object
edu.uky.cs.nil.tt.world.Proposition
- All Implemented Interfaces:
Expression, Logical, Predicate<State>
A proposition is a
logical expression that can be either
true or false. A proposition is an operator applied to zero
or more other expressions, called its arguments.- Author:
- Stephen G. Ware
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropositionA proposition that is alwaysfalsefinal Proposition.OperatorAn operator defines the type and behavior of a propositionstatic final PropositionA proposition that is alwaystrue -
Constructor Summary
ConstructorsConstructorDescriptionProposition(Proposition.Operator operator, Expression... arguments) Constructs a new proposition from an operator and arguments. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the value of this logical expression in the given state.Returns an unmodifiable list of this proposition's arguments, the other expressions that make up this proposition and which are considered when evaluating the truth value of this proposition.inthashCode()substitute(Function<Object, Object> substitution) Returns a logical object identical to this one, except that its logical elements have been replaced according to the given substitution.booleantoString()
-
Field Details
-
Constructor Details
-
Proposition
Constructs a new proposition from an operator and arguments.- Parameters:
operator- the operator which defines the type and behavior of the propositionarguments- the arguments which will be evaluate by the operator in a given state
-
-
Method Details
-
equals
-
hashCode
-
toString
-
test
-
substitute
Description copied from interface:LogicalReturns a logical object identical to this one, except that its logical elements have been replaced according to the given substitution. A substitution defines how some logical formula (the input to the function) should be replaced with a different formula (the output of the function).- Specified by:
substitutein interfaceExpression- Specified by:
substitutein interfaceLogical- Parameters:
substitution- a function which maps logical formula that should be replaced to the formula they should be replaced with- Returns:
- an identical object, except that its logical formula have been replaced according to the substitution
-
evaluate
Returns the value of this logical expression in the given state.A proposition always returns either
trueorfalsewhen evaluated.- Specified by:
evaluatein interfaceExpression- Parameters:
state- a mapping of values to all of a story world's variables- Returns:
- the value of the expression in the given state
-
getArguments
Returns an unmodifiable list of this proposition's arguments, the other expressions that make up this proposition and which are considered when evaluating the truth value of this proposition.- Returns:
- an unmodifiable list of arguments
-