jmarkov.basic

## Class State

- java.lang.Object
- - jmarkov.basic.State

- All Implemented Interfaces:
    java.lang.Comparable<State>, JMarkovElement
  Direct Known Subclasses:
    GeomRelState, GeomState, PropertiesState, StateC, StateEvent

      public abstract class State
      extends java.lang.Object
      implements java.lang.Comparable<State>, JMarkovElement

  The Class State represent a state in a MarkovProcess or MDP. The user of the class should estiblish her own coding convention AND code the compareTo method. If the State can be represented with a vector of integers describing its properties, then it might be easier to implement PropertiesState rather than State.
  Version:
    1.0a
  Author:
    German Riaņo. Universidad de los Andes.
  See Also:
    `PropertiesState class`

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `State()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `compareTo(State j)` The method compareTo should be implemented in order to establish a total ordering among the States.
    `abstract void` | `computeMOPs(MarkovProcess<?,?> model)` This method should be implemented in order to compute all the measures of performance MOPs.
    `java.lang.String` | `description()` Returns a String that describes the State.
    `boolean` | `equals(java.lang.Object o)` If Object is not State it returns false.
    `int` | `getIndex()`
    `double` | `getMOP(int index)` Gets the value of this MOP.
    `double` | `getMOP(java.lang.String mopName, MarkovProcess<?,?> model)` Gets the value of the MOP with this name, by calling `getMOP(int)```
    `abstract boolean` | `isConsistent()` This method is called when a state is added to a set, if assertions are enabled.
    `abstract java.lang.String` | `label()` Returns a (hopefully short) label that descibes the State.
    `int` | `setMOP(int index, double value)` Sets the value of this MOP.
    `int` | `setMOP(MarkovProcess<?,?> model, java.lang.String mopName, double value)` Sets the value of the MOP with this name.
    `java.lang.String` | `toString()` Returns the label.

    - ### Methods inherited from class java.lang.Object

      `getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### State

          public State()

  - ### Method Detail

    - #### compareTo

          public abstract int compareTo(State j)

      The method compareTo should be implemented in order to establish a total ordering among the States.
      Specified by:
        `compareTo` in interface `java.lang.Comparable<State>`
      Returns:
        A positive integer if this is grater then j, negative if this is less then j and 0 if this == j.
      See Also:
        `Comparable.compareTo(Object)`

    - #### equals

          public final boolean equals(java.lang.Object o)

      If Object is not State it returns false. Otherwise equals := (compareTo(o)==0)
      Specified by:
        `equals` in interface `JMarkovElement`
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `o` - The Object to compare to.
      Returns:
        True if the elements are equal.
      See Also:
        `Object.equals(java.lang.Object)`

    - #### setMOP

          public final int setMOP(int index,
                   double value)

      Sets the value of this MOP.
      Parameters:
        `index` -
        `value` -
      Returns:
        the index where it was added.

    - #### setMOP

          public int setMOP(MarkovProcess<?,?> model,
                   java.lang.String mopName,
                   double value)

      Sets the value of the MOP with this name. If no MOP with this name exists a new one is declared.
      Parameters:
        `mopName` -
        `model` - The model being solved.
        `value` -
      Returns:
        the index where it was added.

    - #### computeMOPs

          public abstract void computeMOPs(MarkovProcess<?,?> model)

      This method should be implemented in order to compute all the measures of performance MOPs. Inside it you should issue commands like `setMop("Utilization server 1", x, model);`. * For large models override this method as empty and rather override getMOP(int). Do NOT mix both approaches!!
      Parameters:
        `model` - The model being solved.
      See Also:
        `getMOP(int)`

    - #### getMOP

          public final double getMOP(java.lang.String mopName,
                      MarkovProcess<?,?> model)

      Gets the value of the MOP with this name, by calling `getMOP(int)```
      Parameters:
        `mopName` - The name of the MOP.
        `model` - Model being solved.
      Returns:
        current MOP value
      See Also:
        `getMOP(int)`

    - #### getMOP

          public double getMOP(int index)

      Gets the value of this MOP. The value should had been set via the setMOP method. Alternatively, for better performance define the MOP Names when implementing the MarkovProcess class and override this method. To define the names in the constructor call the method setMOPs(String[]). The index is the same as the one used in the array in the aforementioned method.
      Parameters:
        `index` -
      Returns:
        The value of this MOP.
      See Also:
        `MarkovProcess.setMOPs(String[])`

    - #### isConsistent

          public abstract boolean isConsistent()

      This method is called when a state is added to a set, if assertions are enabled. You should include code that checks the consistency of the paprameters entered. It is very helpful during depelopment. Once assertions are disabled, this will not reduce the speed of your program.
      Returns:
        true if the state is consistent.

    - #### label

          public abstract java.lang.String label()

      Returns a (hopefully short) label that descibes the State. It is used by all print methods and in the GUI.
      Specified by:
        `label` in interface `JMarkovElement`
      Returns:
        A shor String label that identifies the state.
      See Also:
        `JMarkovElement.description()`

    - #### description

          public java.lang.String description()

      Returns a String that describes the State. By default it is an empty string, but you should implement it in order to get a meaningful description.
      Specified by:
        `description` in interface `JMarkovElement`
      Returns:
        A String description of the State
      See Also:
        `JMarkovElement.label()`

    - #### toString

          public final java.lang.String toString()

      Returns the label.
      Specified by:
        `toString` in interface `JMarkovElement`
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A String label.
      See Also:
        `label()`

    - #### getIndex

          public final int getIndex()

      Returns:
        The index in the State set