com.sun.xml.bind.v2.util

Class CollisionCheckStack<E>

public final class CollisionCheckStack<E> extends AbstractList<E>

Stack-like data structure that allows the following efficient operations:
  1. Push/pop operation.
  2. Duplicate check. When an object that's already in the stack is pushed, this class will tell you so.

Object equality is their identity equality.

This class implements List for accessing items in the stack, but List methods that alter the stack is not supported.

Constructor Summary
CollisionCheckStack()
Method Summary
booleanfindDuplicate(E o)
Eget(int index)
StringgetCycleString()
String that represents the cycle.
booleangetLatestPushResult()
booleangetUseIdentity()
Epeek()
Returns the top of the stack.
Epop()
Pops an object from the stack
booleanpush(E o)
Pushes a new object to the stack.
voidpushNocheck(E o)
Pushes a new object to the stack without making it participate with the collision check.
voidreset()
Clears all the contents in the stack.
voidsetUseIdentity(boolean useIdentity)
Set to false to use Object#equals(Object) to detect cycles.
intsize()

Constructor Detail

CollisionCheckStack

public CollisionCheckStack()

Method Detail

findDuplicate

public boolean findDuplicate(E o)

get

E get(int index)

getCycleString

public String getCycleString()
String that represents the cycle.

getLatestPushResult

public boolean getLatestPushResult()

getUseIdentity

public boolean getUseIdentity()

peek

public E peek()
Returns the top of the stack.

pop

public E pop()
Pops an object from the stack

push

public boolean push(E o)
Pushes a new object to the stack.

Returns: true if this object has already been pushed

pushNocheck

public void pushNocheck(E o)
Pushes a new object to the stack without making it participate with the collision check.

reset

public void reset()
Clears all the contents in the stack.

setUseIdentity

public void setUseIdentity(boolean useIdentity)
Set to false to use Object#equals(Object) to detect cycles. This method can be only used when the stack is empty.

size

int size()