dRegAut
Class Alphabet

java.lang.Object
  extended by dRegAut.Alphabet

public class Alphabet
extends Object

Representation of an alphabet.

An alphabet is represented by a non-empty set of Character objects. For simplificy, alphabets should not contain the characters '#', '%', '+', '*', '(', or ')', which have special meaning in RegExp regular expresions. (The character \uFFFF, which we use for representation of Lambda, is also forbidden.)


Field Summary
 Set<Character> symbols
          Set of Character objects.
 
Constructor Summary
Alphabet(char min, char max)
          Constructs an alphabet consisting of the symbols in the given Unicode character interval.
Alphabet(String symbols)
          Constructs an alphabet consisting of the given symbols.
 
Method Summary
 boolean equals(Object obj)
          Checks whether the given alphabet is the same as this one.
 int getNumberOfSymbols()
          Returns number of symbols in this alphabet.
 int hashCode()
          Computes hash code for this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symbols

public Set<Character> symbols
Set of Character objects. The set should not be changed when the alphabet is being used in instances of RegExp, FA, or NFA.

Constructor Detail

Alphabet

public Alphabet(char min,
                char max)
         throws IllegalArgumentException
Constructs an alphabet consisting of the symbols in the given Unicode character interval.

Parameters:
min - begin character
max - end character (included)
Throws:
IllegalArgumentException - if min>max

Alphabet

public Alphabet(String symbols)
         throws IllegalArgumentException
Constructs an alphabet consisting of the given symbols.

Parameters:
symbols - non-empty string of symbols
Throws:
IllegalArgumentException - if symbols is empty
Method Detail

equals

public boolean equals(Object obj)
Checks whether the given alphabet is the same as this one.

Overrides:
equals in class Object

getNumberOfSymbols

public int getNumberOfSymbols()
Returns number of symbols in this alphabet.


hashCode

public int hashCode()
Computes hash code for this object. (When equals(Object) is implemented, hashCode must also be there.)

Overrides:
hashCode in class Object


Copyright © 2003-2011 Anders Møller.