net.sf.sail.common.persistance.memory
Class MemorySock<T>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<E>
              extended by java.util.Stack<T>
                  extended by net.sf.sail.common.persistance.memory.MemorySock<T>
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>, java.util.RandomAccess, ISock<T>

public class MemorySock<T>
extends java.util.Stack<T>
implements ISock<T>

See Also:
Serialized Form

Nested Class Summary
 class MemorySock.MemorySockEntry
           
 
Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
MemorySock(Rim<T> rim)
           
 
Method Summary
 boolean add(T o)
          The same as add(T o, false).
 boolean add(T o, boolean replace)
          Ensures that this collection contains the specified element (optional operation).
 java.util.Iterator<ISockEntry<T>> entryIterator()
          FIXME this isn't really implemented
 ISockEntry<T> entryPeek()
          Return the most recent ISockEntry in this sock.
 java.lang.String toString()
           
 
Methods inherited from class java.util.Stack
empty, peek, pop, push, search
 
Methods inherited from class java.util.Vector
add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.sail.core.entity.ISock
isEmpty, iterator, peek, size
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

MemorySock

public MemorySock(Rim<T> rim)
Parameters:
rim -
Method Detail

add

public boolean add(T o,
                   boolean replace)
Description copied from interface: ISock
Ensures that this collection contains the specified element (optional operation). Returns true if this collection changed as a result of the call. (Returns false if this collection does not permit duplicates and already contains the specified element.)

Collections that support this operation may place limitations on what elements may be added to this collection. In particular, some collections will refuse to add null elements, and others will impose restrictions on the type of elements that may be added. Collection classes should clearly specify in their documentation any restrictions on what elements may be added.

If a collection refuses to add a particular element for any reason other than that it already contains the element, it must throw an exception (rather than returning false). This preserves the invariant that a collection always contains the specified element after this call returns.

Specified by:
add in interface ISock<T>
Parameters:
o - element whose presence in this collection is to be ensured.
replace - false -- creates and adds a new SockEntry for this object true -- replaces the timestamp and value of the most recent SockEntry with the current timestamp and this object
Returns:
true if this collection changed as a result of the call

add

public boolean add(T o)
Description copied from interface: ISock
The same as add(T o, false). See add(T o, boolean replace).

Specified by:
add in interface java.util.Collection<T>
Specified by:
add in interface java.util.List<T>
Specified by:
add in interface ISock<T>
Overrides:
add in class java.util.Vector<T>
Parameters:
o - element whose presence in this collection is to be ensured.
Returns:
true if this collection changed as a result of the call

toString

public java.lang.String toString()
Overrides:
toString in class java.util.Vector<T>

entryIterator

public java.util.Iterator<ISockEntry<T>> entryIterator()
FIXME this isn't really implemented

Specified by:
entryIterator in interface ISock<T>
Returns:

entryPeek

public ISockEntry<T> entryPeek()
Description copied from interface: ISock
Return the most recent ISockEntry in this sock. This can be used to get the Date when an object was added to the sock.

Specified by:
entryPeek in interface ISock<T>
Returns:


Copyright © 2004-2008 TELS Center. All Rights Reserved.