Class Asset

java.lang.Object
edu.uky.cs.nil.tt.world.Asset
All Implemented Interfaces:
Described, Logical, Unique
Direct Known Subclasses:
Entity, SignedAsset

public abstract class Asset extends Object implements Unique, Described, Logical
An asset is any named object or concept in a story world. Every asset of the same type has a unique, sequential ID number starting at 0 and a unique name. This means no two entities of the same type share an ID number. For example, the first Entity in a world has ID 0, and no other entity has ID 0, but the first Variable in a world also has ID 0.
Author:
Stephen G. Ware
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    This asset's ID number, which is unique among other assets of the same type
    final String
    This asset's name, which is unique among other assets of the same type
  • Constructor Summary

    Constructors
    Constructor
    Description
    Asset(int id, String name, String description)
    Constructs a new asset with the given ID number, name, and description.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object other)
     
    Returns a human-readable natural language description of the object.
    int
    Returns this object's unique, sequential, integer ID number that distinguishes it from other objects of the same type in the same story world.
    Returns the asset's name, which is unique among other assets of the same type in the story world.
    int
     
    abstract Asset
    setDescription(String description)
    Returns a new asset that is the same as this asset, except that its description is the given value.
    protected abstract Asset
    setID(int id)
    Returns a new asset that is the same as this asset, except that its ID number is the given value.
    abstract Asset
    Returns a logical object identical to this one, except that its logical elements have been replaced according to the given substitution.
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • id

      public final int id
      This asset's ID number, which is unique among other assets of the same type
    • name

      public final String name
      This asset's name, which is unique among other assets of the same type
  • Constructor Details

    • Asset

      public Asset(int id, String name, String description)
      Constructs a new asset with the given ID number, name, and description.
      Parameters:
      id - the asset's unique ID number
      name - the asset's unique name
      description - the asset's description
  • Method Details

    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getID

      public int getID()
      Description copied from interface: Unique
      Returns this object's unique, sequential, integer ID number that distinguishes it from other objects of the same type in the same story world.
      Specified by:
      getID in interface Unique
      Returns:
      the object's ID number
    • setID

      protected abstract Asset setID(int id)
      Returns a new asset that is the same as this asset, except that its ID number is the given value.
      Parameters:
      id - the ID number the new asset should have
      Returns:
      an asset identical to this asset, except with the given ID number
    • getName

      public String getName()
      Returns the asset's name, which is unique among other assets of the same type in the story world.
      Returns:
      the asset's unique name
    • getDescription

      public String getDescription()
      Description copied from interface: Described
      Returns a human-readable natural language description of the object.
      Specified by:
      getDescription in interface Described
      Returns:
      a human-readable natural language description of the object
    • setDescription

      public abstract Asset setDescription(String description)
      Returns a new asset that is the same as this asset, except that its description is the given value.
      Parameters:
      description - the description the new asset should have
      Returns:
      an asset identical to this asset, except with the given description
    • substitute

      public abstract Asset substitute(Function<Object,Object> substitution)
      Description copied from interface: Logical
      Returns 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:
      substitute in interface Logical
      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