org.netbeans.mdr.persistence.btreeimpl.btreestorage
Class VirtualList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byorg.netbeans.mdr.persistence.btreeimpl.btreestorage.VirtualList
All Implemented Interfaces:
java.util.Collection, java.util.List

public class VirtualList
extends java.util.AbstractList

An implementation of List which uses a btree database as a backing store. This allows arrays which which not otherwise fit in memory. To use a Virtual List:

  1. First create it with VirtualList(String name). This will create a btree database with the given name to hold the list elements.
  2. After an entry changes, call VirtualList.changed(index) to ensure that the changed version is written out to the repository.
  3. When done, call VirtualArray.delete() to delete the backing repository
Note that objects in the list must be Streamable.


Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
VirtualList(java.util.Map properties, ObjectResolver resolver)
           
VirtualList(java.lang.String fileName, ObjectResolver resolver)
          Create a VirtualList
 
Method Summary
 void add(int index, java.lang.Object element)
          Add a new element to the list
 void changed(int index)
          mark the elemenet at the given index changed
 void delete()
          Delete the VirtualList's backing repository
 java.lang.Object get(int index)
          Get the specified element
 java.lang.Object remove(int index)
          Remove ana element from the list
 java.lang.Object set(int index, java.lang.Object element)
          Set the element at the specified index
 int size()
          Get the number of elements in the list
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

VirtualList

public VirtualList(java.lang.String fileName,
                   ObjectResolver resolver)
Create a VirtualList


VirtualList

public VirtualList(java.util.Map properties,
                   ObjectResolver resolver)
Method Detail

delete

public void delete()
Delete the VirtualList's backing repository


get

public java.lang.Object get(int index)
Get the specified element

Parameters:
index - The index of the element to get
Returns:
the element at the specified index

size

public int size()
Get the number of elements in the list


set

public java.lang.Object set(int index,
                            java.lang.Object element)
Set the element at the specified index

Parameters:
index - the index to set
element - the element to set the index to
Returns:
the element formerly at that index

add

public void add(int index,
                java.lang.Object element)
Add a new element to the list

Parameters:
element - the element to add

remove

public java.lang.Object remove(int index)
Remove ana element from the list

Parameters:
index - Where to remove the element
Returns:
the element removed.

changed

public void changed(int index)
mark the elemenet at the given index changed



Copyright © 2005-2007 Apache Software Foundation. All Rights Reserved.