Class Action
java.lang.Object
edu.uky.cs.nil.tt.world.Asset
edu.uky.cs.nil.tt.world.SignedAsset
edu.uky.cs.nil.tt.world.Action
An action is a
signed asset that causes a change in a
story world's state. The agents in a session negotiate when actions happen
via turns.- Author:
- Stephen G. Ware
-
Field Summary
Fields inherited from class SignedAsset
signature -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbooleanReturns true if the given story role controls one or more of theconsenting charactersfor this action.getCode()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 an unmodifiable set of entities in the story world representing the characters who need to agree to take the action.protected ActionReturns a new action that is the same as this action, except this itscodeis the given value.protected ActionsetConsenting(Set<Entity> consenting) Returns a new action that is the same as this action, except that its consenting characters is the given set.setDescription(String description) Returns a new asset that is the same as this asset, except that itsdescriptionis the given value.protected ActionsetID(int id) Returns a new asset that is the same as this asset, except that its ID number is the given value.protected ActionsetSignature(Signature signature) Returns a new signed asset that is the same as this asset, except that its signature and name are 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.
-
Constructor Details
-
Action
Constructs a new action.- Parameters:
id- the action's unique ID numbersignature- the action's unique signatureconsenting- an array of entities representing characters in the the story world who need to agree to take the actiondescription- the action's descriptioncode- the action's code
-
-
Method Details
-
compareTo
- Specified by:
compareToin interfaceComparable<Action>
-
setID
Description copied from class:AssetReturns a new asset that is the same as this asset, except that its ID number is the given value. -
setSignature
Description copied from class:SignedAssetReturns a new signed asset that is the same as this asset, except that its signature and name are the given value.- Specified by:
setSignaturein classSignedAsset- Parameters:
signature- the signature and name the new asset should have- Returns:
- a signed asset identical to this asset, except with the given signature and name
-
getConsenting
Returns an unmodifiable set of entities in the story world representing the characters who need to agree to take the action. An action with no consenting characters represents an accident or happening that can occur and time it is convenient for the story. An action with one consenting character means it is taken by a single character. An action with two or more consenting characters means it is a joint action taken by many characters who all need to have a reason to do it. Note that a character can be involved in an action without being a consenting character if the action represents something that happens to the character against their will.- Returns:
- the action's set of consenting characters
-
setConsenting
Returns a new action that is the same as this action, except that its consenting characters is the given set.- Parameters:
consenting- the consenting characters the new action should have- Returns:
- an action identical to this action, except with the given consenting characters
-
setDescription
Description copied from class:AssetReturns a new asset that is the same as this asset, except that itsdescriptionis the given value.- Specified by:
setDescriptionin classAsset- Parameters:
description- the description the new asset should have- Returns:
- an asset identical to this asset, 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. -
setCode
-
consents
Returns true if the given story role controls one or more of theconsenting charactersfor this action. An action with no consenting character requires on the consent of the game master. An action whose only consenting character is the player character requires only the consent of the player. All other actions require the consent of both roles.- Parameters:
role- the role in question- Returns:
- true if the given role needs to consent to take this action
-
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- Specified by:
substitutein classSignedAsset- 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
-