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 with a blank description.Assignment(Variable variable, Value value, 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.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
-
-
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 variabledescription- a natural language description of what it means for this variable to have this value
-
Assignment
-
-
Method Details
-
equals
-
hashCode
-
toString
-
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 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
-