com.virtuosotechnologies.lib.container
Interface ModifiableObjectDeque

All Superinterfaces:
ObjectContainer, ObjectDeque
All Known Implementing Classes:
BasicModifiableObjectDeque

public interface ModifiableObjectDeque
extends ObjectDeque

An ObjectDeque with mutation methods. Most applications can use the BasicModifiableObjectDeque implementation.

This interface itself does not specify thread-safety semantics. The particular implementation or use in a larger interface should specify this. For example, standalone ObjectDeques may be fully synchronized and thread-safe. ObjectDeques related to AWT or Swing objects may require that all interaction be done on the AWT event thread.


Method Summary
 void insertObject(int n, Object obj)
          Insert an object in the deque at a particular index.
 Object popObjectBack()
          Pop an object from the back of the deque.
 Object popObjectFront()
          Pop an object from the front of the deque.
 void pushObjectBack(Object obj)
          Push an object on the back of the deque.
 void pushObjectFront(Object obj)
          Push an object on the front of the deque.
 Object removeObject(int n)
          Remove an object from the middle of the deque.
 
Methods inherited from interface com.virtuosotechnologies.lib.container.ObjectDeque
addObjectDequeListener, getBack, getFront, getNthObject, removeObjectDequeListener
 
Methods inherited from interface com.virtuosotechnologies.lib.container.ObjectContainer
getConstraints, getContentsAsArray, getSize
 

Method Detail

pushObjectFront

public void pushObjectFront(Object obj)
Push an object on the front of the deque.

Parameters:
obj - object to push
Throws:
ConstraintsMismatchException - obj doesn't obey the constraints

pushObjectBack

public void pushObjectBack(Object obj)
Push an object on the back of the deque.

Parameters:
obj - object to push
Throws:
ConstraintsMismatchException - obj doesn't obey the constraints

insertObject

public void insertObject(int n,
                         Object obj)
Insert an object in the deque at a particular index.

Parameters:
n - index to insert at
obj - object to insert
Throws:
ConstraintsMismatchException - obj doesn't obey the constraints
IndexOutOfBoundsException - index out of bounds

popObjectFront

public Object popObjectFront()
Pop an object from the front of the deque. Returns the object, or null if the deque is empty.

Returns:
the object popped, or null if deque is empty

popObjectBack

public Object popObjectBack()
Pop an object from the back of the deque. Returns the object, or null if the deque is empty.

Returns:
the object popped, or null if deque is empty

removeObject

public Object removeObject(int n)
Remove an object from the middle of the deque. Returns the object.

Parameters:
n - index to remove
Returns:
the object remove
Throws:
IndexOutOfBoundsException - index out of bounds