Class AssetBuilder

java.lang.Object
edu.uky.cs.nil.tt.world.AssetBuilder

public class AssetBuilder extends Object
A tool for defining the assets used in a story world. Assets can be defined using this object's various add methods, and then this object can be passed to World's constructor to define the name and assets the world will have.

Note that this object does not check the correctness of the defined assets. For example, it is possible to define multiple assets of the same type with the same name. An exception will be thrown when constructing the World object, which checks the correctness of all asset definitions.

Author:
Stephen G. Ware
  • Constructor Details

    • AssetBuilder

      public AssetBuilder()
      Constructs an empty asset builder.
  • Method Details

    • setName

      public void setName(String name)
      Constructs a new asset builder with a given world name.
      Parameters:
      name - the name the world containing these assets will have
    • addEntity

      public Entity addEntity(String name, String description)
      Defines a new entity.
      Parameters:
      name - the unique name of the entity
      description - a natural language description of the entity
      Returns:
      an entity object with those properties
    • addVariable

      public Variable addVariable(Signature signature, String encoding, String description)
      Defines a new variable.
      Parameters:
      signature - the unique signature of the variable
      encoding - the name of the encoding type of the variable
      description - a natural language description of the variable
      Returns:
      a variable object with those properties
    • addAction

      public Action addAction(Signature signature, Entity[] consenting, String description)
      Defines a new action.
      Parameters:
      signature - the unique signature of the action
      consenting - the characters in the story world who need a reason to take the action
      description - a natural language description of the action
      Returns:
      an action object with those properties
    • addEnding

      public Ending addEnding(Signature signature, String description)
      Defines a new ending.
      Parameters:
      signature - the unique signature of the ending
      description - a natural language description of the ending
      Returns:
      an ending object with those properties