Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.k_int.IR
Class ReadAheadEnumeration  view ReadAheadEnumeration download ReadAheadEnumeration.java

java.lang.Object
  extended bycom.k_int.IR.ReadAheadEnumeration
All Implemented Interfaces:
AsynchronousEnumeration, java.util.Enumeration

public class ReadAheadEnumeration
extends java.lang.Object
implements AsynchronousEnumeration

Enumerate the result records from an InformationFragmentSource. As normal FragmentSourceEnumeration, but caches chunks of records as presented by target. E.G. Fetch chunk_size rows, getNext returns 1,2,3,4... on 11, calls fetch again. And don't I wish I called it iterator instead....


Field Summary
private static LoggingContext cat
           
private  int chunk_size
           
private  int current_element
           
private  boolean fetching
           
private  java.util.LinkedList fragment_cache
           
private  int min_cache_size
           
private  int next_record_timeout
           
private  int next_to_request
           
private  java.lang.ref.WeakReference notification_target
           
(package private)  IFSNotificationTarget rae_present_callback_handler
           
private  InformationFragmentSource source
           
private  RecordFormatSpecification spec
           
 
Constructor Summary
private ReadAheadEnumeration()
           
  ReadAheadEnumeration(InformationFragmentSource source)
           
  ReadAheadEnumeration(InformationFragmentSource source, int chunk_size)
           
  ReadAheadEnumeration(InformationFragmentSource source, RecordFormatSpecification spec)
           
  ReadAheadEnumeration(InformationFragmentSource source, RecordFormatSpecification spec, int chunk_size, int next_record_timeout, java.lang.Object notification_target)
           
  ReadAheadEnumeration(InformationFragmentSource source, RecordFormatSpecification spec, java.lang.Object notification_target)
           
 
Method Summary
private  void checkCache()
           
 IRStatusReport getStatus()
           
 boolean hasMoreElements()
          Tests whether there are elements remaining in the enumeration.
 java.lang.Object nextElement()
          Obtain the next element in the enumeration.
 boolean nextIsAvailable()
          We know that there will be a next record in this set, is it available yet?
 void registerNotificationTarget(java.lang.Object o)
          Register an object to be notified when a next object is available
private  void requestRecords()
           
 void waitForNextRecord(int timeout)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private InformationFragmentSource source

current_element

private int current_element

min_cache_size

private int min_cache_size

fragment_cache

private java.util.LinkedList fragment_cache

fetching

private boolean fetching

chunk_size

private int chunk_size

spec

private RecordFormatSpecification spec

next_to_request

private int next_to_request

next_record_timeout

private int next_record_timeout

notification_target

private java.lang.ref.WeakReference notification_target

cat

private static LoggingContext cat

rae_present_callback_handler

IFSNotificationTarget rae_present_callback_handler
Constructor Detail

ReadAheadEnumeration

private ReadAheadEnumeration()

ReadAheadEnumeration

public ReadAheadEnumeration(InformationFragmentSource source)

ReadAheadEnumeration

public ReadAheadEnumeration(InformationFragmentSource source,
                            int chunk_size)

ReadAheadEnumeration

public ReadAheadEnumeration(InformationFragmentSource source,
                            RecordFormatSpecification spec,
                            java.lang.Object notification_target)

ReadAheadEnumeration

public ReadAheadEnumeration(InformationFragmentSource source,
                            RecordFormatSpecification spec)

ReadAheadEnumeration

public ReadAheadEnumeration(InformationFragmentSource source,
                            RecordFormatSpecification spec,
                            int chunk_size,
                            int next_record_timeout,
                            java.lang.Object notification_target)
Method Detail

hasMoreElements

public boolean hasMoreElements()
Description copied from interface: java.util.Enumeration
Tests whether there are elements remaining in the enumeration.

Specified by:
hasMoreElements in interface java.util.Enumeration

nextElement

public java.lang.Object nextElement()
Description copied from interface: java.util.Enumeration
Obtain the next element in the enumeration.

Specified by:
nextElement in interface java.util.Enumeration

checkCache

private void checkCache()

requestRecords

private void requestRecords()

nextIsAvailable

public boolean nextIsAvailable()
Description copied from interface: AsynchronousEnumeration
We know that there will be a next record in this set, is it available yet?

Specified by:
nextIsAvailable in interface AsynchronousEnumeration

getStatus

public IRStatusReport getStatus()
Specified by:
getStatus in interface AsynchronousEnumeration

waitForNextRecord

public void waitForNextRecord(int timeout)

registerNotificationTarget

public void registerNotificationTarget(java.lang.Object o)
Description copied from interface: AsynchronousEnumeration
Register an object to be notified when a next object is available

Specified by:
registerNotificationTarget in interface AsynchronousEnumeration