Package owl.automaton
Class HashMapAutomaton<S,A extends OmegaAcceptance>
- java.lang.Object
-
- owl.automaton.HashMapAutomaton<S,A>
-
- All Implemented Interfaces:
Automaton<S,A>,EdgeMapAutomatonMixin<S,A>,MutableAutomaton<S,A>
public final class HashMapAutomaton<S,A extends OmegaAcceptance> extends Object implements EdgeMapAutomatonMixin<S,A>, MutableAutomaton<S,A>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface owl.automaton.Automaton
Automaton.EdgeMapVisitor<S>, Automaton.EdgeTreeVisitor<S>, Automaton.EdgeVisitor<S>, Automaton.PreferredEdgeAccess, Automaton.Property, Automaton.Visitor<S>
-
-
Field Summary
-
Fields inherited from interface owl.automaton.EdgeMapAutomatonMixin
ACCESS_MODES
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(Automaton.EdgeMapVisitor<S> visitor)voidaccept(Automaton.EdgeTreeVisitor<S> visitor)voidaccept(Automaton.EdgeVisitor<S> visitor)Aacceptance()Returns the acceptance condition of this automaton.voidacceptance(A acceptance)voidaddEdge(S source, ValuationSet valuations, Edge<? extends S> edge)Adds transitions from thesourcestate undervaluations.voidaddInitialState(S initialState)Add an initial state to the automaton.voidaddState(S state)Adds astatewithout outgoing edges to the set of states.static <S,A extends OmegaAcceptance>
HashMapAutomaton<S,A>copyOf(Automaton<S,A> source)Edge<S>edge(S state, BitSet valuation)Returns the successor edge of the specifiedstateunder the givenvaluation.Map<Edge<S>,ValuationSet>edgeMap(S state)Returns a mapping from all outgoing edges to their valuations of the specifiedstate.Set<Edge<S>>edges(S state)Returns all successor edges of the specifiedstateunder any valuation.ValuationTree<Edge<S>>edgeTree(S state)Returns a decision-tree with nodes labelled by literals and sets of edges as leaves.ValuationSetFactoryfactory()Returns the backing engine for the symbolic representation of edges.Set<S>initialStates()Returns the set of initial states, which can potentially be empty.voidinitialStates(Collection<? extends S> initialStates)Sets the set of initial states of the automaton.Stringname()voidname(String name)Sets the name of the automaton.static <S,A extends OmegaAcceptance>
HashMapAutomaton<S,A>of(A acceptance, ValuationSetFactory vsFactory)Creates an empty automaton with given acceptance condition.static <S,A extends OmegaAcceptance>
HashMapAutomaton<S,A>of(A acceptance, ValuationSetFactory vsFactory, Collection<S> initialStates, BiFunction<S,BitSet,Edge<S>> successors, Function<S,BitSet> alphabet)voidremoveEdge(S source, ValuationSet valuations, S destination)Removes all transition fromsourceundervaluationstodestination.voidremoveInitialState(S initialState)voidremoveStateIf(Predicate<? super S> stateFilter)Removes the specifiedstatesand all transitions involving them from the automaton.Set<S>states()The set of all from the initial states reachable states in this automaton.Set<S>successors(S state)Returns all successors of the specifiedstate.StringtoString()voidtrim()Removes unreachable states and adjust internal data structures after mutation.voidupdateEdges(BiFunction<S,Edge<S>,Edge<S>> updater)Remaps each edge of the automaton according toupdater.voidupdateEdges(Set<? extends S> states, BiFunction<? super S,Edge<S>,Edge<S>> f)Remaps each outgoing edge of the specifiedstatesaccording toupdater.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface owl.automaton.Automaton
accept, is, onlyInitialState, predecessors, size, successor, successors
-
Methods inherited from interface owl.automaton.EdgeMapAutomatonMixin
edges, preferredEdgeAccess
-
Methods inherited from interface owl.automaton.MutableAutomaton
addEdge, removeEdge, removeState, updateAcceptance
-
-
-
-
Method Detail
-
acceptance
public A acceptance()
Description copied from interface:AutomatonReturns the acceptance condition of this automaton.- Specified by:
acceptancein interfaceAutomaton<S,A extends OmegaAcceptance>- Returns:
- The acceptance.
-
acceptance
public void acceptance(A acceptance)
- Specified by:
acceptancein interfaceMutableAutomaton<S,A extends OmegaAcceptance>
-
initialStates
public Set<S> initialStates()
Description copied from interface:AutomatonReturns the set of initial states, which can potentially be empty.- Specified by:
initialStatesin interfaceAutomaton<S,A extends OmegaAcceptance>- Returns:
- The set of initial states.
-
initialStates
public void initialStates(Collection<? extends S> initialStates)
Description copied from interface:MutableAutomatonSets the set of initial states of the automaton.- Specified by:
initialStatesin interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
initialStates- The new set of initial states (potentially empty)
-
addInitialState
public void addInitialState(S initialState)
Description copied from interface:MutableAutomatonAdd an initial state to the automaton.- Specified by:
addInitialStatein interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
initialState- The added initial state.
-
removeInitialState
public void removeInitialState(S initialState)
- Specified by:
removeInitialStatein interfaceMutableAutomaton<S,A extends OmegaAcceptance>
-
states
public Set<S> states()
Description copied from interface:AutomatonThe set of all from the initial states reachable states in this automaton.- Specified by:
statesin interfaceAutomaton<S,A extends OmegaAcceptance>- Returns:
- All reachable states
-
addState
public void addState(S state)
Description copied from interface:MutableAutomatonAdds astatewithout outgoing edges to the set of states. If the state is already present, nothing is changed.- Specified by:
addStatein interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
state- The state to be added.
-
removeStateIf
public void removeStateIf(Predicate<? super S> stateFilter)
Description copied from interface:MutableAutomatonRemoves the specifiedstatesand all transitions involving them from the automaton.- Specified by:
removeStateIfin interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
stateFilter- The states to be removed.
-
edge
@Nullable public Edge<S> edge(S state, BitSet valuation)
Description copied from interface:AutomatonReturns the successor edge of the specifiedstateunder the givenvaluation. Returns some edge if there is a non-deterministic choice in this state for the specified valuation.If you want to check if this is the unique edge use the
Automaton.edges(Object, BitSet)method.- Specified by:
edgein interfaceAutomaton<S,A extends OmegaAcceptance>- Parameters:
state- The starting state of the transition.valuation- The valuation.- Returns:
- A successor edge or
nullif none. - See Also:
Automaton.edgeMap(Object)
-
edges
public Set<Edge<S>> edges(S state)
Description copied from interface:AutomatonReturns all successor edges of the specifiedstateunder any valuation.- Specified by:
edgesin interfaceAutomaton<S,A extends OmegaAcceptance>- Specified by:
edgesin interfaceEdgeMapAutomatonMixin<S,A extends OmegaAcceptance>- Parameters:
state- The starting state of the edges.- Returns:
- The set of edges originating from
state
-
edgeMap
public Map<Edge<S>,ValuationSet> edgeMap(S state)
Description copied from interface:AutomatonReturns a mapping from all outgoing edges to their valuations of the specifiedstate.- Specified by:
edgeMapin interfaceAutomaton<S,A extends OmegaAcceptance>- Parameters:
state- The state.- Returns:
- All labelled edges of the state.
-
edgeTree
public ValuationTree<Edge<S>> edgeTree(S state)
Description copied from interface:AutomatonReturns a decision-tree with nodes labelled by literals and sets of edges as leaves.- Specified by:
edgeTreein interfaceAutomaton<S,A extends OmegaAcceptance>- Specified by:
edgeTreein interfaceEdgeMapAutomatonMixin<S,A extends OmegaAcceptance>- Parameters:
state- The state.- Returns:
- A tree.
-
successors
public Set<S> successors(S state)
Description copied from interface:AutomatonReturns all successors of the specifiedstate.- Specified by:
successorsin interfaceAutomaton<S,A extends OmegaAcceptance>- Parameters:
state- The starting state of the transition.- Returns:
- The successor set.
-
addEdge
public void addEdge(S source, ValuationSet valuations, Edge<? extends S> edge)
Description copied from interface:MutableAutomatonAdds transitions from thesourcestate undervaluations.- Specified by:
addEdgein interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
source- The source state.valuations- The valuations under which this transition is possible.edge- The respective edge, containing destination and acceptance information.
-
removeEdge
public void removeEdge(S source, ValuationSet valuations, S destination)
Description copied from interface:MutableAutomatonRemoves all transition fromsourceundervaluationstodestination. Requires both states to be present in the automaton.- Specified by:
removeEdgein interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
source- The source state.valuations- The valuations.destination- The destination state.
-
updateEdges
public void updateEdges(Set<? extends S> states, BiFunction<? super S,Edge<S>,Edge<S>> f)
Description copied from interface:MutableAutomatonRemaps each outgoing edge of the specifiedstatesaccording toupdater.The function is allowed to return
nullwhich indicates that the edge should be removed. Requires allstatesto be present in the automaton.- Specified by:
updateEdgesin interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
states- The states whose outgoing edges are to be remapped.f- The remapping function. The updater needs to be stateless, since it might be called with unreachable states.
-
updateEdges
public void updateEdges(BiFunction<S,Edge<S>,Edge<S>> updater)
Description copied from interface:MutableAutomatonRemaps each edge of the automaton according toupdater.The function is allowed to return
nullwhich indicates that the edge should be removed.- Specified by:
updateEdgesin interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
updater- The remapping function. The updater needs to be stateless, since it might be called with unreachable states.- See Also:
MutableAutomaton.updateEdges(Set, BiFunction)
-
accept
public void accept(Automaton.EdgeVisitor<S> visitor)
- Specified by:
acceptin interfaceAutomaton<S,A extends OmegaAcceptance>
-
accept
public void accept(Automaton.EdgeMapVisitor<S> visitor)
- Specified by:
acceptin interfaceAutomaton<S,A extends OmegaAcceptance>
-
accept
public void accept(Automaton.EdgeTreeVisitor<S> visitor)
- Specified by:
acceptin interfaceAutomaton<S,A extends OmegaAcceptance>
-
factory
public ValuationSetFactory factory()
Description copied from interface:AutomatonReturns the backing engine for the symbolic representation of edges. Only this engine might be used for the access to edges.- Specified by:
factoryin interfaceAutomaton<S,A extends OmegaAcceptance>- Returns:
- The symbolic engine used to generate ValuationSets.
-
name
public void name(String name)
Description copied from interface:MutableAutomatonSets the name of the automaton.- Specified by:
namein interfaceMutableAutomaton<S,A extends OmegaAcceptance>- Parameters:
name- The new name of the automaton.
-
trim
public void trim()
Description copied from interface:MutableAutomatonRemoves unreachable states and adjust internal data structures after mutation.- Specified by:
trimin interfaceMutableAutomaton<S,A extends OmegaAcceptance>
-
of
public static <S,A extends OmegaAcceptance> HashMapAutomaton<S,A> of(A acceptance, ValuationSetFactory vsFactory)
Creates an empty automaton with given acceptance condition. ThevaluationSetFactoryis used as transition backend.- Type Parameters:
S- The states of the automaton.A- The acceptance condition of the automaton.- Parameters:
acceptance- The acceptance of the new automaton.vsFactory- The alphabet.- Returns:
- Empty automaton with the specified parameters.
-
of
public static <S,A extends OmegaAcceptance> HashMapAutomaton<S,A> of(A acceptance, ValuationSetFactory vsFactory, Collection<S> initialStates, BiFunction<S,BitSet,Edge<S>> successors, Function<S,BitSet> alphabet)
-
copyOf
public static <S,A extends OmegaAcceptance> HashMapAutomaton<S,A> copyOf(Automaton<S,A> source)
-
-