org.starhope.appius.game.inventory.collections
Class UserItemCollection

java.lang.Object
  extended by org.starhope.appius.util.SimpleDataRecord<UserItemCollection>
      extended by org.starhope.appius.game.inventory.collections.UserItemCollection
All Implemented Interfaces:
com.whirlycott.cache.Cacheable, Serializable, Comparable<UserItemCollection>, Iterable<InventoryItem>, Collection<InventoryItem>, CTime, DataRecord, HasSubversionRevision

public class UserItemCollection
extends SimpleDataRecord<UserItemCollection>
implements Collection<InventoryItem>

A (possibly partial) collection of items that an user has collected; c.v. ItemCollectionSet

Author:
Tim Heys
See Also:
Serialized Form

Field Summary
private  Set<InventoryItem> items
          the items that this user has collected which are a part of this set
private  AbstractUser owner
          the owner of this collection
private  EventType rewardEvent
          WRITEME: Document this brpocock@star-hope.org
private static long serialVersionUID
          Java serialization unique ID
private  String title
          the title of this set
 
Fields inherited from class org.starhope.appius.util.SimpleDataRecord
myLoader, timeLastChanged, timeLastSaved
 
Constructor Summary
UserItemCollection(RecordLoader<UserItemCollection> loader)
          WRITEME: Document this constructor brpocock@star-hope.org
 
Method Summary
 boolean add(InventoryItem e)
           
 boolean addAll(Collection<? extends InventoryItem> c)
           
 void clear()
           
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 int getCacheableID()
          Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.
 String getCacheableIdent()
          Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.
 Collection<InventoryItem> getItems()
           
 AbstractUser getOwner()
           
 EventType getRewardEvent()
           
 String getSubversionRevision()
           Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.
 String getTitle()
           
 boolean isEmpty()
           
 Iterator<InventoryItem> iterator()
           
 void redeemCollectionForUser(AbstractUser user)
           twheys@gmail.com Mar 9, 2010
 boolean remove(Object o)
           
 boolean removeAll(Collection<?> c)
           
 boolean retainAll(Collection<?> c)
           
 void setOwner(AbstractUser newOwner)
           
 void setRewardEvent(EventType newRewardEvent)
           
 void setTitle(String newTitle)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] 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, equals, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Java serialization unique ID

See Also:
Constant Field Values

items

private final Set<InventoryItem> items
the items that this user has collected which are a part of this set


owner

private AbstractUser owner
the owner of this collection


title

private String title
the title of this set


rewardEvent

private EventType rewardEvent
WRITEME: Document this brpocock@star-hope.org

Constructor Detail

UserItemCollection

public UserItemCollection(RecordLoader<UserItemCollection> loader)
WRITEME: Document this constructor brpocock@star-hope.org

Parameters:
loader - WRITEME
Method Detail

add

public boolean add(InventoryItem e)
Specified by:
add in interface Collection<InventoryItem>
See Also:
Collection.add(java.lang.Object)

addAll

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

clear

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

contains

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

containsAll

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

getCacheableID

public int getCacheableID()
                   throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Specified by:
getCacheableID in interface DataRecord
Returns:
an unique ID number
Throws:
NotFoundException - if the item doesn't have a distinct numeric ID
See Also:
DataRecord.getCacheableID()

getCacheableIdent

public String getCacheableIdent()
                         throws NotFoundException
Description copied from interface: DataRecord
Note that all records must have either a numeric ID ( DataRecord.getCacheableID() or a string identifier ( DataRecord.getCacheableIdent() or both.

Specified by:
getCacheableIdent in interface DataRecord
Returns:
an unique identifier string
Throws:
NotFoundException - if the item doesn't have a distinct string identifier
See Also:
DataRecord.getCacheableIdent()

getItems

public Collection<InventoryItem> getItems()
Returns:
the set of Items in this collection. Should return a HashSet.

getOwner

public AbstractUser getOwner()
Returns:
the owner of this collection

getRewardEvent

public EventType getRewardEvent()
Returns:
the reward event for completing this collection

getSubversionRevision

public String getSubversionRevision()
Description copied from interface: HasSubversionRevision

Return the Subversion revision level of this class's source code file, as supplied via the special "$Rev: " sequence.

As an example,the Subversion revision string for this file is "$Rev: 1968 $"

 
 @Override
 public String getSubversionRevision () {
        return "$Rev: ";
 }
 

Specified by:
getSubversionRevision in interface HasSubversionRevision
Returns:
The Subversion revision level for this class's source code file.
See Also:
HasSubversionRevision.getSubversionRevision()

getTitle

public String getTitle()
Returns:
the name of this collection

isEmpty

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

iterator

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

redeemCollectionForUser

public void redeemCollectionForUser(AbstractUser user)
 twheys@gmail.com Mar 9, 2010
 
TO redeemCollectionForUser WRITEME...

Parameters:
user - WRITEME

remove

public boolean remove(Object o)
Specified by:
remove in interface Collection<InventoryItem>
See Also:
Collection.remove(java.lang.Object)

removeAll

public boolean removeAll(Collection<?> c)
Specified by:
removeAll in interface Collection<InventoryItem>
See Also:
Collection.removeAll(java.util.Collection)

retainAll

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

setOwner

public void setOwner(AbstractUser newOwner)
Parameters:
newOwner - the owner to set

setRewardEvent

public void setRewardEvent(EventType newRewardEvent)
Parameters:
newRewardEvent - the rewardEvent to set

setTitle

public void setTitle(String newTitle)
Parameters:
newTitle - the title to set

size

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

toArray

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

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<InventoryItem>
See Also:
java.util.Collection#toArray(T[])