public final class RatPolyStack extends Object implements Iterable<RatPoly>
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 and Description |
---|
RatPolyStack() |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
public RatPolyStack()
public int size()
public void push(RatPoly p)
p
- The RatPoly to push onto this stack.public RatPoly pop()
public void dup()
public void swap()
public void clear()
public RatPoly getNthFromTop(int index)
index
- The index of the RatPoly to be retrieved.public void add()
public void sub()
public void mul()
public void div()
public void differentiate()
public void integrate()