Package net.automatalib.alphabet
Class GrowingVPAlphabet<I>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<I>
-
- net.automatalib.alphabet.AbstractAlphabet<I>
-
- net.automatalib.alphabet.AbstractVPAlphabet<VPSym<I>>
-
- net.automatalib.alphabet.GrowingVPAlphabet<I>
-
- Type Parameters:
I
- input symbol type
- All Implemented Interfaces:
Iterable<VPSym<I>>
,Collection<VPSym<I>>
,Comparator<VPSym<I>>
,IntFunction<VPSym<I>>
,ToIntFunction<VPSym<I>>
,List<VPSym<I>>
,Alphabet<VPSym<I>>
,VPAlphabet<VPSym<I>>
,ArrayWritable<VPSym<I>>
public class GrowingVPAlphabet<I> extends AbstractVPAlphabet<VPSym<I>> implements VPAlphabet<VPSym<I>>
AVPAlphabet
implementation that allows to add new symbols after its construction. Wraps input symbols in aVPSym
instance to allow faster mappings from symbols to indexes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.automatalib.alphabet.VPAlphabet
VPAlphabet.SymbolType
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description GrowingVPAlphabet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VPSym<I>
addNewSymbol(I userObject, VPAlphabet.SymbolType type)
boolean
containsSymbol(VPSym<I> symbol)
Checks whether the given symbol is part of the alphabet.VPSym<I>
getSymbol(int index)
Returns the symbol with the given index in this alphabet.int
getSymbolIndex(VPSym<I> symbol)
Returns the index of the given symbol in the alphabet.VPAlphabet.SymbolType
getSymbolType(VPSym<I> symbol)
Returns thesymbol type
of the given alphabet symbol.int
size()
The size of this container.-
Methods inherited from class net.automatalib.alphabet.AbstractVPAlphabet
getCallAlphabet, getCallSymbol, getCallSymbolIndex, getInternalAlphabet, getInternalSymbol, getInternalSymbolIndex, getNumCalls, getNumInternals, getNumReturns, getReturnAlphabet, getReturnSymbol, getReturnSymbolIndex, isCallSymbol, isInternalSymbol, isReturnSymbol
-
Methods inherited from class net.automatalib.alphabet.AbstractAlphabet
get, reversed
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.automatalib.alphabet.Alphabet
apply, applyAsInt, compare, translateFrom, writeToArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
Methods inherited from interface net.automatalib.alphabet.VPAlphabet
callReturnBalance, getCallAlphabet, getCallSymbol, getCallSymbolIndex, getInternalAlphabet, getInternalSymbol, getInternalSymbolIndex, getNumCalls, getNumInternals, getNumReturns, getReturnAlphabet, getReturnSymbol, getReturnSymbolIndex, isCallMatched, isCallSymbol, isInternalSymbol, isReturnMatched, isReturnSymbol, isWellMatched, longestWellMatchedPrefix, longestWellMatchedSuffix
-
-
-
-
Method Detail
-
addNewSymbol
public VPSym<I> addNewSymbol(I userObject, VPAlphabet.SymbolType type)
-
getSymbolType
public VPAlphabet.SymbolType getSymbolType(VPSym<I> symbol)
Description copied from interface:VPAlphabet
Returns thesymbol type
of the given alphabet symbol.- Specified by:
getSymbolType
in interfaceVPAlphabet<I>
- Overrides:
getSymbolType
in classAbstractVPAlphabet<VPSym<I>>
- Parameters:
symbol
- the symbol whose type should be returned- Returns:
- the
symbol type
of the given alphabet symbol.
-
size
public int size()
Description copied from interface:ArrayWritable
The size of this container.- Specified by:
size
in interfaceArrayWritable<I>
- Specified by:
size
in interfaceCollection<I>
- Specified by:
size
in interfaceList<I>
- Overrides:
size
in classAbstractVPAlphabet<VPSym<I>>
-
getSymbol
public VPSym<I> getSymbol(int index)
Description copied from interface:Alphabet
Returns the symbol with the given index in this alphabet.
-
getSymbolIndex
public int getSymbolIndex(VPSym<I> symbol)
Description copied from interface:Alphabet
Returns the index of the given symbol in the alphabet.- Specified by:
getSymbolIndex
in interfaceAlphabet<I>
- Overrides:
getSymbolIndex
in classAbstractVPAlphabet<VPSym<I>>
- Parameters:
symbol
- the symbol whose index should be determined- Returns:
- the index of the given symbol
-
containsSymbol
public boolean containsSymbol(VPSym<I> symbol)
Description copied from interface:Alphabet
Checks whether the given symbol is part of the alphabet.Caution: the default implementation is rather inefficient and should be overridden, if possible.
- Specified by:
containsSymbol
in interfaceAlphabet<I>
- Overrides:
containsSymbol
in classAbstractVPAlphabet<VPSym<I>>
- Parameters:
symbol
- the symbol to check- Returns:
true
iff the symbol is part of the alphabet
-
-