Package net.automatalib.alphabet
Class Alphabets
- java.lang.Object
-
- net.automatalib.alphabet.Alphabets
-
public final class Alphabets extends Object
Utility methods concerning alphabets.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Alphabet<Character>characters(char startInclusive, char endInclusive)static Alphabet<String>closedCharStringRange(char startInclusive, char endInclusive)static <I> Collector<I,?,GrowingAlphabet<I>>collector()Returns aCollectorthat collects individual symbols (in order and without duplicates) and aggregates them in aGrowingAlphabet.static <T> Alphabet<T>fromArray(T... symbols)static <I> Alphabet<I>fromCollection(Collection<? extends I> coll)static <I> Alphabet<I>fromCollections(Collection<? extends I>... colls)static <E extends Enum<E>>
Alphabet<E>fromEnum(Class<E> enumClazz)static <E extends Enum<E>>
Alphabet<E>fromEnum(Class<E> enumClazz, boolean withNull)static <T> Alphabet<T>fromList(List<? extends T> list)static Alphabet<Integer>integers(int startInclusive, int endInclusive)static <T> Alphabet<T>singleton(T symbol)static <I> GrowingAlphabet<I>toGrowingAlphabetOrThrowException(Alphabet<I> alphabet)Casts the given alphabet to aGrowingAlphabetif possible (i.e. the given alphabet is actually an instance of aGrowingAlphabet).
-
-
-
Method Detail
-
fromArray
@SafeVarargs public static <T> Alphabet<T> fromArray(T... symbols)
-
fromEnum
public static <E extends Enum<E>> Alphabet<E> fromEnum(Class<E> enumClazz, boolean withNull)
-
closedCharStringRange
public static Alphabet<String> closedCharStringRange(char startInclusive, char endInclusive)
-
singleton
public static <T> Alphabet<T> singleton(T symbol)
-
fromCollection
public static <I> Alphabet<I> fromCollection(Collection<? extends I> coll)
-
fromCollections
@SafeVarargs public static <I> Alphabet<I> fromCollections(Collection<? extends I>... colls)
-
toGrowingAlphabetOrThrowException
public static <I> GrowingAlphabet<I> toGrowingAlphabetOrThrowException(Alphabet<I> alphabet)
Casts the given alphabet to aGrowingAlphabetif possible (i.e. the given alphabet is actually an instance of aGrowingAlphabet). Throws aGrowingAlphabetNotSupportedExceptionotherwise.- Type Parameters:
I- input symbol type- Parameters:
alphabet- the alphabet to cast- Returns:
- the same alphabet instance, cast to a
GrowingAlphabet. - Throws:
GrowingAlphabetNotSupportedException- if the given alphabet is not an instance ofGrowingAlphabet.
-
collector
public static <I> Collector<I,?,GrowingAlphabet<I>> collector()
Returns aCollectorthat collects individual symbols (in order and without duplicates) and aggregates them in aGrowingAlphabet.- Type Parameters:
I- input symbol type- Returns:
- a
Collectorthat collects individual symbols (in order and without duplicates) and aggregates them in aGrowingAlphabet
-
-