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
ConstructorsConstructorDescriptionMonomialTerm(Variable variable, int alpha) Builds an instance for a given variable and exponent. -
Method Summary
Modifier and TypeMethodDescriptionDuplicates an atomic term.booleanevaluate(OmegaBigDecimal value) Evaluates the atomic term substituting value to its variable.getAlpha()Returns the variable associated with the atomic term.inthashCode()booleanisOne()Checks if this term the constant 1.voidmultiply(AtomicTerm term) Multiplies with another term.voidsetAlpha(int alpha) voidsetVariable(Variable variable) voidsubstitute(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:AtomicTermReturns the variable associated with the atomic term.- Specified by:
getVariablein interfaceAtomicTerm- Returns:
- the associated variable
-
setVariable
-
getAlpha
-
setAlpha
public void setAlpha(int alpha) -
multiply
Description copied from interface:AtomicTermMultiplies with another term.- Specified by:
multiplyin interfaceAtomicTerm- Parameters:
term- to be multiplied
-
equals
-
hashCode
public int hashCode() -
duplicate
Description copied from interface:AtomicTermDuplicates an atomic term.- Specified by:
duplicatein interfaceAtomicTerm- Returns:
- a copy of this term
-
evaluate
Description copied from interface:AtomicTermEvaluates the atomic term substituting value to its variable.- Specified by:
evaluatein interfaceAtomicTerm- Parameters:
value- the value to be substituted tox- Returns:
- the result of the evaluation
-
substitute
Description copied from interface:AtomicTermSubstitutes oldVar with newVar in the atomic term.- Specified by:
substitutein interfaceAtomicTerm- Parameters:
oldVar- variable to be substitutednewVar- new variable
-
isOne
public boolean isOne()Description copied from interface:AtomicTermChecks if this term the constant 1.- Specified by:
isOnein interfaceAtomicTerm- Returns:
- true if the term is one, false otherwise
-
toString
-