org.lsmp.djep.sjep
Class PConstant

java.lang.Object
  extended by org.lsmp.djep.sjep.AbstractPNode
      extended by org.lsmp.djep.sjep.PConstant
All Implemented Interfaces:
PNodeI

public class PConstant
extends AbstractPNode

Represents a constant.

Author:
Rich Morris Created on 14-Dec-2004

Field Summary
 
Fields inherited from class org.lsmp.djep.sjep.AbstractPNode
pc
 
Constructor Summary
PConstant(PolynomialCreator pc, java.lang.Object o)
           
 
Method Summary
 PNodeI add(PNodeI c)
          Adds a node to this one.
 int compareTo(PConstant c)
           
 PNodeI div(PNodeI c)
          Divides this by the argument.
 boolean equals(PNodeI node)
          True is nodes represent the same parse trees
 PNodeI expand()
          complete expansion. (1+x)^2 --> 1+2*x+x^2
 int intValue()
           
 PNodeI invert()
          inverts node i.e. 1/x
 boolean isInfinity()
           
 boolean isInteger()
           
 boolean isMinusOne()
           
 boolean isNan()
           
 boolean isNegative()
           
 boolean isOne()
          True if node represents one
 boolean isPositive()
           
 boolean isZero()
          True if node represents zero
 PNodeI mul(PNodeI c)
          Multiplies this by the argument.
 PNodeI negate()
          negates node i.e.
 PNodeI pow(PNodeI c)
          Raise this to the argument.
 PNodeI sub(PNodeI c)
          Subtracts the argument from this.
 Node toNode()
          Converts the node to standard JEP format.
 java.lang.String toString()
          Produces a string representation of the argument.
 
Methods inherited from class org.lsmp.djep.sjep.AbstractPNode
compareTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.lsmp.djep.sjep.PNodeI
equals
 

Constructor Detail

PConstant

public PConstant(PolynomialCreator pc,
                 java.lang.Object o)
Method Detail

negate

public PNodeI negate()
              throws ParseException
Description copied from interface: PNodeI
negates node i.e. -x

Specified by:
negate in interface PNodeI
Overrides:
negate in class AbstractPNode
Throws:
ParseException

add

public PNodeI add(PNodeI c)
           throws ParseException
Description copied from interface: PNodeI
Adds a node to this one.

Specified by:
add in interface PNodeI
Overrides:
add in class AbstractPNode
Throws:
ParseException

sub

public PNodeI sub(PNodeI c)
           throws ParseException
Description copied from interface: PNodeI
Subtracts the argument from this.

Specified by:
sub in interface PNodeI
Overrides:
sub in class AbstractPNode
Throws:
ParseException

mul

public PNodeI mul(PNodeI c)
           throws ParseException
Description copied from interface: PNodeI
Multiplies this by the argument.

Specified by:
mul in interface PNodeI
Overrides:
mul in class AbstractPNode
Throws:
ParseException

div

public PNodeI div(PNodeI c)
           throws ParseException
Description copied from interface: PNodeI
Divides this by the argument.

Specified by:
div in interface PNodeI
Overrides:
div in class AbstractPNode
Throws:
ParseException

invert

public PNodeI invert()
              throws ParseException
Description copied from interface: PNodeI
inverts node i.e. 1/x

Specified by:
invert in interface PNodeI
Overrides:
invert in class AbstractPNode
Throws:
ParseException

pow

public PNodeI pow(PNodeI c)
           throws ParseException
Description copied from interface: PNodeI
Raise this to the argument.

Specified by:
pow in interface PNodeI
Overrides:
pow in class AbstractPNode
Throws:
ParseException

toString

public java.lang.String toString()
Description copied from interface: PNodeI
Produces a string representation of the argument.

Specified by:
toString in interface PNodeI
Overrides:
toString in class java.lang.Object

isZero

public boolean isZero()
Description copied from interface: PNodeI
True if node represents zero

Specified by:
isZero in interface PNodeI
Overrides:
isZero in class AbstractPNode

isOne

public boolean isOne()
Description copied from interface: PNodeI
True if node represents one

Specified by:
isOne in interface PNodeI
Overrides:
isOne in class AbstractPNode

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

public int intValue()

toNode

public Node toNode()
            throws ParseException
Description copied from interface: PNodeI
Converts the node to standard JEP format.

Throws:
ParseException

compareTo

public int compareTo(PConstant c)

equals

public boolean equals(PNodeI node)
Description copied from interface: PNodeI
True is nodes represent the same parse trees

Specified by:
equals in interface PNodeI
Overrides:
equals in class AbstractPNode

expand

public PNodeI expand()
Description copied from interface: PNodeI
complete expansion. (1+x)^2 --> 1+2*x+x^2



http://www.singularsys.com/jep Copyright © 2007 Singular Systems