Package de.learnlib.datastructure.pta
Class BasePTA<S extends AbstractBasePTAState<S,SP,TP>,SP,TP>
- java.lang.Object
-
- de.learnlib.datastructure.pta.BasePTA<S,SP,TP>
-
- Type Parameters:
S
- state typeSP
- state property typeTP
- transition property type
- All Implemented Interfaces:
Iterable<S>
,Automaton<S,Integer,PTATransition<S>>
,FiniteRepresentation
,InputAlphabetHolder<Integer>
,DeterministicAutomaton<S,Integer,PTATransition<S>>
,FiniteAlphabetAutomaton<S,Integer,PTATransition<S>>
,SimpleAutomaton<S,Integer>
,SimpleDeterministicAutomaton<S,Integer>
,UniversalAutomaton<S,Integer,PTATransition<S>,SP,TP>
,UniversalDeterministicAutomaton<S,Integer,PTATransition<S>,SP,TP>
,GraphViewable
,DeterministicTransitionSystem<S,Integer,PTATransition<S>>
,SimpleDTS<S,Integer>
,SimpleTS<S,Integer>
,TransitionSystem<S,Integer,PTATransition<S>>
,UniversalDTS<S,Integer,PTATransition<S>,SP,TP>
,UniversalTransitionSystem<S,Integer,PTATransition<S>,SP,TP>
- Direct Known Subclasses:
AbstractBlueFringePTA
public class BasePTA<S extends AbstractBasePTAState<S,SP,TP>,SP,TP> extends Object implements UniversalDeterministicAutomaton<S,Integer,PTATransition<S>,SP,TP>, FiniteAlphabetAutomaton<S,Integer,PTATransition<S>>
Base class for prefix tree acceptors.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.automatalib.automaton.UniversalDeterministicAutomaton
UniversalDeterministicAutomaton.FullIntAbstraction<T extends Object,SP extends Object,TP extends Object>, UniversalDeterministicAutomaton.IntAbstraction<T extends Object,SP extends Object,TP extends Object>, UniversalDeterministicAutomaton.StateIntAbstraction<I extends Object,T extends Object,SP extends Object,TP extends Object>
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSample(IntSeq sample, SP lastProperty)
Adds a sample to the PTA, and sets the property of the last reached (or inserted) state accordingly.void
addSampleWithStateProperties(IntSeq sample, List<? extends SP> lastStateProperties)
void
addSampleWithTransitionProperties(IntSeq sample, List<? extends TP> lastTransitionProperties)
S
getInitialState()
Alphabet<Integer>
getInputAlphabet()
S
getOrCreateState(IntSeq word)
Retrieves the state reached by the given word.S
getRoot()
Retrieves the root of the PTA.SP
getStateProperty(S state)
Collection<S>
getStates()
S
getSuccessor(PTATransition<S> transition)
@Nullable S
getSuccessor(S state, Integer input)
@Nullable PTATransition<S>
getTransition(S state, Integer input)
TP
getTransitionProperty(PTATransition<S> transition)
Iterator<S>
iterator()
UniversalGraph<S,TransitionEdge<Integer,PTATransition<S>>,SP,TransitionEdge.Property<Integer,TP>>
transitionGraphView(Collection<? extends Integer> inputs)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.automatalib.ts.DeterministicTransitionSystem
getSuccessors, getTransitions
-
Methods inherited from interface net.automatalib.automaton.FiniteAlphabetAutomaton
getTransitions, graphView, transitionGraphView
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.automatalib.automaton.simple.SimpleAutomaton
createDynamicStateMapping, createStaticStateMapping, size, stateIDs
-
Methods inherited from interface net.automatalib.ts.simple.SimpleDTS
getInitialStates, getState, getStates, getSuccessor, getSuccessors, getSuccessors
-
Methods inherited from interface net.automatalib.ts.simple.SimpleTS
getSuccessors
-
Methods inherited from interface net.automatalib.ts.TransitionSystem
powersetView
-
Methods inherited from interface net.automatalib.automaton.UniversalDeterministicAutomaton
fullIntAbstraction, fullIntAbstraction, stateIntAbstraction
-
Methods inherited from interface net.automatalib.ts.UniversalDTS
getTransitionProperty
-
-
-
-
Constructor Detail
-
BasePTA
public BasePTA(int alphabetSize, S root)
Constructor.- Parameters:
alphabetSize
- the size of the input alphabetroot
- the root state
-
-
Method Detail
-
getRoot
public S getRoot()
Retrieves the root of the PTA.- Returns:
- the root state
-
getInputAlphabet
public Alphabet<Integer> getInputAlphabet()
- Specified by:
getInputAlphabet
in interfaceInputAlphabetHolder<S extends AbstractBasePTAState<S,SP,TP>>
-
addSample
public void addSample(IntSeq sample, SP lastProperty)
Adds a sample to the PTA, and sets the property of the last reached (or inserted) state accordingly.- Parameters:
sample
- the word to add to the PTAlastProperty
- the property of the last state to set
-
getOrCreateState
public S getOrCreateState(IntSeq word)
Retrieves the state reached by the given word. If there is no path for the word in the PTA, it will be added to the PTA on-the-fly.- Parameters:
word
- the word- Returns:
- the state reached by this word, which might have been newly created (along with all required predecessor states)
-
addSampleWithStateProperties
public void addSampleWithStateProperties(IntSeq sample, List<? extends SP> lastStateProperties)
-
addSampleWithTransitionProperties
public void addSampleWithTransitionProperties(IntSeq sample, List<? extends TP> lastTransitionProperties)
-
getSuccessor
public S getSuccessor(PTATransition<S> transition)
- Specified by:
getSuccessor
in interfaceTransitionSystem<S extends AbstractBasePTAState<S,SP,TP>,SP,TP>
-
getSuccessor
public @Nullable S getSuccessor(S state, Integer input)
- Specified by:
getSuccessor
in interfaceDeterministicTransitionSystem<S extends AbstractBasePTAState<S,SP,TP>,SP,TP>
- Specified by:
getSuccessor
in interfaceSimpleDTS<S extends AbstractBasePTAState<S,SP,TP>,SP>
-
iterator
public Iterator<S> iterator()
- Specified by:
iterator
in interfaceIterable<S extends AbstractBasePTAState<S,SP,TP>>
- Specified by:
iterator
in interfaceSimpleAutomaton<S extends AbstractBasePTAState<S,SP,TP>,SP>
-
getStates
public Collection<S> getStates()
- Specified by:
getStates
in interfaceSimpleAutomaton<S extends AbstractBasePTAState<S,SP,TP>,SP>
-
getInitialState
public S getInitialState()
- Specified by:
getInitialState
in interfaceSimpleDTS<S extends AbstractBasePTAState<S,SP,TP>,SP>
-
getTransition
public @Nullable PTATransition<S> getTransition(S state, Integer input)
- Specified by:
getTransition
in interfaceDeterministicTransitionSystem<S extends AbstractBasePTAState<S,SP,TP>,SP,TP>
-
getStateProperty
public SP getStateProperty(S state)
- Specified by:
getStateProperty
in interfaceUniversalTransitionSystem<S extends AbstractBasePTAState<S,SP,TP>,Integer,PTATransition<S extends AbstractBasePTAState<S,SP,TP>>,SP,TP>
-
getTransitionProperty
public TP getTransitionProperty(PTATransition<S> transition)
- Specified by:
getTransitionProperty
in interfaceUniversalTransitionSystem<S extends AbstractBasePTAState<S,SP,TP>,Integer,PTATransition<S extends AbstractBasePTAState<S,SP,TP>>,SP,TP>
-
transitionGraphView
public UniversalGraph<S,TransitionEdge<Integer,PTATransition<S>>,SP,TransitionEdge.Property<Integer,TP>> transitionGraphView(Collection<? extends Integer> inputs)
- Specified by:
transitionGraphView
in interfaceAutomaton<S extends AbstractBasePTAState<S,SP,TP>,SP,TP>
- Specified by:
transitionGraphView
in interfaceUniversalAutomaton<S extends AbstractBasePTAState<S,SP,TP>,Integer,PTATransition<S extends AbstractBasePTAState<S,SP,TP>>,SP,TP>
-
-