Opus5
Class PolynomialAsSortedList
java.lang.Object
|
+--Opus5.PolynomialAsSortedList
- All Implemented Interfaces:
- Polynomial
- public class PolynomialAsSortedList
- extends java.lang.Object
- implements Polynomial
A polynomial implemented using a sorted list.
- Version:
- $Id: PolynomialAsSortedList.java,v 3.5 1998/07/28 13:57:50 brpreiss Exp $
- Author:
- Bruno R. Preiss, P.Eng.
- See Also:
SortedList
|
Method Summary |
void |
add(Term term)
Adds the specified term to this polynomial. |
void |
differentiate()
Differentiates this polynomial. |
Polynomial |
plus(Polynomial poly)
Returns the sum of this polynomial and the specified polynomial. |
java.lang.String |
toString()
Returns a string representation of this polynomial. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PolynomialAsSortedList
public PolynomialAsSortedList()
- Constructs a
PolynomialAsOrderedList.
The polynomial initially contains no terms.
I.e., it is the zero polynomial.
add
public void add(Term term)
- Adds the specified term to this polynomial.
- Specified by:
add in interface Polynomial
- Parameters:
term - The term to be added to this polynomial.
differentiate
public void differentiate()
- Differentiates this polynomial.
Implemented using a visitor that differentiates one-by-one
all the terms in this polynomial.
- Specified by:
differentiate in interface Polynomial
plus
public Polynomial plus(Polynomial poly)
- Returns the sum of this polynomial and the specified polynomial.
- Specified by:
plus in interface Polynomial
- Parameters:
poly - The polynomial to be added to this polynomial.- Returns:
- the sum of this polynomial and the specified polynomial.
- See Also:
plus(Opus5.Polynomial)
toString
public java.lang.String toString()
- Returns a string representation of this polynomial.
- Overrides:
toString in class java.lang.Object
- Returns:
- a string representation of this polynomial.