|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
V
- the variable type.public static interface Polynomial.Term<V>
This interface is used to represent the terms of a polynomial. A term consists of a numerical coefficient and a set of variables, with each variable raised to a non-negative whole number power.
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Indicates if the provided object is equal to this term. |
double |
getCoefficient()
Returns the coefficient of this term. |
java.util.Set<V> |
getVariables()
Returns the set of variables contained in this term. |
boolean |
hasAllVariables(java.util.Collection<?> variables)
Indicates if this term contains all of the variables in the provided collection. |
int |
hashCode()
Returns a content-based hash code for this term. |
boolean |
hasVariable(java.lang.Object variable)
Indicates if the provided object is a variable contained in this term. |
java.util.Iterator<V> |
iterator()
Returns an iterator over the variables in this term. |
int |
power(java.lang.Object variable)
Returns the power of the provided variable in this term. |
java.lang.String |
toString()
Returns an appropriate string representation of this term. |
int |
variables()
Returns the number of variables contained in this term. |
Method Detail |
---|
double getCoefficient()
java.util.Iterator<V> iterator()
iterator
in interface java.lang.Iterable<V>
int power(java.lang.Object variable)
variable
- the variable whose power is to be
returned.
java.util.Set<V> getVariables()
int variables()
boolean hasVariable(java.lang.Object variable)
variable
- the variable whose presence in this
term is to be tested.
true
if this term contains the
provided variable; false
otherwise.boolean hasAllVariables(java.util.Collection<?> variables)
variables
- the collection of variables whose
presence in this term is to be tested.
true
if each element of the provided
collection is a variable in this term;
false
otherwise.int hashCode()
hashCode
in class java.lang.Object
boolean equals(java.lang.Object obj)
Two terms are considered equal if they 1) contain the same coefficient, 2) contain the same variables, and 3) the powers of each variable are the same in both terms.
equals
in class java.lang.Object
obj
- the object to be tested for equality with
this term.
true
if this term is equal to the provided object;
false
otherwise.java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |