|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jdsl.core.ref.AbstractPositionalContainer
|
+--jdsl.core.ref.AbstractCircularSequence
|
+--jdsl.core.ref.NodeCircularSequence
A CircularSequence implemented with a linked list whose nodes are Positions.
| Constructor Summary | |
NodeCircularSequence()
default Constructor for a NodeCircularSequence, the only one. |
|
| Method Summary | |
Position |
after(Position pos)
O(1) |
Position |
before(Position pos)
O(1) |
jdsl.core.ref.NodeCircularSequence.NCSNode |
castPosition(Accessor pos)
Convenience method to check if an Accessor can be used in this * Sequence. |
void |
checkEmpty()
Simple convenience method to handle throwing an EmptyContainerException if the Sequence is empty. |
void |
checkValidity(CircularSequence cSeq)
This is a convenience method that tests a CircularSequence for any condition which would cause invalidity, specifically : 1) it is null, 2) it is an incompatible type of CircularSequence, 3) the CircularSequence has been deliberately invalidated. |
boolean |
contains(Accessor acc)
O(1) |
ObjectIterator |
elements()
O(1) if the structure and elements do not change, O(N) otherwise. |
Position |
insertAfter(Position p,
java.lang.Object element)
O(1) |
Position |
insertBefore(Position p,
java.lang.Object element)
O(1) |
Position |
insertInitial(java.lang.Object element)
O(1) |
boolean |
isEmpty()
O(1) |
Container |
newContainer()
O(1) |
PositionIterator |
positions()
O(1) if the structure does not change, O(N) otherwise. |
java.lang.Object |
remove(Position pos)
O(1) |
java.lang.Object |
replaceElement(Accessor acc,
java.lang.Object newElt)
O(1) |
void |
setStartingPosition(Position pos)
O(1) |
int |
size()
O(1) |
void |
splice(Position afterWhich,
CircularSequence toMerge,
Position newSuccessor)
O(N) |
CircularSequence |
split(Position inNewA,
Position inNewB)
O(N) |
Position |
startingPosition()
O(1) |
java.lang.String |
toString()
|
| Methods inherited from class jdsl.core.ref.AbstractCircularSequence |
removeAfter, removeBefore |
| Methods inherited from class jdsl.core.ref.AbstractPositionalContainer |
swapElements |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jdsl.core.api.PositionalContainer |
swapElements |
| Constructor Detail |
public NodeCircularSequence()
| Method Detail |
public Container newContainer()
jdsl.core.api.Containerpublic boolean contains(Accessor acc)
jdsl.core.api.InspectableContainerInvalidAccessorException - if a is nullpublic PositionIterator positions()
jdsl.core.api.InspectablePositionalContainerpublic ObjectIterator elements()
jdsl.core.api.InspectableContainerpublic Position startingPosition()
jdsl.core.api.InspectableCircularSequenceEmptyContainerException - if there are no elements in
this circular sequencepublic void setStartingPosition(Position pos)
jdsl.core.api.CircularSequenceInvalidAccessorException - if p is not a
valid position in this circular sequenceEmptyContainerException - if there are no elements in
this circular sequence
public java.lang.Object replaceElement(Accessor acc,
java.lang.Object newElt)
jdsl.core.api.Containera - Accessor in this containernewElement - to be stored at aInvalidAccessorException - if a is null or does not
belong to this containerpublic boolean isEmpty()
isEmpty in class AbstractPositionalContainerjdsl.core.api.InspectableContainertrue if and only if the container is empty (holds
no elements)InspectableBinaryTreepublic int size()
jdsl.core.api.InspectableContainerpublic Position after(Position pos)
jdsl.core.api.InspectableCircularSequencep - Position in this sequenceInvalidAccessorException - if p is not a
valid position in this circular sequence.public Position before(Position pos)
jdsl.core.api.InspectableCircularSequencep - Position in this sequenceInvalidAccessorException - if p is not
a valid position in this circular sequence.
public Position insertBefore(Position p,
java.lang.Object element)
throws InvalidAccessorException,
InvalidContainerException
jdsl.core.api.CircularSequencep - A position in this sequenceelement - Any objectPosition p (the parameter)InvalidAccessorException - if p
is not a valid position in this circular sequence
public Position insertAfter(Position p,
java.lang.Object element)
throws InvalidAccessorException,
InvalidContainerException
jdsl.core.api.CircularSequencep - A position in this sequenceelement - objectPosition p (the parameter)InvalidAccessorException - if p
is not a valid position in this circular sequence
public Position insertInitial(java.lang.Object element)
throws NonEmptyContainerException,
InvalidContainerException
jdsl.core.api.CircularSequenceelement - Any objectNonEmptyContainerException - if there are no elements
in this circular sequence.
public java.lang.Object remove(Position pos)
throws InvalidAccessorException,
InvalidContainerException
jdsl.core.api.CircularSequencepos - the position to be removedposInvalidAccessorException - if pos
is not a valid position in the circular sequence.
public CircularSequence split(Position inNewA,
Position inNewB)
throws InvalidAccessorException,
InvalidContainerException
jdsl.core.api.CircularSequenceinNewA - Start of sequence of Positions to be removed from
this CircularSequenceinNewB - End of sequence of Positions to be removed from this
CircularSequenceInvalidAccessorException - if neither inNewA
nor inNewB is a valid positions contained in this
circular sequence.
public void splice(Position afterWhich,
CircularSequence toMerge,
Position newSuccessor)
throws InvalidAccessorException,
InvalidContainerException
jdsl.core.api.CircularSequenceafterWhich - Position after which to break this CircularSequencetoMerge - CircularSequence to be spliced into this onenewSuccessor - Position from toMerge that will follow Position
afterWhich in this CircularSequenceInvalidAccessorException - if either
afterWhich is not a valid position in this container or
newSuccessor is not a valid position in toMergeInvalidContainerException - if toMerge is null, or
of the wrong implementation type, or equal to this circular sequencepublic java.lang.String toString()
toString in class java.lang.Object
public void checkValidity(CircularSequence cSeq)
throws InvalidContainerException
InvalidContainerException -
public void checkEmpty()
throws EmptyContainerException
EmptyContainerException -
public jdsl.core.ref.NodeCircularSequence.NCSNode castPosition(Accessor pos)
throws InvalidAccessorException
InvalidAccessorException -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||