Class StoryNodeLink

java.lang.Object
org.jgrapht.graph.DefaultEdge
com.adventure.models.nodes.StoryNodeLink
All Implemented Interfaces:
Serializable, Cloneable

public class StoryNodeLink extends org.jgrapht.graph.DefaultEdge
This class represents a game graph edge. It connects two story-nodes and represents a possible path for a player.
See Also:
  • Constructor Details

    • StoryNodeLink

      public StoryNodeLink()
      Default constructor
    • StoryNodeLink

      public StoryNodeLink(int id)
      Constructor for deserialization
      Parameters:
      id - id to set when creating the edge
  • Method Details

    • getID

      public String getID()
      Get String ID of the edge
      Returns:
      String ID of the edge
    • getNumericID

      public int getNumericID()
      Get int ID of the edge
      Returns:
      int ID of the edge
    • getLocked

      public boolean getLocked()
      Locked getter.
      Returns:
      Locked flag.
    • getKey

      public String getKey()
      Key getter.
      Returns:
      Key.
    • getAction

      public Action getAction()
      Action getter
      Returns:
      Action linked with this edge
    • setID

      public void setID(int ID)
      Set numeric and stringID with IdManager given an int ID
      Parameters:
      ID - int ID to set for the edge
    • setID

      public void setID()
      Set numericID and stringID with IdManager
    • setAction

      public void setAction(Action switchAction)
      Link another action to this edge
      Parameters:
      switchAction - new action to link to the edge
    • setLocked

      public void setLocked(boolean locked)
      Sets flag locked.
      Parameters:
      locked - Flag value.
    • setKey

      public void setKey(String key)
      Key setter. If a key is set, then the edge is automatically locked.
      Parameters:
      key - key.
    • tryUnlock

      public boolean tryUnlock(String key)
      Tries to unlock the link.
      Parameters:
      key - Key used to unlock.
      Returns:
      True if the link was unlocked successfully, false otherwise.
    • equals

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

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

      public Object clone()
      Overrides:
      clone in class Object