public final class WordFactory extends java.lang.Object implements MonoidFactory<Word>
| Modifier and Type | Class and Description |
|---|---|
static class |
WordFactory.WordComparator
Comparator for Words.
|
| Modifier and Type | Field and Description |
|---|---|
Word |
ONE
The empty word for this monoid.
|
java.lang.String[] |
translation
The translation array of Strings.
|
static java.lang.String |
transRef
The translation reference string.
|
| Constructor and Description |
|---|
WordFactory()
Constructor for WordFactory.
|
WordFactory(java.lang.String s)
Constructor for WordFactory.
|
WordFactory(java.lang.String[] S)
Constructor for WordFactory.
|
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
clean(java.lang.String s)
Prepare parse from String.
|
static java.lang.String[] |
cleanAll(java.lang.String[] v)
Prepare parse from String array.
|
static java.lang.String |
cleanSpace(java.lang.String s)
Prepare parse from String.
|
static java.lang.String |
concat(java.lang.String[] v)
Concat variable names.
|
Word |
contract(Word w)
Contract word to this word factory.
|
Word |
copy(Word w)
Copy word.
|
boolean |
equals(java.lang.Object B)
Comparison with any other object.
|
WordFactory |
extend(java.lang.String[] vn)
Extend variables.
|
Word |
fromInteger(java.math.BigInteger a)
Get the Element for a.
|
Word |
fromInteger(long a)
Get the Element for a.
|
java.util.List<Word> |
generators()
Get a list of the generating elements.
|
WordFactory.WordComparator |
getAscendComparator()
Get the ascending order comparator.
|
WordFactory.WordComparator |
getDescendComparator()
Get the descending order comparator.
|
Word |
getONE()
Get the one element, the empty word.
|
char |
getVal(int i)
Get the alphabet letter at position i.
|
java.lang.String[] |
getVars()
Get the variable names.
|
int |
hashCode()
hashCode.
|
int |
indexOf(char s)
IndexOf for letter in alphabet.
|
static int |
indexOf(java.lang.String[] v,
java.lang.String s)
IndexOf for String array.
|
boolean |
isAssociative()
Query if this monoid is associative.
|
boolean |
isCommutative()
Query if this monoid is commutative.
|
boolean |
isFinite()
Is this structure finite or infinite.
|
static boolean |
isSingleLetters(java.lang.String[] v)
Test if all variables are single letters.
|
boolean |
isSubFactory(WordFactory w)
Test if the alphabet of w is a subalphabet of this.
|
int |
length()
Get the alphabet length.
|
Word |
parse(java.io.Reader r)
Parse from Reader.
|
Word |
parse(java.lang.String s)
Parse from String.
|
Word |
random(int n)
Generate a random Element with size less equal to n.
|
Word |
random(int n,
java.util.Random random)
Generate a random Element with size less equal to n.
|
java.lang.String |
toScript()
Get a scripting compatible string representation.
|
java.lang.String |
toString()
Get the string representation.
|
java.lang.String |
translate(java.lang.String[] v)
Translate variable names.
|
java.lang.String |
transVar(char c)
Translate variable name.
|
static java.lang.String[] |
trimAll(java.lang.String[] v)
Trim all variable names.
|
Word |
valueOf(ExpVector e)
Get the Element for an ExpVector.
|
Word |
valueOf(Word w)
Get the element from an other word.
|
public static final java.lang.String transRef
public final java.lang.String[] translation
public WordFactory()
public WordFactory(java.lang.String s)
s - String of single letters for alphabetpublic WordFactory(java.lang.String[] S)
S - String array for alphabetpublic boolean isFinite()
isFinite in interface ElemFactory<Word>ElemFactory.isFinite()public boolean isCommutative()
isCommutative in interface MonoidFactory<Word>public boolean isAssociative()
isAssociative in interface MonoidFactory<Word>public Word getONE()
getONE in interface MonoidFactory<Word>public Word copy(Word w)
copy in interface ElemFactory<Word>w - word to copy.public int length()
public char getVal(int i)
i - position.public java.lang.String[] getVars()
public WordFactory extend(java.lang.String[] vn)
vn - names for extended variables.public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public java.lang.String toScript()
toScript in interface ElemFactory<Word>Element.toScript()public boolean equals(java.lang.Object B)
equals in class java.lang.ObjectObject.equals(java.lang.Object)public int hashCode()
hashCode in class java.lang.ObjectObject.hashCode()public java.util.List<Word> generators()
generators in interface ElemFactory<Word>public Word fromInteger(long a)
fromInteger in interface ElemFactory<Word>a - longpublic Word fromInteger(java.math.BigInteger a)
fromInteger in interface ElemFactory<Word>a - java.math.BigInteger.public Word valueOf(ExpVector e)
e - ExpVector.public Word valueOf(Word w)
w - other word.public int indexOf(char s)
s - letter character.public Word random(int n)
random in interface ElemFactory<Word>n - public Word random(int n, java.util.Random random)
random in interface ElemFactory<Word>n - random - is a source for random bits.public Word parse(java.lang.String s)
parse in interface ElemFactory<Word>s - String.public Word parse(java.io.Reader r)
parse in interface ElemFactory<Word>r - Reader.public boolean isSubFactory(WordFactory w)
w - other word factory to test.public Word contract(Word w)
this.isSubFactory(w.mono) must be true, otherwise null is returned.w - other word to contract.public WordFactory.WordComparator getDescendComparator()
public WordFactory.WordComparator getAscendComparator()
public static java.lang.String cleanSpace(java.lang.String s)
s - String.public static java.lang.String clean(java.lang.String s)
s - String.public static java.lang.String[] cleanAll(java.lang.String[] v)
v - String array.public static java.lang.String concat(java.lang.String[] v)
v - an array of strings.public static java.lang.String[] trimAll(java.lang.String[] v)
v - an array of strings.public static int indexOf(java.lang.String[] v, java.lang.String s)
v - an array of strings.s - string.public static boolean isSingleLetters(java.lang.String[] v)
v - an array of strings.public java.lang.String translate(java.lang.String[] v)
v - an array of strings.public java.lang.String transVar(char c)
c - internal char.