Class Assignment
java.lang.Object
edu.uky.cs.nil.tt.world.Assignment
- Author:
- Stephen G. Ware
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAssignment(Variable variable, Value value) Constructs a new assignment from a variable and value which is visible and with a blank description.Assignment(Variable variable, Value value, boolean visible, String description) Constructs a new assignment from a variable, value, and description. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetCode()Returns a string of1's and0's that uniquely represents this object among other objects of the same type in the same story world.Returns a human-readable natural language description of the object.inthashCode()setDescription(String description) Returns a new assignment that is the same as this assignment, except that itsdescriptionis the given value.Returns a new assignment that is the same as this assignment, except that itsvalueis the given value.setVisible(boolean visible) Returns a new assignment that is the same as this assignment, except that itsvisibilityis the given value.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.toString()
-
Field Details
-
variable
The variable that is being assigned a value -
value
The value assigned to the variable -
visible
public final boolean visibleWhether or not this assignment can currently be observed. When an assignment can be observed, it is known to be the case. When it cannot be observed, it represents an assumed or last known value of the variable.
-
-
Constructor Details
-
Assignment
Constructs a new assignment from a variable, value, and description.- Parameters:
variable- the variable whose value is being assignedvalue- the value being assigned to the variablevisible- whether this assignment is visible and is known (true) or whether it is invisible and represents an assumed or last known value (false)description- a natural language description of what it means for this variable to have this value
-
Assignment
-
-
Method Details
-
equals
-
hashCode
-
toString
-
setValue
Returns a new assignment that is the same as this assignment, except that itsvalueis the given value.- Parameters:
value- the new value to be assigned to this assignment's variable- Returns:
- an assignment identical to this assignment, except with the given value
-
setVisible
Returns a new assignment that is the same as this assignment, except that itsvisibilityis the given value.- Parameters:
visible- true if this assignment is visible and therefore known or false if this assignment is not visible and represents an assumed or last known value- Returns:
- an assignment identical to this assignment, except with the given visibility
-
getDescription
Description copied from interface:DescribedReturns a human-readable natural language description of the object.- Specified by:
getDescriptionin interfaceDescribed- Returns:
- a human-readable natural language description of the object
-
setDescription
Returns a new assignment that is the same as this assignment, except that itsdescriptionis the given value.- Parameters:
description- the description the new assignment should have- Returns:
- an assignment identical to this assignment, except with the given description
-
getCode
Description copied from interface:EncodedReturns a string of1's and0's that uniquely represents this object among other objects of the same type in the same story world. Every encoded object of the same type should return a string of the same length, even if it must be padded with0's. -
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 interfaceLogical- Parameters:
substitution- a function which maps logical formulas that should be replaced to the formula they should be replaced with- Returns:
- an identical object, except that its logical formulas have been replaced according to the substitution
-