SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

serp.util
Class ReferenceCollection

java.lang.Object
  |
  +--serp.util.ReferenceCollection
All Implemented Interfaces:
Collection

public class ReferenceCollection
extends Object
implements Collection

A collection whose values may be stored as weak or soft references.

Expired values are removed from the collection before any mutator methods; removing before accessor methods can lead to ConcurrentModificationExceptions. Thus, the following methods may produce results which include values that have expired:

By default, all methods are delegated to the internal collection provided at construction. Thus, the ordering, etc of the given collection will be preserved. A special case is also made for MapSets using identity hashing, which is supported. Performance is similar to that of the internal collection instance.


Field Summary
static int HARD
          Hard reference marker.
static int SOFT
          Soft reference marker.
static int WEAK
          Weak reference marker.
 
Constructor Summary
ReferenceCollection()
          Equivalent to ReferenceCollection (ReferenceCollection.HARD).
ReferenceCollection(int defaultType)
          Equivalent to ReferenceCollection (defaultType, new LinkedList ()).
ReferenceCollection(int defaultType, Collection coll)
          Construct a ReferenceCollection with the given default reference type and interal collection.
 
Method Summary
 boolean add(Object obj)
           
 boolean add(Object obj, int type)
           
 boolean addAll(Collection objs)
           
 void clear()
           
 boolean contains(Object obj)
           
 boolean containsAll(Collection objs)
           
 boolean equals(Object other)
           
 boolean isEmpty()
           
 Iterator iterator()
           
 boolean remove(Object obj)
           
 boolean removeAll(Collection objs)
           
 boolean retainAll(Collection objs)
           
 int size()
           
 Object[] toArray()
           
 Object[] toArray(Object[] a)
           
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
hashCode
 

Field Detail

HARD

public static final int HARD
Hard reference marker.

SOFT

public static final int SOFT
Soft reference marker.

WEAK

public static final int WEAK
Weak reference marker.
Constructor Detail

ReferenceCollection

public ReferenceCollection()
Equivalent to ReferenceCollection (ReferenceCollection.HARD).

ReferenceCollection

public ReferenceCollection(int defaultType)
Equivalent to ReferenceCollection (defaultType, new LinkedList ()).

ReferenceCollection

public ReferenceCollection(int defaultType,
                           Collection coll)
Construct a ReferenceCollection with the given default reference type and interal collection. The internal collection will be cleared. It should not be accessed in any way after being given to this constructor; this collection will 'inherit' its behavior, however. For example, if the given collection is a TreeSet, the elements will be maintained in natural order and will not allow duplicates.
Method Detail

add

public boolean add(Object obj)
Specified by:
add in interface Collection

add

public boolean add(Object obj,
                   int type)

addAll

public boolean addAll(Collection objs)
Specified by:
addAll in interface Collection

clear

public void clear()
Specified by:
clear in interface Collection

contains

public boolean contains(Object obj)
Specified by:
contains in interface Collection

containsAll

public boolean containsAll(Collection objs)
Specified by:
containsAll in interface Collection

equals

public boolean equals(Object other)
Specified by:
equals in interface Collection
Overrides:
equals in class Object

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection

remove

public boolean remove(Object obj)
Specified by:
remove in interface Collection

removeAll

public boolean removeAll(Collection objs)
Specified by:
removeAll in interface Collection

retainAll

public boolean retainAll(Collection objs)
Specified by:
retainAll in interface Collection

size

public int size()
Specified by:
size in interface Collection

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection

toArray

public Object[] toArray(Object[] a)
Specified by:
toArray in interface Collection

iterator

public Iterator iterator()
Specified by:
iterator in interface Collection

SolarMetric Kodo JDO 2.5.8 generated on January 11 2004

Copyright 2001,2002,2003 SolarMetric, Inc. All Rights Reserved.