org.starhope.appius.util
Class SimpleDataRecordSet<DataRecordClass extends DataRecord,DataRecordSetClass extends SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>>

java.lang.Object
  extended by org.starhope.appius.util.SimpleDataRecord<SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>>
      extended by org.starhope.appius.util.SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>
Type Parameters:
DataRecordClass - the type of records contained within the set
DataRecordSetClass - the type of the subclass implementing this base class
All Implemented Interfaces:
com.whirlycott.cache.Cacheable, Serializable, Comparable<SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>>, Iterable<DataRecordClass>, Collection<DataRecordClass>, CTime, DataRecord, DataRecordSet<DataRecordClass>, HasSubversionRevision
Direct Known Subclasses:
BadMailList, Inventory, NotificationSet, StringSet, TheServers

public abstract class SimpleDataRecordSet<DataRecordClass extends DataRecord,DataRecordSetClass extends SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>>
extends SimpleDataRecord<SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>>
implements DataRecordSet<DataRecordClass>

This class represents a default implementation of DataRecordSet which is hoped to be sufficient for most purposes.

This type cannot handle a DataRecord implementation which throws a NotFoundException from DataRecord.getCacheableID() in any case; it will throw a runtime exception of type NumberFormatException when this occurs.

This type cannot accept null values into the collection.

Author:
brpocock@star-hope.org
See Also:
Serialized Form

Field Summary
private  Map<Integer,DataRecordClass> map
          The internal implementation of the set is a concurrent hash-map.
private static long serialVersionUID
          WRITEME: Document this brpocock@star-hope.org
 
Fields inherited from class org.starhope.appius.util.SimpleDataRecord
myLoader, timeLastChanged, timeLastSaved
 
Constructor Summary
protected SimpleDataRecordSet(Class<? extends SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>> klass)
          WRITEME: Document this constructor brpocock@star-hope.org
  SimpleDataRecordSet(RecordLoader<SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>> loader)
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 boolean add(DataRecordClass o)
           
 boolean addAll(Collection<? extends DataRecordClass> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 boolean isEmpty()
           
 Iterator<DataRecordClass> iterator()
           
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 int size()
           
 Object[] toArray()
           
<R> R[]
toArray(R[] a)
           
 
Methods inherited from class org.starhope.appius.util.SimpleDataRecord
changed, checkStale, compareTo, equals, finalize, getRecordLoader, getTimeLastChanged, getTimeLastSaved, hashCode, isBeingLoaded, markAsLoaded, markAsSaved, markForReload, onRemove, onRetrieve, onStore, save, setRecordLoader, toString
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 
Methods inherited from interface org.starhope.appius.util.DataRecord
checkStale, getCacheableID, getCacheableIdent, getRecordLoader, isBeingLoaded, markAsLoaded, markAsSaved, setRecordLoader
 
Methods inherited from interface org.starhope.appius.util.CTime
getTimeLastChanged, getTimeLastSaved
 
Methods inherited from interface org.starhope.util.HasSubversionRevision
getSubversionRevision
 
Methods inherited from interface com.whirlycott.cache.Cacheable
onRemove, onRetrieve, onStore
 

Field Detail

serialVersionUID

private static final long serialVersionUID
WRITEME: Document this brpocock@star-hope.org

See Also:
Constant Field Values

map

private final Map<Integer,DataRecordClass extends DataRecord> map
The internal implementation of the set is a concurrent hash-map.

Constructor Detail

SimpleDataRecordSet

protected SimpleDataRecordSet(Class<? extends SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>> klass)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
klass - WRITEME

SimpleDataRecordSet

public SimpleDataRecordSet(RecordLoader<SimpleDataRecordSet<DataRecordClass,DataRecordSetClass>> loader)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
loader - WRITEME
Method Detail

add

public boolean add(DataRecordClass o)
Specified by:
add in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.add(java.lang.Object)

addAll

public boolean addAll(Collection<? extends DataRecordClass> c)
Specified by:
addAll in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.addAll(java.util.Collection)

clear

public void clear()
Specified by:
clear in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.clear()

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.contains(java.lang.Object)

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.containsAll(java.util.Collection)

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.isEmpty()

iterator

public Iterator<DataRecordClass> iterator()
Specified by:
iterator in interface Iterable<DataRecordClass extends DataRecord>
Specified by:
iterator in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.iterator()

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<DataRecordClass extends DataRecord>
See Also:

Note that the implementation of {@link #removeAll(Collection)} (for efficiency) does not call this method. Thus, any changes to this routine may need to be mirrored there.


removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<DataRecordClass extends DataRecord>
See Also:

Note that this implementation, for efficiency, does not call {@link #remove(Object)}


retainAll

public boolean retainAll(Collection<?> c)
Specified by:
retainAll in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.retainAll(java.util.Collection)

size

public int size()
Specified by:
size in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.size()

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<DataRecordClass extends DataRecord>
See Also:
Collection.toArray()

toArray

public <R> R[] toArray(R[] a)
Specified by:
toArray in interface Collection<DataRecordClass extends DataRecord>
See Also:
java.util.Collection#toArray(R[])