org.neodatis.odb.impl.core.query.list.objects
Class AbstractBTreeCollection<E>

java.lang.Object
  extended by org.neodatis.odb.impl.core.query.list.objects.AbstractBTreeCollection<E>
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<E>, java.util.Collection<E>, Objects<E>
Direct Known Subclasses:
InMemoryBTreeCollection, InMemoryBTreeCollectionForValues, LazyBTreeCollection

public abstract class AbstractBTreeCollection<E>
extends java.lang.Object
implements Objects<E>, java.io.Serializable

A collection that uses a BTree as an underlying system to provide ordered by Collections

See Also:
Serialized Form

Constructor Summary
AbstractBTreeCollection()
           
AbstractBTreeCollection(int size, OrderByConstants orderByType)
           
 
Method Summary
 boolean add(E o)
           
 boolean addAll(java.util.Collection<? extends E> collection)
           
 boolean addWithKey(int key, E o)
          Adds the object in the btree with the specific key
 boolean addWithKey(OdbComparable key, E o)
          Adds the object in the btree with the specific key
abstract  IBTree buildTree(int degree)
           
 void clear()
           
 boolean contains(java.lang.Object o)
           
 boolean containsAll(java.util.Collection collection)
           
 E getFirst()
          Return the first object of the collection, if exist
protected  OrderByConstants getOrderByType()
           
protected  IBTree getTree()
           
 boolean hasNext()
          Inform if the internal Iterator has more objects
 boolean isEmpty()
           
 java.util.Iterator<E> iterator()
           
 java.util.Iterator<E> iterator(OrderByConstants newOrderByType)
          Returns the collection iterator throughout the order by OrderByConstants
 E next()
          Returns the next object of the internal iterator of the collection
 boolean remove(java.lang.Object o)
           
 boolean removeAll(java.util.Collection collection)
           
 boolean removeByKey(OdbComparable key, java.lang.Object value)
          Removes an object by its key
 void reset()
          Reset the internal iterator of the collection
 boolean retainAll(java.util.Collection collection)
           
 int size()
           
 java.lang.Object[] toArray()
           
 java.lang.Object[] toArray(java.lang.Object[] objects)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

AbstractBTreeCollection

public AbstractBTreeCollection(int size,
                               OrderByConstants orderByType)

AbstractBTreeCollection

public AbstractBTreeCollection()
Method Detail

buildTree

public abstract IBTree buildTree(int degree)

getFirst

public E getFirst()
Description copied from interface: Objects
Return the first object of the collection, if exist

Specified by:
getFirst in interface Objects<E>
Returns:

hasNext

public boolean hasNext()
Description copied from interface: Objects
Inform if the internal Iterator has more objects

Specified by:
hasNext in interface Objects<E>
Returns:

next

public E next()
Description copied from interface: Objects
Returns the next object of the internal iterator of the collection

Specified by:
next in interface Objects<E>
Returns:

add

public boolean add(E o)
Specified by:
add in interface java.util.Collection<E>

addWithKey

public boolean addWithKey(OdbComparable key,
                          E o)
Adds the object in the btree with the specific key

Specified by:
addWithKey in interface Objects<E>
Parameters:
key -
o -
Returns:

addWithKey

public boolean addWithKey(int key,
                          E o)
Adds the object in the btree with the specific key

Specified by:
addWithKey in interface Objects<E>
Parameters:
key -
o -
Returns:

addAll

public boolean addAll(java.util.Collection<? extends E> collection)
Specified by:
addAll in interface java.util.Collection<E>

clear

public void clear()
Specified by:
clear in interface java.util.Collection<E>

contains

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

containsAll

public boolean containsAll(java.util.Collection collection)
Specified by:
containsAll in interface java.util.Collection<E>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<E>

iterator

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

iterator

public java.util.Iterator<E> iterator(OrderByConstants newOrderByType)
Description copied from interface: Objects
Returns the collection iterator throughout the order by OrderByConstants

Specified by:
iterator in interface Objects<E>
Returns:

remove

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

removeByKey

public boolean removeByKey(OdbComparable key,
                           java.lang.Object value)
Description copied from interface: Objects
Removes an object by its key

Specified by:
removeByKey in interface Objects<E>
value - The object to be removed
Returns:
true if object has been removed

removeAll

public boolean removeAll(java.util.Collection collection)
Specified by:
removeAll in interface java.util.Collection<E>

retainAll

public boolean retainAll(java.util.Collection collection)
Specified by:
retainAll in interface java.util.Collection<E>

size

public int size()
Specified by:
size in interface java.util.Collection<E>

toArray

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

toArray

public java.lang.Object[] toArray(java.lang.Object[] objects)
Specified by:
toArray in interface java.util.Collection<E>

reset

public void reset()
Description copied from interface: Objects
Reset the internal iterator of the collection

Specified by:
reset in interface Objects<E>

getOrderByType

protected OrderByConstants getOrderByType()

getTree

protected IBTree getTree()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object