org.lsmp.djep.sjep
Class AbstractPNode

java.lang.Object
  extended by org.lsmp.djep.sjep.AbstractPNode
All Implemented Interfaces:
PNodeI
Direct Known Subclasses:
Monomial, PConstant, PFunction, Polynomial, POperator, PVariable

public abstract class AbstractPNode
extends java.lang.Object
implements PNodeI

Default methods, when more specific methods do not work.

Author:
Rich Morris Created on 22-Dec-2004

Field Summary
protected  PolynomialCreator pc
          A reference to the PolynomialCreator instance.
 
Constructor Summary
AbstractPNode(PolynomialCreator pc)
           
 
Method Summary
 PNodeI add(PNodeI node)
          Adds a node to this one.
 int compareTo(PNodeI node)
          this < arg ---> -1 this > arg ---> 1
 PNodeI div(PNodeI node)
          Divides this by the argument.
 boolean equals(PNodeI node)
          True is nodes represent the same parse trees
 PNodeI invert()
          inverts node i.e. 1/x
 boolean isOne()
          True if node represents one
 boolean isZero()
          True if node represents zero
 PNodeI mul(PNodeI node)
          Multiplies this by the argument.
 PNodeI negate()
          negates node i.e.
 PNodeI pow(PNodeI node)
          Raise this to the argument.
 PNodeI sub(PNodeI node)
          Subtracts the argument from this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.lsmp.djep.sjep.PNodeI
equals, expand, toNode, toString
 

Field Detail

pc

protected PolynomialCreator pc
A reference to the PolynomialCreator instance.

Constructor Detail

AbstractPNode

public AbstractPNode(PolynomialCreator pc)
Method Detail

add

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

Specified by:
add in interface PNodeI
Throws:
ParseException

sub

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

Specified by:
sub in interface PNodeI
Throws:
ParseException

negate

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

Specified by:
negate in interface PNodeI
Throws:
ParseException

mul

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

Specified by:
mul in interface PNodeI
Throws:
ParseException

div

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

Specified by:
div in interface PNodeI
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
Throws:
ParseException

pow

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

Specified by:
pow in interface PNodeI
Throws:
ParseException

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

isZero

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

Specified by:
isZero in interface PNodeI

isOne

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

Specified by:
isOne in interface PNodeI

compareTo

public int compareTo(PNodeI node)
this < arg ---> -1 this > arg ---> 1

Specified by:
compareTo in interface PNodeI


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