|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
V
- the variable type.public interface MathExpr<V>
This interface is used to represent mathematical expressions.
A mathematical expression contains a numerical constant and a set of variables to which numerical values may be assigned. This interface captures these basic facts about mathematical expressions.
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Indicates if the provided object is equal to this mathematical expression. |
double |
getConstant()
Returns the numerical constant of this mathematical expression. |
java.util.Set<V> |
getVariables()
Returns the set of variables contained in this mathematical expression. |
boolean |
hasAllVariables(java.util.Collection<?> variables)
Indicates if this mathematical expression contains all of the variables in the provided collection. |
int |
hashCode()
Returns a content-based hash code for this mathematical expression. |
boolean |
hasVariable(java.lang.Object variable)
Indicates if the provided object is a variable contained in this mathematical expression. |
boolean |
hasVariables()
Indicates if this mathematical expression contains any variables. |
MathExpr<V> |
plugInNumbers(java.util.Map<?,java.lang.Double> variableValues)
Plugs in the provided numerical values to produce a new mathematical expression. |
java.lang.String |
toString()
Returns an appropriate string representation of this mathematical expression. |
int |
variables()
Returns the number of variables in this mathematical expression. |
Method Detail |
---|
double getConstant()
MathExpr<V> plugInNumbers(java.util.Map<?,java.lang.Double> variableValues)
If some of the keys in the provided map are not variables in this expression, their provided value is simply ignored. If a value is provided for each variable in this mathematical expression, the resulting expression will not contain any variables of its own, only a constant.
variableValues
- objects mapped to numerical values.
java.util.Set<V> getVariables()
int variables()
boolean hasVariable(java.lang.Object variable)
variable
- the variable whose presence in this
mathematical expression is to be tested.
true
if this expression contains the
provided variable; false
otherwise.boolean hasVariables()
true
if this expression contains at least
one variable; false
otherwise.boolean hasAllVariables(java.util.Collection<?> variables)
variables
- the collection of variables whose
presence in this expression is to be tested.
true
if each element of the provided
collection is a variable in this expression;
false
otherwise.int hashCode()
hashCode
in class java.lang.Object
boolean equals(java.lang.Object obj)
At minimum, for two expressions to be considered equal, they must both contain the same variables and constant. A stricter definition of equality is left to the extenders and implementors of this interface.
equals
in class java.lang.Object
obj
- the object to be tested for equality with
this mathematical expression.
true
if this mathematical expression 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 |