com.orientechnologies.jdo.types
Class d_Collection

java.lang.Object
  extended bycom.orientechnologies.jdo.types.d_Collection
Direct Known Subclasses:
d_Dictionary

public class d_Collection
extends java.lang.Object

Base class for persistent collections. It breaks collections in persistent oCollBlock objects mantaining references and totals.


Field Summary
 short blocks
           
 short blockSize
           
 oCollBlock head
           
protected  boolean relationship
           
 oCollBlock tail
           
 int total
           
 
Constructor Summary
d_Collection()
          Create a Collection.
d_Collection(oPersistenceManager iManager, boolean iRelationship)
          Create a Collection.
 
Method Summary
 void clear()
          Clear the content of the collection.
 boolean contains(java.lang.Object iFind)
          Check if an element exists in the collection
 int find(java.lang.Object iFind)
          Find the position of an element in the collection
 void fromCollection(java.util.Collection iColl)
          Copy all the content from another collection.
 java.lang.Object get(int iIndex)
          Get an element by index
 void insert_element(java.lang.Object iElem)
          Insert an element in the collection.
 boolean isEmpty()
          Returns if the collection is empty.
 boolean isRelationship()
          Returns if the collection contains relationships
 java.util.Iterator iterator()
          Retrieve an iterator for the collection
 java.lang.Object remove(int iIndex)
          Remove an element by index
 java.lang.Object remove(java.lang.Object iFind)
          Remove an element from the collection
 void setRelationship(boolean iRelationship)
          Change the behaviuor to handle relationships
 int size()
          Returns the size of collection.
 void toCollection(java.util.Collection iColl)
          Copy all the content to another collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blockSize

public short blockSize

head

public oCollBlock head

tail

public oCollBlock tail

blocks

public short blocks

total

public int total

relationship

protected transient boolean relationship
Constructor Detail

d_Collection

public d_Collection()
Create a Collection.


d_Collection

public d_Collection(oPersistenceManager iManager,
                    boolean iRelationship)
Create a Collection.

Parameters:
iManager - PersistenceManager associated
iRelationship - true if the collection contains relationships
Method Detail

fromCollection

public void fromCollection(java.util.Collection iColl)
Copy all the content from another collection. The content will be updated with current values.

Parameters:
iColl - collection to copy

toCollection

public void toCollection(java.util.Collection iColl)
Copy all the content to another collection.

Parameters:
iColl - collection where to copy.

contains

public boolean contains(java.lang.Object iFind)
Check if an element exists in the collection

Parameters:
iFind - Object to found
Returns:
true if the element is present, otherwise false

find

public int find(java.lang.Object iFind)
Find the position of an element in the collection

Parameters:
iFind - Object to found
Returns:
The position of the object in the collection, -1 if the object was not found

remove

public java.lang.Object remove(java.lang.Object iFind)
Remove an element from the collection

Parameters:
iFind - Object to found
Returns:
true if the object was found and removed, otherwise false

iterator

public java.util.Iterator iterator()
Retrieve an iterator for the collection

Returns:
iterator for the collection

clear

public void clear()
Clear the content of the collection.


insert_element

public void insert_element(java.lang.Object iElem)
Insert an element in the collection.


get

public java.lang.Object get(int iIndex)
Get an element by index

Parameters:
iIndex - index of value to get
Returns:
Object found if any

remove

public java.lang.Object remove(int iIndex)
Remove an element by index

Parameters:
iIndex - index of value to remove
Returns:
Object removed if any

size

public int size()
Returns the size of collection.

Returns:
the number of elements in the collection

isEmpty

public boolean isEmpty()
Returns if the collection is empty.

Returns:
true if the collection is empty, otherwise false

isRelationship

public boolean isRelationship()
Returns if the collection contains relationships

Returns:
true if the collection contains relationships, otherwise false

setRelationship

public void setRelationship(boolean iRelationship)
Change the behaviuor to handle relationships

Parameters:
iRelationship - true or false