Package edu.jas.poly
Class Word
java.lang.Object
edu.jas.poly.Word
- All Implemented Interfaces:
Element<Word>
,MonoidElem<Word>
,Serializable
,Comparable<Word>
Word implements strings of letters for polynomials.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Stored hash code.final WordFactory
Defining alphabet in WordFactory.(package private) final String
The data structure is a String of characters. -
Constructor Summary
ConstructorsConstructorDescriptionWord
(WordFactory m) Constructor for Word.Word
(WordFactory m, String s) Constructor for Word.Word
(WordFactory m, String s, boolean translate) Constructor for Word. -
Method Summary
Modifier and TypeMethodDescriptionint
Word compareTo.copy()
Copy this.long
degree()
Word degree.Word dependency on letters.Word divide.divideLeft
(Word V) Word divide left.divideRight
(Word V) Word divide right.boolean
Word divides test.Word[]
divideWord
(Word V) Word divide with prefix and suffix.Word[]
divideWord
(Word V, boolean first) Word divide with prefix and suffix.boolean
Comparison with any other object.factory()
Get the corresponding element factory.(package private) String
getVal()
Get the word String.char
getVal
(int i) Get the letter at position i.int
Word graded comparison.int
Word graded comparison.int
hashCode()
hashCode.String dependency on letters.inverse()
Word inverse.boolean
isONE()
Is Word one.boolean
Is word overlap.boolean
isUnit()
Is Word unit.Word pseudo least common multiple.Word leading exponent vector.int
length()
Get the length of this word.boolean
multipleOf
(Word V) Word multiple test.Word multiplication.Word overlap list.Word[]
Quotient and remainder by division of this by S.reductum()
Word without leading exponent vector.Word remainder.int
signum()
Word signum.toScript()
Get a scripting compatible string representation.Get a scripting compatible string representation of the factory.toString()
Get the string representation.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface edu.jas.structure.MonoidElem
leftDivide, leftRemainder, power, rightDivide, rightRemainder, twosidedDivide, twosidedRemainder
-
Field Details
-
mono
Defining alphabet in WordFactory. -
val
The data structure is a String of characters. -
hash
protected int hashStored hash code.
-
-
Constructor Details
-
Word
Constructor for Word.- Parameters:
m
- factory for words.
-
Word
Constructor for Word.- Parameters:
m
- factory for words.s
- String
-
Word
Constructor for Word.- Parameters:
m
- factory for words.s
- Stringtranslate
- indicator if s needs translation
-
-
Method Details
-
factory
Get the corresponding element factory. -
copy
Copy this. -
getVal
String getVal()Get the word String.- Returns:
- val.
-
getVal
public char getVal(int i) Get the letter at position i.- Parameters:
i
- position.- Returns:
- val[i].
-
length
public int length()Get the length of this word.- Returns:
- val.length.
-
toString
Get the string representation. -
toScript
Get a scripting compatible string representation. -
toScriptFactory
Get a scripting compatible string representation of the factory.- Specified by:
toScriptFactory
in interfaceElement<Word>
- Returns:
- script compatible representation for this ElemFactory.
- See Also:
-
equals
Comparison with any other object. -
hashCode
public int hashCode()hashCode. -
isONE
public boolean isONE()Is Word one.- Specified by:
isONE
in interfaceMonoidElem<Word>
- Returns:
- If this is the empty word then true is returned, else false.
-
isUnit
public boolean isUnit()Is Word unit.- Specified by:
isUnit
in interfaceMonoidElem<Word>
- Returns:
- If this is a unit then true is returned, else false.
-
multiply
Word multiplication.- Specified by:
multiply
in interfaceMonoidElem<Word>
- Parameters:
V
- other word.- Returns:
- this * V.
-
divide
Word divide.- Specified by:
divide
in interfaceMonoidElem<Word>
- Parameters:
V
- other word.- Returns:
- this / V.
-
divideLeft
Word divide left.- Parameters:
V
- other word.- Returns:
- this / V = left, with left * V = this.
-
divideRight
Word divide right.- Parameters:
V
- other word.- Returns:
- this / V = right, with V * right = this.
-
divideWord
Word divide with prefix and suffix.- Parameters:
V
- other word.- Returns:
- [left,right] with left * V * right = this.
-
divideWord
Word divide with prefix and suffix.- Parameters:
V
- other word.first
- is true for first index, false for last index.- Returns:
- [left,right] with left * V * right = this.
-
remainder
Word remainder.- Specified by:
remainder
in interfaceMonoidElem<Word>
- Parameters:
V
- other word.- Returns:
- this - (this/V). Note: not useful.
-
quotientRemainder
Quotient and remainder by division of this by S.- Specified by:
quotientRemainder
in interfaceMonoidElem<Word>
- Parameters:
S
- a Word- Returns:
- [this/S, this - (this/S)*S]. Note: not useful.
-
inverse
Word inverse.- Specified by:
inverse
in interfaceMonoidElem<Word>
- Returns:
- 1 / this.
-
signum
public int signum()Word signum.- Returns:
- 0 if this is one, 1 if it is non empty.
-
degree
public long degree()Word degree.- Returns:
- total degree of all letters.
-
dependencyOnVariables
Word dependency on letters.- Returns:
- sorted map of letters and the number of its occurrences.
-
histogram
String dependency on letters.- Parameters:
v
- string.- Returns:
- sorted map of letters and the number of its occurrences.
-
leadingExpVector
Word leading exponent vector.- Returns:
- an ExpVector for the first power of a letter.
-
reductum
Word without leading exponent vector.- Returns:
- an Word without the first power of a letter.
-
multipleOf
Word multiple test.- Parameters:
V
- other word.- Returns:
- true if this is a multiple of V, else false.
-
divides
Word divides test.- Parameters:
V
- other word.- Returns:
- true if this divides V, else false.
-
compareTo
Word compareTo. UsesString.compareTo
. -
gradCompareTo
Word graded comparison. Compares first be degree, then lexicographical.- Parameters:
V
- other word.- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
gradInvlexCompareTo
Word graded comparison. Compares first be degree, then inverse lexicographical.- Parameters:
V
- other word.- Returns:
- 0 if U == V, -1 if U < V, 1 if U > V.
-
isOverlap
Is word overlap.- Parameters:
ol
- = [l1,r1,l2,r2] an Overlap container of four wordsV
- word- Returns:
- true if l1 * this * r1 = l2 * V * r2, else false.
-
overlap
Word overlap list.- Parameters:
V
- other word.- Returns:
- list of overlaps [l1,r1,l2,r2] with l1 * this * r1 = l2 * V * r2. If no such overlaps exist the empty overlap list is returned.
-
lcm
Word pseudo least common multiple.- Parameters:
V
- other word.- Returns:
- w = l1*this*r1, with l1*this*r1 == l2*V*r2, if l1, r1, l2, r2 exist, else null is returned.
-