public final class Term extends Object implements Serializable, Comparable<Term>, javolution.lang.ValueType, javolution.lang.Realtime
polynomial
such as x·y².| Modifier and Type | Field and Description |
|---|---|
static Term |
ONE
Holds the multiplicative identity.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Term that)
Compares this term with the one specified for order.
|
Term |
copy()
Returns an entierely new copy of this term
allocated
by the calling thread (possibly on the stack). |
Term |
divide(Term that)
Return the division of this term with the one specified.
|
boolean |
equals(Object obj)
Indicates if this term is equal to the object specified.
|
int |
getPower(int index)
Returns the power of the variable at the specified position.
|
int |
getPower(Variable<?> v)
Returns the power of the specified variable.
|
Variable<?> |
getVariable(int index)
Returns the variable at the specified index (variables are
lexically ordered).
|
int |
hashCode()
Returns a hash code for this term.
|
int |
size()
Returns the number of variables for this term.
|
Term |
times(Term that)
Return the product of this term with the one specified.
|
String |
toString()
Returns the text representation of this term as a
java.lang.String. |
javolution.text.Text |
toText()
Returns the text representation of this term.
|
static Term |
valueOf(Variable<?> v,
int n)
Return the term corresponding to the specified variable raised to
the specified power.
|
public static Term ONE
public static Term valueOf(Variable<?> v, int n)
v - the variable.n - the power.vnIllegalArgumentException - if n < 0public int size()
public Variable<?> getVariable(int index)
index - the variable index.IndexOutOfBoundsException - if
(index < 0) || (index >= size())public int getPower(int index)
index - the variable index.IndexOutOfBoundsException - if
(index < 0) || (index >= size())public int getPower(Variable<?> v)
v - the variable for which the power is returned.0 if
this term does not hold the specified variable.public Term times(Term that)
that - the term multiplier.this · thatIllegalArgumentException - if the specified term holds a
variable having the same symbol as one of the variable of
this term; but both variables are distinct.public Term divide(Term that)
that - the term divisor.this / thatUnsupportedOperationException - if this division would
result in negative power.IllegalArgumentException - if the specified term holds a
variable having the same symbol as one of the variable of
this term; but both variables are distinct.public boolean equals(Object obj)
public final int hashCode()
public final String toString()
java.lang.String.public javolution.text.Text toText()
toText in interface javolution.lang.Realtimepublic Term copy()
allocated
by the calling thread (possibly on the stack).copy in interface javolution.lang.ValueTypepublic int compareTo(Term that)
compareTo in interface Comparable<Term>that - the term to be compared to.