jmarkov.basic

## Class TransitionsSet<S extends State>

- java.lang.Object
- - jmarkov.basic.TransitionsSet<S>

- Type Parameters:
    `S` - States class
  All Implemented Interfaces:
    java.lang.Iterable<Transition<S>>, JMarkovElement, Transitions<S>

      public final class TransitionsSet<S extends State>
      extends java.lang.Object
      implements JMarkovElement, Transitions<S>

  Author:
    German Riano. Universidad de los Andes. (C) 2006

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TransitionsSet()` Default Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `add(S state, double rate)` Adds a transition with the given state and rate.
    `boolean` | `add(Transition<S> t)`
    `boolean` | `add(Transitions<S> trans)` Adds all the given Transtions to the current set.
    `double` | `addRate(S state, double rate)` Adds the given rate to the transition to this state.
    `java.lang.String` | `description()` This method return a complete verbal describtion of this element.
    `double` | `getRate(S state)` Gets the rate for this state.
    `java.util.Iterator<Transition<S>>` | `iterator()` Returns an iterator used to walk through the Transitions.
    `java.lang.String` | `label()` This method returns a short String used in the user interface to describe this element.
    `int` | `size()` Returns the number of Transtions represented by this object.
    `java.lang.String` | `toString()` This method returns a short String used in the user interface to describe this element.

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

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

    - ### Methods inherited from interface jmarkov.basic.JMarkovElement

      `equals`

- - ### Constructor Detail

    - #### TransitionsSet

          public TransitionsSet()

      Default Constructor.

  - ### Method Detail

    - #### add

          public boolean add(Transition<S> t)

      Specified by:
        `add` in interface `Transitions<S extends State>`
      Parameters:
        `t` - The trenasition to add.
      Returns:
        true of the element was already in the set.
      See Also:
        `Transitions.add(jmarkov.basic.Transition)`

    - #### add

          public boolean add(Transitions<S> trans)

      Adds all the given Transtions to the current set.
      Parameters:
        `trans` - A collection of Transitions
      Returns:
        true if none of the elements was in the set.
      See Also:
        `Set.addAll(java.util.Collection)`

    - #### add

          public boolean add(S state,
                    double rate)

      Adds a transition with the given state and rate.
      Specified by:
        `add` in interface `Transitions<S extends State>`
      Parameters:
        `state` - State the transition goes to
        `rate` - The rate at which this transition occurs.
      Returns:
        true if the state was already on the set.
      See Also:
        `Transitions.add(State, double)`

    - #### addRate

          public double addRate(S state,
                       double rate)

      Adds the given rate to the transition to this state.
      Specified by:
        `addRate` in interface `Transitions<S extends State>`
      Parameters:
        `state` -
        `rate` -
      Returns:
        The old value associated with this state.

    - #### getRate

          public double getRate(S state)

      Gets the rate for this state. It returns 0.0 if this state is not in the Transitions.
      Specified by:
        `getRate` in interface `Transitions<S extends State>`
      Parameters:
        `state` -
      Returns:
        The rate for this state

    - #### size

          public int size()

      Description copied from interface: `Transitions`
      Returns the number of Transtions represented by this object.
      Specified by:
        `size` in interface `Transitions<S extends State>`
      Returns:
        The number of Transitions.
      See Also:
        `Set.size()`

    - #### label

          public java.lang.String label()

      Description copied from interface: `JMarkovElement`
      This method returns a short String used in the user interface to describe this element.
      Specified by:
        `label` in interface `JMarkovElement`
      Returns:
        A String label.
      See Also:
        `JMarkovElement.description()`

    - #### description

          public java.lang.String description()

      Description copied from interface: `JMarkovElement`
      This method return a complete verbal describtion of this element. This description may contain multiple text rows.
      Specified by:
        `description` in interface `JMarkovElement`
      Returns:
        A String describing this element.
      See Also:
        `JMarkovElement.label()`

    - #### toString

          public final java.lang.String toString()

      Description copied from interface: `JMarkovElement`
      This method returns a short String used in the user interface to describe this element. It is highly recommended that every class calls label(), using the following code:

           public final String toString() {
               return label();
           }

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

    - #### iterator

          public java.util.Iterator<Transition<S>> iterator()

      Returns an iterator used to walk through the Transitions.
      Specified by:
        `iterator` in interface `java.lang.Iterable<Transition<S extends State>>`
      See Also:
        `Iterable.iterator()`