org.lsmp.djep.sjep
Class Polynomial

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

public class Polynomial
extends AbstractPNode

Represents a polynomial. i.e. a sum of terms which are typically Monomials, but can be any AbstractPNode. The order of the terms is specified by the total ordering.

Author:
Rich Morris Created on 14-Dec-2004

Field Summary
 
Fields inherited from class org.lsmp.djep.sjep.AbstractPNode
pc
 
Method Summary
 PNodeI add(PNodeI node)
          Adds a node to this one.
 PNodeI add(Polynomial p)
           
 int compareTo(PNodeI node)
          this < arg ---> -1 this > arg ---> 1
 int compareTo(Polynomial p)
           
 PNodeI div(PNodeI node)
          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
 PNodeI mul(PNodeI node)
          Multiplies this by the argument.
 PNodeI negate()
          negates node i.e.
 PNodeI sub(PNodeI node)
          Subtracts the argument from this.
 PNodeI sub(Polynomial p)
           
 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
invert, isOne, isZero, pow
 
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
 

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
Overrides:
add in class AbstractPNode
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
Overrides:
sub in class AbstractPNode
Throws:
ParseException

add

public PNodeI add(Polynomial p)
           throws ParseException
Throws:
ParseException

sub

public PNodeI sub(Polynomial p)
           throws ParseException
Throws:
ParseException

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

mul

public PNodeI mul(PNodeI node)
           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 node)
           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

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

compareTo

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

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

compareTo

public int compareTo(Polynomial p)

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

toNode

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

Throws:
ParseException

expand

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

Throws:
ParseException


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