# StateMachine (ARX Developer Documentation)

org.deidentifier.arx.framework.check

## Class StateMachine

- java.lang.Object
- - org.deidentifier.arx.framework.check.StateMachine

-     public class StateMachine
      extends java.lang.Object

  This class implements a state machine, which determines which optimizations can be applied to the current transition depending on the previous transition.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `StateMachine.Transition` The resulting transition.
    `static class` | `StateMachine.TransitionType` The possible transition type.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StateMachine(History history)` Instantiates a new state machine.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `getLastNode()` Returns the last node.
    `StateMachine.Transition` | `getLastTransition()`
    `void` | `reset()` Resets the state machine.
    `StateMachine.Transition` | `transition(int[] currentNode)` Computes the best state transition.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StateMachine

          public StateMachine(History history)

      Instantiates a new state machine.
      Parameters:
        `history` - the history

  - ### Method Detail

    - #### getLastNode

          public int[] getLastNode()

      Returns the last node.
      Returns:
        the last node, which has been checked for k-anonymity

    - #### getLastTransition

          public StateMachine.Transition getLastTransition()

      Returns:

    - #### reset

          public void reset()

      Resets the state machine.

    - #### transition

          public StateMachine.Transition transition(int[] currentNode)

      Computes the best state transition.
      Parameters:
        `currentNode` - the current node
      Returns:
        the transition