public class Alphabet
extends java.lang.Object
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
, is also forbidden.)
Modifier and Type | Field and Description |
---|---|
java.util.Set<java.lang.Character> |
symbols
Set of
Character objects. |
Constructor and Description |
---|
Alphabet(char min,
char max)
Constructs an alphabet consisting of the symbols in the given Unicode character interval.
|
Alphabet(java.lang.String symbols)
Constructs an alphabet consisting of the given symbols.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.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.
|
public Alphabet(char min, char max) throws java.lang.IllegalArgumentException
min
- begin charactermax
- end character (included)java.lang.IllegalArgumentException
- if min>maxpublic Alphabet(java.lang.String symbols) throws java.lang.IllegalArgumentException
symbols
- non-empty string of symbolsjava.lang.IllegalArgumentException
- if symbols is emptypublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int getNumberOfSymbols()
public int hashCode()
equals(Object)
is implemented, hashCode must also be there.)hashCode
in class java.lang.Object
Copyright © 2003-2015 Anders Møller.