Class ZAutomaton<V>
- Type Parameters:
V- the label value type
- All Implemented Interfaces:
FormatClient,Traceable<List<V>>,Traversable<List<V>,,ZAutomaton<V>> Serializable
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionfinal classIterator-like mutable API for tracking the consumption of an input sequence of code points by an automaton. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static booleanThe flag to control ASCII caching.static final StringThe name of the boolean-valued property to control ASCII caching.Fields inherited from class eu.bandm.tools.lexic.Behavior
label, transitions -
Method Summary
Modifier and TypeMethodDescriptionBehavior<List<V>, ZAutomaton<V>> getBehavior(ZAutomaton<V> state) Returns the automaton behavior the given state node.Returns the initial state node of the transition graph.(package private) voidChanges the transitions of this automaton according to a given substitution.(package private) static <V> ZAutomaton<V> Creates a prototype automaton from a symbolic behavior.toString()Returns a human-readable representation of this behavior.trace()Returns a fresh trace.Methods inherited from class eu.bandm.tools.lexic.Behavior
allKeysMatch, anyTransition, constant, consume, consumeAnyOf, consumeAnyOf, consumeAnyOfRange, consumeAnyOfRange, consumeExcept, countTransitions, forEachKey, forEachTransition, forEachTransition, format, format, getDefaultTransition, getLabel, getTransition, intersect, map, mapTransitions, merge, of, simplify, totalize, transitions, translate
-
Field Details
-
ASCII_CACHE_PROPERTY_NAME
The name of the boolean-valued property to control ASCII caching.- See Also:
-
ASCII_CACHE
static boolean ASCII_CACHEThe flag to control ASCII caching.
-
-
Method Details
-
prototype
Creates a prototype automaton from a symbolic behavior.This construction exploits type erasure on the JVM; the transitions of the resulting automaton are ill-typed, and latent causes for
ClassCastExceptionmay arise if it is used without correction. A call to methodhardPatch(java.util.Map<?, ? extends eu.bandm.tools.lexic.Behavior<java.util.List<V>, ?>>)should substitute references of typeZAutomatonfor all transitions before attempting to use the automaton.- Type Parameters:
V- the value type- Parameters:
beh- the symbolic behavior to emulate- Returns:
- a prototype automaton
- See Also:
-
hardPatch
Changes the transitions of this automaton according to a given substitution.The type of the substituted values is not checked either at compile time or at execution time. Latent causes for
ClassCastExceptionmay arise if this method is used carelessly.- Parameters:
substitution- the substitution to apply; values not present as keys are left unchanged- See Also:
-
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.
-
toString
Description copied from class:BehaviorReturns a human-readable representation of this behavior. -
getInitialState
Returns the initial state node of the transition graph.- Specified by:
getInitialStatein interfaceTraversable<List<V>,ZAutomaton<V>> - Returns:
- the initial state node of the transition graph
-
getBehavior
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:
getBehaviorin interfaceTraversable<List<V>,ZAutomaton<V>> - Parameters:
state- a state node- Returns:
- the automaton behavior at the given state
-