Class PVariable
- java.lang.Object
-
- com.singularsys.extensions.polynomials.AbstractPNode
-
- com.singularsys.extensions.polynomials.PVariable
-
public class PVariable extends AbstractPNode
Represents a variable.- Author:
- Rich Morris Created on 14-Dec-2004
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.singularsys.extensions.polynomials.AbstractPNode
pc
-
-
Constructor Summary
Constructors Constructor Description PVariable(PolynomialCreator pc, Variable var)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PNodeIadd(PNodeI node)Adds a node to this one.intcompareTo(PVariable vf)this < arg ---> -1 this > arg ---> 1voidconvertToPolyArray(java.lang.String var, java.util.Map<java.lang.Integer,PNodeI> polyArray)Internal method for extracting coefficientsbooleanequals(java.lang.Object obj)True is nodes represent the same parse treesbooleanequalsIgnoreConstant(PNodeI node)booleanequalsPNode(PNodeI node)True is nodes represent the same parse treesPNodeIexpand()complete expansion. (1+x)^2 --> 1+2*x+x^2java.lang.StringgetName()VariablegetVariable()inthashCode()PNodeInegate()negates node i.e.PNodeIsub(PNodeI node)Subtracts the argument from this.NodetoCompactNode()Converts to a more efficient Jep representation.NodetoNode()Converts the node to standard Jep format.java.lang.StringtoString()Produces a string representation of the argument.
-
-
-
Constructor Detail
-
PVariable
public PVariable(PolynomialCreator pc, Variable var)
-
-
Method Detail
-
equalsPNode
public boolean equalsPNode(PNodeI node)
Description copied from interface:PNodeITrue is nodes represent the same parse trees- Specified by:
equalsPNodein interfacePNodeI- Overrides:
equalsPNodein classAbstractPNode
-
add
public PNodeI add(PNodeI node) throws ParseException
Description copied from interface:PNodeIAdds a node to this one.- Specified by:
addin interfacePNodeI- Overrides:
addin classAbstractPNode- Throws:
ParseException
-
sub
public PNodeI sub(PNodeI node) throws ParseException
Description copied from interface:PNodeISubtracts the argument from this.- Specified by:
subin interfacePNodeI- Overrides:
subin classAbstractPNode- Throws:
ParseException
-
compareTo
public int compareTo(PVariable vf)
this < arg ---> -1 this > arg ---> 1
-
toString
public java.lang.String toString()
Description copied from interface:PNodeIProduces a string representation of the argument.
-
toNode
public Node toNode() throws ParseException
Description copied from interface:PNodeIConverts the node to standard Jep format.- Throws:
ParseException
-
toCompactNode
public Node toCompactNode() throws ParseException
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
public PNodeI expand()
Description copied from interface:PNodeIcomplete expansion. (1+x)^2 --> 1+2*x+x^2
-
getVariable
public Variable getVariable()
- Returns:
- Returns the variable.
-
getName
public java.lang.String getName()
- Returns:
- Returns the name of the variable
-
convertToPolyArray
public void convertToPolyArray(java.lang.String var, java.util.Map<java.lang.Integer,PNodeI> polyArray) throws ParseExceptionDescription copied from interface:PNodeIInternal method for extracting coefficients- Parameters:
var- variable namepolyArray- results added to this map- Throws:
ParseException
-
negate
public PNodeI negate() throws ParseException
Description copied from interface:PNodeInegates node i.e. -x- Throws:
ParseException
-
equalsIgnoreConstant
public boolean equalsIgnoreConstant(PNodeI node)
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Description copied from interface:PNodeITrue is nodes represent the same parse trees- Specified by:
equalsin interfacePNodeI- Overrides:
equalsin classAbstractPNode
-
-