de.fhdarmstadt.fbi.dtree.model
Interface Alphabet

All Known Implementing Classes:
MutableAlphabet, SimpleAlphabet

public interface Alphabet

An Alphabet is an set of symbols (characters in this case).

Alphabets describe the input data set for pattern matching algorithms. To be valid, an alphabet must have at least two elements and all elements within the same alphabet must be unique.


Method Summary
 boolean contains(java.lang.Character c)
          Checks, whether the given character is contained in this alphabet.
 Alphabet getImmutableInstance()
          Returns an immutable instance of this alphabet.
 java.util.Iterator getSymbols()
          Returns the symbols contained in this alphabet as iterator.
 boolean isEmpty()
          Checks, whether the alphabet is empty.
 boolean isValid(java.lang.String s)
          Tests, whether all characters of the given string are contained in this alphabet.
 java.lang.Character[] toArray()
          Returns the symbol set of this alphabet as Character-array.
 

Method Detail

contains

public boolean contains(java.lang.Character c)
Checks, whether the given character is contained in this alphabet.

Parameters:
c - the character, which should be tested.
Returns:
true, if the characters is a member of this alphabet, false otherwise.
Throws:
java.lang.NullPointerException - if the given character is null.

getSymbols

public java.util.Iterator getSymbols()
Returns the symbols contained in this alphabet as iterator. The iterator will return java.lang.Character objects. The returned result set is not guaranteed to be sorted.

Returns:
the symbols as iterator.

toArray

public java.lang.Character[] toArray()
Returns the symbol set of this alphabet as Character-array.

Returns:
the symbol set as character array.

isEmpty

public boolean isEmpty()
Checks, whether the alphabet is empty. An alphabet is considered empty, if the number of symbols within the alphabet is less or equal to one.

Returns:
true, if the alphabet is empty, false otherwise.

isValid

public boolean isValid(java.lang.String s)
Tests, whether all characters of the given string are contained in this alphabet.

Parameters:
s - the string, which should be tested
Returns:
true, if the string is valid within this alphabet, false otherwise

getImmutableInstance

public Alphabet getImmutableInstance()
Returns an immutable instance of this alphabet. The returned instance will no longer be affected by any operation on this alphabet.

Returns:
the immutable alphabet