Class PConstant
java.lang.Object
com.singularsys.extensions.polynomials.AbstractPNode
com.singularsys.extensions.polynomials.PConstant
- All Implemented Interfaces:
PNodeI,Serializable,Comparable<PNodeI>
Represents a constant.
- Author:
- Rich Morris Created on 14-Dec-2004
- See Also:
-
Field Summary
Fields inherited from class com.singularsys.extensions.polynomials.AbstractPNode
pc -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the sum of this node and argumentintvoidconvertToPolyArray(String var, Map<Integer, PNodeI> polyArray) Internal method for extracting coefficientsDivides this by the argument.booleanequalsPNode(PNodeI node) True is nodes represent the same parse treesexpand()complete expansion. (1+x)^2 --> 1+2*x+x^2getValue()inthashCode()intintValue()invert()inverts node i.e. 1/xbooleanbooleanbooleanbooleanisNan()booleanbooleanisOne()True if node represents onebooleanbooleanisZero()True if node represents zeroMultiplies this by the argument.negate()negates node i.e.Raise this to the argument.Returns the difference between this node and argumentsubstitute(PVariable var, PNodeI sub) Substitute all occurrence of variable with its replacement.Converts to a more efficient Jep representation.toNode()Converts the node to standard Jep format.toString()Produces a string representation of the argument.toString(NumberFormat nf) Methods inherited from class com.singularsys.extensions.polynomials.AbstractPNode
compareTo, equals
-
Constructor Details
-
PConstant
-
-
Method Details
-
negate
Description copied from interface:PNodeInegates node i.e. -x- Throws:
ParseException
-
add
Description copied from class:AbstractPNodeReturns the sum of this node and argument- Specified by:
addin interfacePNodeI- Overrides:
addin classAbstractPNode- Parameters:
c- to add- Returns:
- node representing the sum
- Throws:
ParseException- on error
-
sub
Description copied from class:AbstractPNodeReturns the difference between this node and argument- Specified by:
subin interfacePNodeI- Overrides:
subin classAbstractPNode- Parameters:
c- to subtract- Returns:
- node representing the difference
- Throws:
ParseException- on error
-
mul
Description copied from interface:PNodeIMultiplies this by the argument.- Specified by:
mulin interfacePNodeI- Overrides:
mulin classAbstractPNode- Throws:
ParseException
-
div
Description copied from interface:PNodeIDivides this by the argument.- Specified by:
divin interfacePNodeI- Overrides:
divin classAbstractPNode- Throws:
ParseException
-
invert
Description copied from interface:PNodeIinverts node i.e. 1/x- Specified by:
invertin interfacePNodeI- Overrides:
invertin classAbstractPNode- Throws:
ParseException
-
pow
Description copied from interface:PNodeIRaise this to the argument.- Specified by:
powin interfacePNodeI- Overrides:
powin classAbstractPNode- Throws:
ParseException
-
toString
Description copied from interface:PNodeIProduces a string representation of the argument. -
isZero
public boolean isZero()Description copied from interface:PNodeITrue if node represents zero- Specified by:
isZeroin interfacePNodeI- Overrides:
isZeroin classAbstractPNode
-
isOne
public boolean isOne()Description copied from interface:PNodeITrue if node represents one- Specified by:
isOnein interfacePNodeI- Overrides:
isOnein classAbstractPNode
-
isMinusOne
public boolean isMinusOne() -
isInfinity
public boolean isInfinity() -
isNan
public boolean isNan() -
isPositive
public boolean isPositive() -
isNegative
public boolean isNegative() -
isInteger
public boolean isInteger() -
intValue
- Throws:
EvaluationException
-
toNode
Description copied from interface:PNodeIConverts the node to standard Jep format.- Throws:
ParseException
-
toCompactNode
Description copied from interface:PNodeIConverts to a more efficient Jep representation. Exploits the feature of the Add and Multiply operators which allow the operators to work as n-ary operators. Order of elements is altered to make for more efficient operation.- Returns:
- Throws:
ParseException
-
compareToPConstant
-
equalsPNode
Description copied from interface:PNodeITrue is nodes represent the same parse trees- Specified by:
equalsPNodein interfacePNodeI- Overrides:
equalsPNodein classAbstractPNode
-
expand
Description copied from interface:PNodeIcomplete expansion. (1+x)^2 --> 1+2*x+x^2 -
getValue
- Returns:
- Returns the value.
-
convertToPolyArray
Description copied from interface:PNodeIInternal method for extracting coefficients- Parameters:
var- variable namepolyArray- results added to this map- Throws:
ParseException
-
hashCode
public int hashCode() -
substitute
Description copied from interface:PNodeISubstitute all occurrence of variable with its replacement.- Parameters:
var- the variablesub- the replacement- Returns:
-
toString
-