Class ZAutomaton<V>

java.lang.Object
eu.bandm.tools.lexic.Behavior<List<V>,ZAutomaton<V>>
eu.bandm.tools.lexic.ZAutomaton<V>
Type Parameters:
V - the label value type
All Implemented Interfaces:
FormatClient, Traceable<List<V>>, Traversable<List<V>,ZAutomaton<V>>, Serializable

@PropertyDependency("eu.bandm.tools.lexic.ZAutomaton.asciiCache") public class ZAutomaton<V> extends Behavior<List<V>,ZAutomaton<V>> implements Traceable<List<V>>, Traversable<List<V>,ZAutomaton<V>>
Zero-overhead automaton that is identical to the behavior of its own initial state.

The recommended way to construct a zero-overhead automaton is from a deterministic automaton using DAutomaton.deflate(). Manual construction with prototype(Behavior) and hardPatch(Map) is low-level and error-prone.

The caching of ASCII code points in a direct lookup table is a recommended optimization. It is controlled by the system property ASCII_CACHE_PROPERTY_NAME, which can take values "true" (default) or "false".

See Also:
  • Field Details

    • ASCII_CACHE_PROPERTY_NAME

      public static final String ASCII_CACHE_PROPERTY_NAME
      The name of the boolean-valued property to control ASCII caching.
      See Also:
  • Method Details

    • trace

      public ZAutomaton<V>.Trace trace()
      Returns a fresh trace.

      Objects obtained as return values from multiple calls to this method do not share mutable state with each other, and can be used safely in concurrency.

      Specified by:
      trace in interface Traceable<V>
      Returns:
      a fresh trace
    • toString

      public String toString()
      Description copied from class: Behavior
      Returns a human-readable representation of this behavior.
      Overrides:
      toString in class Behavior<List<V>,ZAutomaton<V>>
    • getInitialState

      public ZAutomaton<V> getInitialState()
      Returns the initial state node of the transition graph.
      Specified by:
      getInitialState in interface Traversable<List<V>,ZAutomaton<V>>
      Returns:
      the initial state node of the transition graph
    • getBehavior

      public Behavior<List<V>,ZAutomaton<V>> getBehavior(ZAutomaton<V> state)
      Returns the automaton behavior the given state node.

      The behavior specifies the label attached to the state node, as well as the outgoing transition edges.

      Specified by:
      getBehavior in interface Traversable<List<V>,ZAutomaton<V>>
      Parameters:
      state - a state node
      Returns:
      the automaton behavior at the given state