Package org.oristool.math.expression
Class MonomialTerm
java.lang.Object
org.oristool.math.expression.MonomialTerm
- All Implemented Interfaces:
AtomicTerm
An atomic term of the form
x^alpha
.-
Constructor Summary
ConstructorDescriptionMonomialTerm
(Variable variable, int alpha) Builds an instance for a given variable and exponent. -
Method Summary
Modifier and TypeMethodDescriptionDuplicates an atomic term.boolean
evaluate
(OmegaBigDecimal value) Evaluates the atomic term substituting value to its variable.getAlpha()
Returns the variable associated with the atomic term.int
hashCode()
boolean
isOne()
Checks if this term the constant 1.void
multiply
(AtomicTerm term) Multiplies with another term.void
setAlpha
(int alpha) void
setVariable
(Variable variable) void
substitute
(Variable oldVar, Variable newVar) Substitutes oldVar with newVar in the atomic term.toString()
-
Constructor Details
-
MonomialTerm
Builds an instance for a given variable and exponent.- Parameters:
variable
- variable of the monomial termalpha
- exponent
-
-
Method Details
-
getVariable
Description copied from interface:AtomicTerm
Returns the variable associated with the atomic term.- Specified by:
getVariable
in interfaceAtomicTerm
- Returns:
- the associated variable
-
setVariable
-
getAlpha
-
setAlpha
public void setAlpha(int alpha) -
multiply
Description copied from interface:AtomicTerm
Multiplies with another term.- Specified by:
multiply
in interfaceAtomicTerm
- Parameters:
term
- to be multiplied
-
equals
-
hashCode
public int hashCode() -
duplicate
Description copied from interface:AtomicTerm
Duplicates an atomic term.- Specified by:
duplicate
in interfaceAtomicTerm
- Returns:
- a copy of this term
-
evaluate
Description copied from interface:AtomicTerm
Evaluates the atomic term substituting value to its variable.- Specified by:
evaluate
in interfaceAtomicTerm
- Parameters:
value
- the value to be substituted tox
- Returns:
- the result of the evaluation
-
substitute
Description copied from interface:AtomicTerm
Substitutes oldVar with newVar in the atomic term.- Specified by:
substitute
in interfaceAtomicTerm
- Parameters:
oldVar
- variable to be substitutednewVar
- new variable
-
isOne
public boolean isOne()Description copied from interface:AtomicTerm
Checks if this term the constant 1.- Specified by:
isOne
in interfaceAtomicTerm
- Returns:
- true if the term is one, false otherwise
-
toString
-