org.apache.mina.statemachine

## Class State

- java.lang.Object
- - org.apache.mina.statemachine.State

-     public class State
      extends Object

  Represents a state in a `StateMachine`. Normally you wouldn't create instances of this class directly but rather use the `State` annotation to define your states and then let `StateMachineFactory` create a `StateMachine` for you.

  `State`s inherits `Transition`s from their parent. A `State` can override any of the parents `Transition`s. When an `Event` is processed the `Transition`s of the current `State` will be searched for a `Transition` which can handle the event. If none is found the `State`'s parent will be searched and so on.

  Author:
    Apache MINA Project

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `State(String id)` Creates a new `State` with the specified id.
    `State(String id, State parent)` Creates a new `State` with the specified id and parent.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `State` | `addTransition(Transition transition)` Adds an outgoing `Transition` to this `State` with weight 0.
    `State` | `addTransition(Transition transition, int weight)` Adds an outgoing `Transition` to this `State` with the specified weight.
    `boolean` | `equals(Object o)`
    `String` | `getId()` Returns the id of this `State`.
    `List<SelfTransition>` | `getOnEntrySelfTransitions()` Returns an unmodifiable `List` of entry `SelfTransition`s
    `List<SelfTransition>` | `getOnExitSelfTransitions()` Returns an unmodifiable `List` of exit `SelfTransition`s
    `State` | `getParent()` Returns the parent `State`.
    `List<Transition>` | `getTransitions()` Returns an unmodifiable `List` of `Transition`s going out from this `State`.
    `int` | `hashCode()`
    `String` | `toString()`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### State

          public State(String id)

      Creates a new `State` with the specified id.
      Parameters:
        `id` - the unique id of this `State`.

    - #### State

          public State(String id,
               State parent)

      Creates a new `State` with the specified id and parent.
      Parameters:
        `id` - the unique id of this `State`.
        `parent` - the parent `State`.

  - ### Method Detail

    - #### getId

          public String getId()

      Returns the id of this `State`.
      Returns:
        the id.

    - #### getParent

          public State getParent()

      Returns the parent `State`.
      Returns:
        the parent or `null` if this `State` has no parent.

    - #### getTransitions

          public List<Transition> getTransitions()

      Returns an unmodifiable `List` of `Transition`s going out from this `State`.
      Returns:
        the `Transition`s.

    - #### getOnEntrySelfTransitions

          public List<SelfTransition> getOnEntrySelfTransitions()

      Returns an unmodifiable `List` of entry `SelfTransition`s
      Returns:
        the `SelfTransition`s.

    - #### getOnExitSelfTransitions

          public List<SelfTransition> getOnExitSelfTransitions()

      Returns an unmodifiable `List` of exit `SelfTransition`s
      Returns:
        the `SelfTransition`s.

    - #### addTransition

          public State addTransition(Transition transition)

      Adds an outgoing `Transition` to this `State` with weight 0.
      Parameters:
        `transition` - the `Transition` to add.
      Returns:
        this `State`.
      See Also:
        `addTransition(Transition, int)`

    - #### addTransition

          public State addTransition(Transition transition,
                            int weight)

      Adds an outgoing `Transition` to this `State` with the specified weight. The higher the weight the less important a `Transition` is. If two `Transition`s match the same `Event` the `Transition` with the lower weight will be executed.
      Parameters:
        `transition` - the `Transition` to add.
      Returns:
        this `State`.

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2004-2012 Apache MINA Project. All Rights Reserved.