java.lang.Object
es.upm.fi.cig.multictbnc.data.representation.State

public class State extends Object
Represents the state of certain nodes/variables (events) by keeping their names and values. A certain state can only contain one event for each variable.
  • Constructor Details

    • State

      public State()
      Default constructor.
    • State

      public State(Map<String,String> events)
      Creates a State instance with some events.
      Parameters:
      events - events to include to the State
    • State

      public State(String nameVariable, String valueVariable)
      Creates a State instance with one event.
      Parameters:
      nameVariable - name of the variable
      valueVariable - value of the variable
    • State

      public State(State state)
      Constructor to clone states;
      Parameters:
      state - State to clone
  • Method Details

    • addEvent

      public void addEvent(String nameVariable, String valueVariable)
      Adds an event (a variable taking a certain value) to the state.
      Parameters:
      nameVariable - name of the variable
      valueVariable - value of the variable
    • addEvents

      public void addEvents(Map<String,String> events)
      Adds events to the state.
      Parameters:
      events - events to add
    • getEvents

      public Map<String,String> getEvents()
      Returns the events of the state.
      Returns:
      Map with events
    • getNameVariables

      public List<String> getNameVariables()
      Returns the names of the variables collected by the State object.
      Returns:
      names of the variables
    • getValueVariable

      public String getValueVariable(String nameVariable)
      Returns the value for a specific variable. Null is returned if the variable is not present.
      Parameters:
      nameVariable - name of the variable
      Returns:
      value of the specified node for this state
    • getValues

      public String[] getValues()
      Returns all the values in the State.
      Returns:
      value of the specified node for this state
    • modifyEventValue

      public void modifyEventValue(String nameVariable, String newValue)
      Modifies the value of a given variable.
      Parameters:
      nameVariable - name of the variable
      newValue - new value for the variable in this state
    • hashCode

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

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object