uk.ac.ic.doc.automed.p2p.util.topk
Class RecordStream

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.util.topk.RecordStream

public class RecordStream
extends java.lang.Object


Field Summary
private static int BUFFER_SIZE
           
static java.lang.String COL_ID
           
static java.lang.String COL_SCORE
           
private  java.util.Map columnMap
           
private  java.util.Map currRow
           
private  DBAccess dba
           
private  boolean debug
           
private static java.util.Map defColMap
           
private static java.lang.String GREATER_THAN_EQUAL
           
private  java.lang.String id
           
private  java.lang.StringBuffer idbuf
           
private  java.util.Stack idCache
           
private static java.lang.String LESS_THAN_EQUAL
           
private  java.lang.String orderBy
           
private  ListMap page
           
private  java.util.Collection processedRows
           
private  java.lang.String qPre
           
private  java.lang.String qSuf
           
private  java.lang.String qSufScore
           
private  java.lang.String table
           
private  java.lang.Object ubScore
           
 
Constructor Summary
  RecordStream(java.lang.String id, DBAccess dba, java.lang.String table, java.lang.Object ubScore)
           
private RecordStream(java.lang.String id, DBAccess dba, java.lang.String table, java.lang.Object ubScore, ListMap page, java.util.Map currRow, java.util.Map columnMap, java.lang.String orderBy)
           
  RecordStream(java.lang.String id, DBAccess dba, java.lang.String table, java.lang.Object ubScore, java.util.Map columnMap)
           
  RecordStream(java.lang.String id, DBAccess dba, java.lang.String table, java.lang.Object ubScore, java.util.Map columnMap, java.lang.String orderBy)
           
 
Method Summary
private  void add(java.lang.Object id, java.lang.Object row, boolean cacheID)
           
protected  void addProcessed(java.lang.Object row)
          record a row that has successfully processed by the top-k algorithm
 RecordStream copy()
           
 boolean equals(java.lang.Object other)
           
 java.util.Map first()
          Move to the first row
 java.util.Map getByID(int recID)
          Retrieve a record by its identifier
 java.util.Map getByScore(java.lang.Object currScore, java.lang.String sign, int limit)
          Get the next row using an existing score
 java.lang.String getColumnName(java.lang.String name)
           
 java.util.Map getCurrent()
          Return the currently active record
 java.lang.String getID()
           
 java.lang.String getName()
           
 java.lang.Object getUpperBoundScore()
           
 int hashCode()
           
 boolean hasNext()
          Attempts to read the next record without placing it into buffer
 java.util.Map next()
          Return a Map of the record values.
 void reset()
          Reset pointer to the start of the stream, but avoiding rows that have successfully been processed
 void setUpperBoundScore(java.lang.Object ubScore)
          Update the upper-bound score of this input stream.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

private boolean debug

dba

private DBAccess dba

table

private java.lang.String table

id

private java.lang.String id

ubScore

private java.lang.Object ubScore

BUFFER_SIZE

private static final int BUFFER_SIZE
See Also:
Constant Field Values

currRow

private java.util.Map currRow

page

private ListMap page

idCache

private java.util.Stack idCache

idbuf

private java.lang.StringBuffer idbuf

processedRows

private java.util.Collection processedRows

columnMap

private java.util.Map columnMap

defColMap

private static final java.util.Map defColMap

COL_ID

public static final java.lang.String COL_ID
See Also:
Constant Field Values

COL_SCORE

public static final java.lang.String COL_SCORE
See Also:
Constant Field Values

LESS_THAN_EQUAL

private static final java.lang.String LESS_THAN_EQUAL
See Also:
Constant Field Values

GREATER_THAN_EQUAL

private static final java.lang.String GREATER_THAN_EQUAL
See Also:
Constant Field Values

qPre

private java.lang.String qPre

qSuf

private java.lang.String qSuf

qSufScore

private java.lang.String qSufScore

orderBy

private java.lang.String orderBy
Constructor Detail

RecordStream

public RecordStream(java.lang.String id,
                    DBAccess dba,
                    java.lang.String table,
                    java.lang.Object ubScore)

RecordStream

public RecordStream(java.lang.String id,
                    DBAccess dba,
                    java.lang.String table,
                    java.lang.Object ubScore,
                    java.util.Map columnMap)

RecordStream

public RecordStream(java.lang.String id,
                    DBAccess dba,
                    java.lang.String table,
                    java.lang.Object ubScore,
                    java.util.Map columnMap,
                    java.lang.String orderBy)

RecordStream

private RecordStream(java.lang.String id,
                     DBAccess dba,
                     java.lang.String table,
                     java.lang.Object ubScore,
                     ListMap page,
                     java.util.Map currRow,
                     java.util.Map columnMap,
                     java.lang.String orderBy)
Method Detail

setUpperBoundScore

public void setUpperBoundScore(java.lang.Object ubScore)
Update the upper-bound score of this input stream.

Parameters:
ubScore -

getUpperBoundScore

public java.lang.Object getUpperBoundScore()

addProcessed

protected void addProcessed(java.lang.Object row)
record a row that has successfully processed by the top-k algorithm

Parameters:
row -

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getID

public java.lang.String getID()

first

public java.util.Map first()
Move to the first row


next

public java.util.Map next()
Return a Map of the record values.


hasNext

public boolean hasNext()
Attempts to read the next record without placing it into buffer

Returns:

reset

public void reset()
Reset pointer to the start of the stream, but avoiding rows that have successfully been processed


getCurrent

public java.util.Map getCurrent()
Return the currently active record

Returns:

getByID

public java.util.Map getByID(int recID)
Retrieve a record by its identifier

Parameters:
recID -
Returns:

add

private void add(java.lang.Object id,
                 java.lang.Object row,
                 boolean cacheID)

getByScore

public java.util.Map getByScore(java.lang.Object currScore,
                                java.lang.String sign,
                                int limit)
Get the next row using an existing score

Returns:

copy

public RecordStream copy()

getColumnName

public java.lang.String getColumnName(java.lang.String name)

getName

public java.lang.String getName()

toString

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