Class PVariable
java.lang.Object
com.singularsys.extensions.polynomials.AbstractPNode
com.singularsys.extensions.polynomials.PVariable
- All Implemented Interfaces:
PNodeI,Serializable,Comparable<PNodeI>
Represents a variable.
- 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 argumentintthis < arg ---> -1 this > arg ---> 1voidconvertToPolyArray(String var, Map<Integer, PNodeI> polyArray) Internal method for extracting coefficientsbooleanbooleanequalsIgnoreConstant(PNodeI node) booleanequalsPNode(PNodeI node) True is nodes represent the same parse treesexpand()complete expansion. (1+x)^2 --> 1+2*x+x^2getName()inthashCode()negate()negates node i.e.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)
-
Constructor Details
-
PVariable
-
-
Method Details
-
equalsPNode
Description copied from interface:PNodeITrue is nodes represent the same parse trees- Specified by:
equalsPNodein interfacePNodeI- Overrides:
equalsPNodein classAbstractPNode
-
add
Description copied from class:AbstractPNodeReturns the sum of this node and argument- Specified by:
addin interfacePNodeI- Overrides:
addin classAbstractPNode- Parameters:
node- 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:
node- to subtract- Returns:
- node representing the difference
- Throws:
ParseException- on error
-
compareTo
this < arg ---> -1 this > arg ---> 1 -
toString
Description copied from interface:PNodeIProduces a string representation of the argument. -
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
-
expand
Description copied from interface:PNodeIcomplete expansion. (1+x)^2 --> 1+2*x+x^2 -
getVariable
- Returns:
- Returns the variable.
-
getName
- Returns:
- Returns the name of the variable
-
convertToPolyArray
Description copied from interface:PNodeIInternal method for extracting coefficients- Parameters:
var- variable namepolyArray- results added to this map- Throws:
ParseException
-
negate
Description copied from interface:PNodeInegates node i.e. -x -
equalsIgnoreConstant
-
hashCode
public int hashCode() -
equals
- Specified by:
equalsin interfacePNodeI- Overrides:
equalsin classAbstractPNode
-
substitute
Description copied from interface:PNodeISubstitute all occurrence of variable with its replacement.- Parameters:
var- the variablesub- the replacement- Returns:
- Throws:
ParseException
-
toString
-