org.backsource.xindice.cursor
Class BaseCursor

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended byorg.backsource.xindice.cursor.BaseCursor
All Implemented Interfaces:
java.util.Collection, Cursor, java.util.List
Direct Known Subclasses:
KeyCursor, SortedCursor

public abstract class BaseCursor
extends java.util.AbstractList
implements Cursor

A base class for cursor working against other cursors.

This is a template class, in that subclasses must follow a certain pattern to use this as its parent. This is a greedy cursor, that expects its subclasses to swallow its source in first invokation. A subclass is expected to do its work in the swallow method. When the mothod returns it must have created an ArrayList with its result put into it.

  public void swallow() throws XindiceException {
    store = new ArrayList();
    //Use source.iterator() to get source content
    // transform
    // put into store
  }

Version:
$Revision: 1.1.1.1 $
Author:
Peter Antman

Field Summary
protected  Cursor cursor
           
protected  java.util.ArrayList store
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
BaseCursor(Cursor cursor)
          Use given cursor as source.
BaseCursor(org.xmldb.api.base.ResourceSet set)
          Construct a source cursor around the ResourceSet.
 
Method Summary
 java.lang.Object get(int i)
           
 void setSource(Cursor cursor)
           
 int size()
           
protected abstract  void swallow()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, 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
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Field Detail

cursor

protected Cursor cursor

store

protected java.util.ArrayList store
Constructor Detail

BaseCursor

public BaseCursor(org.xmldb.api.base.ResourceSet set)
Construct a source cursor around the ResourceSet.


BaseCursor

public BaseCursor(Cursor cursor)
Use given cursor as source.

Method Detail

setSource

public void setSource(Cursor cursor)
               throws XindiceException
Specified by:
setSource in interface Cursor
Throws:
XindiceException

get

public java.lang.Object get(int i)
                     throws java.lang.IndexOutOfBoundsException,
                            java.lang.IllegalStateException
Specified by:
get in interface java.util.List
Throws:
java.lang.IndexOutOfBoundsException
java.lang.IllegalStateException

size

public int size()
         throws java.lang.IllegalStateException
Specified by:
size in interface java.util.List
Throws:
java.lang.IllegalStateException

swallow

protected abstract void swallow()
                         throws XindiceException
Throws:
XindiceException


Copyright © 2003-2004 Backsource. All Rights Reserved.