org.trippi.impl.kowari
Class SimpleAnswer

java.lang.Object
  extended by org.trippi.impl.kowari.SimpleAnswer
All Implemented Interfaces:
java.lang.Cloneable, org.kowari.query.Answer, org.kowari.query.Cursor

public class SimpleAnswer
extends java.lang.Object
implements org.kowari.query.Answer

An Answer backed by an Iterator of Maps and a List of variable names, useful for testing.


Field Summary
 
Fields inherited from interface org.kowari.query.Cursor
MANY, ONE, ZERO
 
Constructor Summary
SimpleAnswer(java.util.Iterator maps, java.util.List names)
           
 
Method Summary
 void beforeFirst()
           
 java.lang.Object clone()
           
 void close()
           
 int getColumnIndex(org.kowari.query.Variable column)
          Find the index of a variable.
 int getNumberOfVariables()
          Return the number of variables (columns).
 java.lang.Object getObject(int column)
           
 java.lang.Object getObject(java.lang.String columnName)
           
 int getRowCardinality()
           
 long getRowCount()
           
 long getRowUpperBound()
           
 org.kowari.query.Variable[] getVariables()
           
 boolean isUnconstrained()
           
 boolean next()
          Move to the next row.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleAnswer

public SimpleAnswer(java.util.Iterator maps,
                    java.util.List names)
             throws org.kowari.query.TuplesException
Throws:
org.kowari.query.TuplesException
Method Detail

getObject

public java.lang.Object getObject(int column)
                           throws org.kowari.query.TuplesException
Specified by:
getObject in interface org.kowari.query.Answer
Throws:
org.kowari.query.TuplesException

getObject

public java.lang.Object getObject(java.lang.String columnName)
                           throws org.kowari.query.TuplesException
Specified by:
getObject in interface org.kowari.query.Answer
Throws:
org.kowari.query.TuplesException

beforeFirst

public void beforeFirst()
                 throws org.kowari.query.TuplesException
Specified by:
beforeFirst in interface org.kowari.query.Cursor
Throws:
org.kowari.query.TuplesException

close

public void close()
           throws org.kowari.query.TuplesException
Specified by:
close in interface org.kowari.query.Cursor
Throws:
org.kowari.query.TuplesException

getColumnIndex

public int getColumnIndex(org.kowari.query.Variable column)
                   throws org.kowari.query.TuplesException
Find the index of a variable.

Specified by:
getColumnIndex in interface org.kowari.query.Cursor
Returns:
the ColumnIndex value
Throws:
org.kowari.query.TuplesException

getNumberOfVariables

public int getNumberOfVariables()
Return the number of variables (columns).

Specified by:
getNumberOfVariables in interface org.kowari.query.Cursor

getVariables

public org.kowari.query.Variable[] getVariables()
Specified by:
getVariables in interface org.kowari.query.Cursor

isUnconstrained

public boolean isUnconstrained()
                        throws org.kowari.query.TuplesException
Specified by:
isUnconstrained in interface org.kowari.query.Cursor
Throws:
org.kowari.query.TuplesException

getRowCount

public long getRowCount()
                 throws org.kowari.query.TuplesException
Specified by:
getRowCount in interface org.kowari.query.Cursor
Throws:
org.kowari.query.TuplesException

getRowUpperBound

public long getRowUpperBound()
                      throws org.kowari.query.TuplesException
Specified by:
getRowUpperBound in interface org.kowari.query.Cursor
Throws:
org.kowari.query.TuplesException

getRowCardinality

public int getRowCardinality()
                      throws org.kowari.query.TuplesException
Specified by:
getRowCardinality in interface org.kowari.query.Cursor
Throws:
org.kowari.query.TuplesException

next

public boolean next()
             throws org.kowari.query.TuplesException
Move to the next row. If no such row exists, return false and the current row becomes unspecified. The current row is unspecified when an instance is created. To specify the current row, the beforeFirst() method must be invoked.

Specified by:
next in interface org.kowari.query.Cursor
Returns:
whether a subsequent row exists.
Throws:
org.kowari.query.TuplesException

clone

public java.lang.Object clone()
Specified by:
clone in interface org.kowari.query.Answer
Overrides:
clone in class java.lang.Object