Package owl.automaton
Class HashMapAutomaton<S,A extends EmersonLeiAcceptance>
- java.lang.Object
-
- owl.automaton.HashMapAutomaton<S,A>
-
- All Implemented Interfaces:
Automaton<S,A>,MutableAutomaton<S,A>
public final class HashMapAutomaton<S,A extends EmersonLeiAcceptance> extends Object implements MutableAutomaton<S,A>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface owl.automaton.Automaton
Automaton.Property
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Aacceptance()Returns the acceptance condition of this automaton.voidacceptance(A acceptance)voidaddEdge(S source, BddSet 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.List<String>atomicPropositions()static <S,A extends EmersonLeiAcceptance>
HashMapAutomaton<S,A>copyOf(Automaton<S,A> source)static <S,A extends EmersonLeiAcceptance>
HashMapAutomaton<S,A>create(List<String> atomicPropositions, A acceptance)Creates an empty automaton with given acceptance condition.static <S,A extends EmersonLeiAcceptance>
HashMapAutomaton<S,A>create(List<String> atomicPropositions, BddSetFactory vsFactory, A acceptance)Creates an empty automaton with given acceptance condition.Edge<S>edge(S state, BitSet valuation)Returns the successor edge of the specifiedstateunder the givenvaluation.Map<Edge<S>,BddSet>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.Set<Edge<S>>edges(S state, BitSet valuation)Returns the successor edges of the specifiedstateunder the givenvaluation.MtBdd<Edge<S>>edgeTree(S state)Returns a decision-tree with nodes labelled by literals and sets of edges as leaves.BddSetFactoryfactory()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.voidremoveEdge(S source, BddSet 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.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, toString, wait, wait, wait
-
Methods inherited from interface owl.automaton.Automaton
initialState, is, predecessors, successor, successors
-
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 EmersonLeiAcceptance>- Returns:
- The acceptance.
-
atomicPropositions
public List<String> atomicPropositions()
- Specified by:
atomicPropositionsin interfaceAutomaton<S,A extends EmersonLeiAcceptance>
-
acceptance
public void acceptance(A acceptance)
- Specified by:
acceptancein interfaceMutableAutomaton<S,A extends EmersonLeiAcceptance>
-
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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- Parameters:
initialState- The added initial state.
-
removeInitialState
public void removeInitialState(S initialState)
- Specified by:
removeInitialStatein interfaceMutableAutomaton<S,A extends EmersonLeiAcceptance>
-
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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- Parameters:
state- The starting state of the edges.- Returns:
- The set of edges originating from
state
-
edgeMap
public Map<Edge<S>,BddSet> 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 EmersonLeiAcceptance>- Parameters:
state- The state.- Returns:
- All labelled edges of the state.
-
edgeTree
public MtBdd<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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- Parameters:
state- The starting state of the transition.- Returns:
- The successor set.
-
addEdge
public void addEdge(S source, BddSet valuations, Edge<? extends S> edge)
Description copied from interface:MutableAutomatonAdds transitions from thesourcestate undervaluations.- Specified by:
addEdgein interfaceMutableAutomaton<S,A extends EmersonLeiAcceptance>- 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, BddSet 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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- 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 EmersonLeiAcceptance>- 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)
-
factory
public BddSetFactory 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 EmersonLeiAcceptance>- Returns:
- The symbolic engine used to generate BddSets.
-
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 EmersonLeiAcceptance>
-
create
public static <S,A extends EmersonLeiAcceptance> HashMapAutomaton<S,A> create(List<String> atomicPropositions, A acceptance)
Creates an empty automaton with given acceptance condition.- Type Parameters:
S- The states of the automaton.A- The acceptance condition of the automaton.- Returns:
- Empty automaton with the specified parameters.
-
create
public static <S,A extends EmersonLeiAcceptance> HashMapAutomaton<S,A> create(List<String> atomicPropositions, BddSetFactory vsFactory, A acceptance)
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.
-
copyOf
public static <S,A extends EmersonLeiAcceptance> HashMapAutomaton<S,A> copyOf(Automaton<S,A> source)
-
edges
public Set<Edge<S>> edges(S state, BitSet valuation)
Description copied from interface:AutomatonReturns the successor edges of the specifiedstateunder the givenvaluation.- Specified by:
edgesin interfaceAutomaton<S,A extends EmersonLeiAcceptance>- Parameters:
state- The starting state of the transition.valuation- The valuation.- Returns:
- The successor edges, possibly empty.
-
-