Package net.automatalib.alphabet
Class AbstractVPAlphabet<I>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<I>
-
- net.automatalib.alphabet.AbstractAlphabet<I>
-
- net.automatalib.alphabet.AbstractVPAlphabet<I>
-
- All Implemented Interfaces:
Iterable<I>
,Collection<I>
,Comparator<I>
,IntFunction<I>
,ToIntFunction<I>
,List<I>
,Alphabet<I>
,VPAlphabet<I>
,ArrayWritable<I>
- Direct Known Subclasses:
DefaultVPAlphabet
,GrowingVPAlphabet
public abstract class AbstractVPAlphabet<I> extends AbstractAlphabet<I> implements VPAlphabet<I>
Abstract utility class that implements functionality shared across different subtypes.
-
-
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
containsSymbol(I symbol)
Checks whether the given symbol is part of the alphabet.Alphabet<I>
getCallAlphabet()
Returns the call symbols ofthis
alphabet as a (sub-) alphabet.I
getCallSymbol(int index)
TheAlphabet.getSymbol(int)
variant for the call alphabet.int
getCallSymbolIndex(I symbol)
TheAlphabet.getSymbolIndex(Object)
variant for the call alphabet.Alphabet<I>
getInternalAlphabet()
Returns the internal symbols ofthis
alphabet as a (sub-) alphabet.I
getInternalSymbol(int index)
TheAlphabet.getSymbol(int)
variant for the internal alphabet.int
getInternalSymbolIndex(I symbol)
TheAlphabet.getSymbolIndex(Object)
variant for the internal alphabet.int
getNumCalls()
TheArrayWritable.size()
variant for the call alphabet.int
getNumInternals()
TheArrayWritable.size()
variant for the internal alphabet.int
getNumReturns()
TheArrayWritable.size()
variant for the return alphabet.Alphabet<I>
getReturnAlphabet()
Returns the return symbols ofthis
alphabet as a (sub-) alphabet.I
getReturnSymbol(int index)
TheAlphabet.getSymbol(int)
variant for the return alphabet.int
getReturnSymbolIndex(I symbol)
TheAlphabet.getSymbolIndex(Object)
variant for the return alphabet.I
getSymbol(int index)
Returns the symbol with the given index in this alphabet.int
getSymbolIndex(I symbol)
Returns the index of the given symbol in the alphabet.VPAlphabet.SymbolType
getSymbolType(I symbol)
Returns thesymbol type
of the given alphabet symbol.boolean
isCallSymbol(I symbol)
Returns whether the given symbol is a call symbol ofthis
alphabet.boolean
isInternalSymbol(I symbol)
Returns whether the given symbol is an internal symbol ofthis
alphabet.boolean
isReturnSymbol(I symbol)
Returns whether the given symbol is a return symbol ofthis
alphabet.int
size()
The size of this container.-
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, isCallMatched, isReturnMatched, isWellMatched, longestWellMatchedPrefix, longestWellMatchedSuffix
-
-
-
-
Method Detail
-
getCallAlphabet
public Alphabet<I> getCallAlphabet()
Description copied from interface:VPAlphabet
Returns the call symbols ofthis
alphabet as a (sub-) alphabet.- Specified by:
getCallAlphabet
in interfaceVPAlphabet<I>
- Returns:
- the call symbols of
this
alphabet
-
getCallSymbol
public I getCallSymbol(int index)
Description copied from interface:VPAlphabet
TheAlphabet.getSymbol(int)
variant for the call alphabet. Note that the index must be relative to thecall alphabet
and not tothis
alphabet.- Specified by:
getCallSymbol
in interfaceVPAlphabet<I>
- Parameters:
index
- the index of the symbol- Returns:
- the call symbol at the given index
-
getCallSymbolIndex
public int getCallSymbolIndex(I symbol)
Description copied from interface:VPAlphabet
TheAlphabet.getSymbolIndex(Object)
variant for the call alphabet. Note that the index is relative to thecall alphabet
and not tothis
alphabet.- Specified by:
getCallSymbolIndex
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol whose index should be determined- Returns:
- the index of the given call symbol
-
getNumCalls
public int getNumCalls()
Description copied from interface:VPAlphabet
TheArrayWritable.size()
variant for the call alphabet.- Specified by:
getNumCalls
in interfaceVPAlphabet<I>
- Returns:
- the number of call symbols
-
getInternalAlphabet
public Alphabet<I> getInternalAlphabet()
Description copied from interface:VPAlphabet
Returns the internal symbols ofthis
alphabet as a (sub-) alphabet.- Specified by:
getInternalAlphabet
in interfaceVPAlphabet<I>
- Returns:
- the internal symbols of
this
alphabet
-
getInternalSymbol
public I getInternalSymbol(int index)
Description copied from interface:VPAlphabet
TheAlphabet.getSymbol(int)
variant for the internal alphabet. Note that the index must be relative to theinternal alphabet
and not tothis
alphabet.- Specified by:
getInternalSymbol
in interfaceVPAlphabet<I>
- Parameters:
index
- the index of the symbol- Returns:
- the internal symbol at the given index
-
getInternalSymbolIndex
public int getInternalSymbolIndex(I symbol)
Description copied from interface:VPAlphabet
TheAlphabet.getSymbolIndex(Object)
variant for the internal alphabet. Note that the index is relative to theinternal alphabet
and not tothis
alphabet.- Specified by:
getInternalSymbolIndex
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol whose index should be determined- Returns:
- the index of the given internal symbol
-
getNumInternals
public int getNumInternals()
Description copied from interface:VPAlphabet
TheArrayWritable.size()
variant for the internal alphabet.- Specified by:
getNumInternals
in interfaceVPAlphabet<I>
- Returns:
- the number of internal symbols
-
getReturnAlphabet
public Alphabet<I> getReturnAlphabet()
Description copied from interface:VPAlphabet
Returns the return symbols ofthis
alphabet as a (sub-) alphabet.- Specified by:
getReturnAlphabet
in interfaceVPAlphabet<I>
- Returns:
- the return symbols of
this
alphabet
-
getReturnSymbol
public I getReturnSymbol(int index)
Description copied from interface:VPAlphabet
TheAlphabet.getSymbol(int)
variant for the return alphabet. Note that the index must be relative to thereturn alphabet
and not tothis
alphabet.- Specified by:
getReturnSymbol
in interfaceVPAlphabet<I>
- Parameters:
index
- the index of the symbol- Returns:
- the return symbol at the given index
-
getReturnSymbolIndex
public int getReturnSymbolIndex(I symbol)
Description copied from interface:VPAlphabet
TheAlphabet.getSymbolIndex(Object)
variant for the return alphabet. Note that the index is relative to thereturn alphabet
and not tothis
alphabet.- Specified by:
getReturnSymbolIndex
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol whose index should be determined- Returns:
- the index of the given return symbol
-
getNumReturns
public int getNumReturns()
Description copied from interface:VPAlphabet
TheArrayWritable.size()
variant for the return alphabet.- Specified by:
getNumReturns
in interfaceVPAlphabet<I>
- Returns:
- the number of return symbols
-
getSymbolType
public VPAlphabet.SymbolType getSymbolType(I symbol)
Description copied from interface:VPAlphabet
Returns thesymbol type
of the given alphabet symbol.- Specified by:
getSymbolType
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol whose type should be returned- Returns:
- the
symbol type
of the given alphabet symbol.
-
isCallSymbol
public boolean isCallSymbol(I symbol)
Description copied from interface:VPAlphabet
Returns whether the given symbol is a call symbol ofthis
alphabet.- Specified by:
isCallSymbol
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol to analyze- Returns:
true
if the given symbol is a call symbol of this alphabet,false
otherwise
-
isInternalSymbol
public boolean isInternalSymbol(I symbol)
Description copied from interface:VPAlphabet
Returns whether the given symbol is an internal symbol ofthis
alphabet.- Specified by:
isInternalSymbol
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol to analyze- Returns:
true
if the given symbol is an internal symbol of this alphabet,false
otherwise
-
isReturnSymbol
public boolean isReturnSymbol(I symbol)
Description copied from interface:VPAlphabet
Returns whether the given symbol is a return symbol ofthis
alphabet.- Specified by:
isReturnSymbol
in interfaceVPAlphabet<I>
- Parameters:
symbol
- the symbol to analyze- Returns:
true
if the given symbol is a return symbol of this alphabet,false
otherwise
-
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>
- Specified by:
size
in classAbstractCollection<I>
-
getSymbol
public I getSymbol(int index)
Description copied from interface:Alphabet
Returns the symbol with the given index in this alphabet.
-
getSymbolIndex
public int getSymbolIndex(I symbol)
Description copied from interface:Alphabet
Returns the index of the given symbol in the alphabet.- Specified by:
getSymbolIndex
in interfaceAlphabet<I>
- Parameters:
symbol
- the symbol whose index should be determined- Returns:
- the index of the given symbol
-
containsSymbol
public boolean containsSymbol(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>
- Parameters:
symbol
- the symbol to check- Returns:
true
iff the symbol is part of the alphabet
-
-