net.wotonomy.datastore
Class DefaultDataView

java.lang.Object
  extended by java.util.Observable
      extended by net.wotonomy.datastore.DefaultDataView
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.List, DataView

public class DefaultDataView
extends java.util.Observable
implements DataView


Nested Class Summary
protected  class DefaultDataView.DataViewIterator
           
 
Field Summary
protected  java.util.List addedKeyList
           
protected  java.util.List addedObjectList
           
protected  DataSoup backingSoup
           
protected  boolean fullyLoaded
           
protected  java.util.List keyList
           
protected  java.util.List objectList
           
protected  java.util.List removedKeyList
           
protected  java.util.List removedObjectList
           
protected  java.util.Collection updatedObjects
           
 
Method Summary
 void add(int index, java.lang.Object o)
           
 boolean add(java.lang.Object o)
           
 boolean addAll(java.util.Collection c)
           
 boolean addAll(int index, java.util.Collection c)
           
 void clear()
           
 boolean commit()
          This method is called commit all changes to the DataView to its data store.
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection c)
           
 boolean equals(java.lang.Object o)
           
 java.lang.Object get(int i)
           
 DataKey getKeyForObject(java.lang.Object anObject)
          Returns the key for the specified object.
 java.lang.Object getObject()
           
 java.lang.Object getObjectForKey(DataKey aKey)
          Returns the object for the specified key.
 int hashCode()
           
 int indexOf(java.lang.Object o)
           
 boolean isEmpty()
           
 java.util.Iterator iterator()
           
 int lastIndexOf(java.lang.Object o)
           
 java.util.ListIterator listIterator()
           
 java.util.ListIterator listIterator(int index)
           
protected  void loadAllObjects()
           
 DataView query(java.lang.String aProperty, java.lang.Object beginKey, java.lang.Object endKey)
           
 java.lang.Object remove(int index)
           
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection c)
           
 boolean retainAll(java.util.Collection c)
           
 java.lang.Object set(int index, java.lang.Object element)
          Set completely replaces the object at the specified index with the specified object.
 int size()
           
 java.util.List subList(int fromIndex, int toIndex)
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] array)
           
 void update(java.lang.Object anObject)
          This method is called to notify the DataView that one of its objects has been modified and should be updated when the view is committed.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.wotonomy.datastore.DataView
addObserver, deleteObserver, deleteObservers
 

Field Detail

backingSoup

protected DataSoup backingSoup

objectList

protected java.util.List objectList

keyList

protected java.util.List keyList

addedObjectList

protected java.util.List addedObjectList

removedObjectList

protected java.util.List removedObjectList

addedKeyList

protected java.util.List addedKeyList

removedKeyList

protected java.util.List removedKeyList

updatedObjects

protected java.util.Collection updatedObjects

fullyLoaded

protected boolean fullyLoaded
Method Detail

get

public java.lang.Object get(int i)
Specified by:
get in interface java.util.List

indexOf

public int indexOf(java.lang.Object o)
Specified by:
indexOf in interface java.util.List

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Specified by:
lastIndexOf in interface java.util.List

loadAllObjects

protected void loadAllObjects()

getObject

public java.lang.Object getObject()

update

public void update(java.lang.Object anObject)
Description copied from interface: DataView
This method is called to notify the DataView that one of its objects has been modified and should be updated when the view is committed.

Specified by:
update in interface DataView

query

public DataView query(java.lang.String aProperty,
                      java.lang.Object beginKey,
                      java.lang.Object endKey)

commit

public boolean commit()
Description copied from interface: DataView
This method is called commit all changes to the DataView to its data store. The list elements may be refreshed from the datastore, although the list itself should remain unchanged.

Specified by:
commit in interface DataView
Returns:
True if the commit was successful, otherwise false.

getKeyForObject

public DataKey getKeyForObject(java.lang.Object anObject)
Description copied from interface: DataView
Returns the key for the specified object. If the object is not in the view, returns null.

Specified by:
getKeyForObject in interface DataView

getObjectForKey

public java.lang.Object getObjectForKey(DataKey aKey)
Description copied from interface: DataView
Returns the object for the specified key. If the key is not in the view, returns null.

Specified by:
getObjectForKey in interface DataView

size

public int size()
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection
Specified by:
isEmpty in interface java.util.List

clear

public void clear()
Specified by:
clear in interface java.util.Collection
Specified by:
clear in interface java.util.List

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection
Specified by:
hashCode in interface java.util.List
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection
Specified by:
equals in interface java.util.List
Overrides:
equals in class java.lang.Object

contains

public boolean contains(java.lang.Object o)
Specified by:
contains in interface java.util.Collection
Specified by:
contains in interface java.util.List

containsAll

public boolean containsAll(java.util.Collection c)
Specified by:
containsAll in interface java.util.Collection
Specified by:
containsAll in interface java.util.List

add

public boolean add(java.lang.Object o)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List

remove

public java.lang.Object remove(int index)
Specified by:
remove in interface java.util.List

remove

public boolean remove(java.lang.Object o)
Specified by:
remove in interface java.util.Collection
Specified by:
remove in interface java.util.List

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Set completely replaces the object at the specified index with the specified object. The new object is not marked as inserted, and the old object is not marked as deleted: the new object will be stored in the soup with the same key. The old object is returned.

Specified by:
set in interface java.util.List

add

public void add(int index,
                java.lang.Object o)
Specified by:
add in interface java.util.List

addAll

public boolean addAll(java.util.Collection c)
Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.List

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Specified by:
addAll in interface java.util.List

removeAll

public boolean removeAll(java.util.Collection c)
Specified by:
removeAll in interface java.util.Collection
Specified by:
removeAll in interface java.util.List

retainAll

public boolean retainAll(java.util.Collection c)
Specified by:
retainAll in interface java.util.Collection
Specified by:
retainAll in interface java.util.List

subList

public java.util.List subList(int fromIndex,
                              int toIndex)
Specified by:
subList in interface java.util.List

iterator

public java.util.Iterator iterator()
Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.List

listIterator

public java.util.ListIterator listIterator()
Specified by:
listIterator in interface java.util.List

listIterator

public java.util.ListIterator listIterator(int index)
Specified by:
listIterator in interface java.util.List

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List

toArray

public java.lang.Object[] toArray(java.lang.Object[] array)
Specified by:
toArray in interface java.util.Collection
Specified by:
toArray in interface java.util.List


Copyright © 2006 null. All Rights Reserved.