|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object calculator.RatPolyStack
public final class RatPolyStack
RatPolyStack is a mutable finite sequence of RatPoly objects.
Each RatPolyStack can be described by [p1, p2, ... ], where [] is an empty stack, [p1] is a one element stack containing the Poly 'p1', and so on. RatPolyStacks can also be described constructively, with the append operation, ':'. such that [p1]:S is the result of putting p1 at the front of the RatPolyStack S.
A finite sequence has an associated size, corresponding to the number of elements in the sequence. Thus the size of [] is 0, the size of [p1] is 1, the size of [p1, p1] is 2, and so on.
Constructor Summary | |
---|---|
RatPolyStack()
|
Method Summary | |
---|---|
void |
add()
Pops two elements off of the stack, adds them, and places the result on top of the stack. |
void |
clear()
Clears the stack. |
void |
differentiate()
Pops the top element off of the stack, differentiates it, and places the result on top of the stack. |
void |
div()
Divides the next from top poly by the top poly, pops both off the stack, and places the result on top of the stack. |
void |
dup()
Duplicates the top RatPoly on this. |
RatPoly |
getNthFromTop(int index)
Returns the RatPoly that is 'index' elements from the top of the stack. |
void |
integrate()
Pops the top element off of the stack, integrates it, and places the result on top of the stack. |
java.util.Iterator<RatPoly> |
iterator()
Returns an iterator of the elements contained in the stack. |
void |
mul()
Pops two elements off of the stack, multiplies them, and places the result on top of the stack. |
RatPoly |
pop()
Removes and returns the top RatPoly. |
void |
push(RatPoly p)
Pushes a RatPoly onto the top of this. |
int |
size()
Returns the number of RayPolys in this RatPolyStack. |
void |
sub()
Subtracts the top poly from the next from top poly, pops both off the stack, and places the result on top of the stack. |
void |
swap()
Swaps the top two elements of this. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RatPolyStack()
Method Detail |
---|
public int size()
public void push(RatPoly p)
public RatPoly pop()
public void dup()
public void swap()
public void clear()
public RatPoly getNthFromTop(int index)
public void add()
public void sub()
public void mul()
public void div()
public void differentiate()
public void integrate()
public java.util.Iterator<RatPoly> iterator()
iterator
in interface java.lang.Iterable<RatPoly>
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |