|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.collections.DoubleLinkedSeq
public class DoubleLinkedSeq
This class is a homework assignment; A DoubleLinkedSeq is a collection of double numbers. The sequence can have a special "current element," which is specified and accessed through four methods that are not available in the sequence class (start, getCurrent, advance and isCurrent).
| Constructor Summary | |
|---|---|
DoubleLinkedSeq()
Initialize an empty sequence. |
|
| Method Summary | |
|---|---|
void |
addAfter(int element)
Add a new element to this sequence, after the current element. |
void |
addAll(DoubleLinkedSeq addend)
Place the contents of another sequence at the end of this sequence. |
void |
addBefore(int element)
Add a new element to this sequence, before the current element. |
void |
advance()
Move forward, so that the current element is now the next element in this sequence. |
static DoubleLinkedSeq |
catenation(DoubleLinkedSeq s1,
DoubleLinkedSeq s2)
Create a new sequence that contains all the elements from one sequence followed by another. |
java.lang.Object |
clone()
Generate a copy of this sequence. |
double |
getCurrent()
Accessor method to get the current element of this sequence. |
double |
isCurrent()
Accessor method to determine whether this sequence has a specified current element that can be retrieved with the getCurrent method. |
void |
removeCurrent()
Remove the current element from this sequence. |
int |
size()
Determine the number of elements in this sequence. |
void |
start()
Set the current element at the front of this sequence. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DoubleLinkedSeq()
- - none
| Method Detail |
|---|
public void addAfter(int element)
element - the new element that is being added
java.lang.OutOfMemoryError - Indicates insufficient memory for a new node.public void addBefore(int element)
element - the new element that is being added
java.lang.OutOfMemoryError - Indicates insufficient memory for a new node.public void addAll(DoubleLinkedSeq addend)
addend - a sequence whose contents will be placed at the end of this sequence
java.lang.NullPointerException - Indicates that addend is null.
java.lang.OutOfMemoryError - Indicates insufficient memory to increase the size of this sequence.public void advance()
- - none
java.lang.IllegalStateException - Indicates that there is no current element, so
advance may not be called.public java.lang.Object clone()
clone in class java.lang.Object- - none
java.lang.OutOfMemoryError - Indicates insufficient memory for creating the clone.
public static DoubleLinkedSeq catenation(DoubleLinkedSeq s1,
DoubleLinkedSeq s2)
s1 - the first of two sequencess2 - the second of two sequences
NullPointerException. - Indicates that one of the arguments is null.
java.lang.OutOfMemoryError - Indicates insufficient memory for the new sequence.public double getCurrent()
- - none
java.lang.IllegalStateException - Indicates that there is no current element, so
getCurrent may not be called.public double isCurrent()
- - none
public void removeCurrent()
- - none
java.lang.IllegalStateException - Indicates that there is no current element, so
removeCurrent may not be called.public int size()
- - none
public void start()
- - none
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||