Java Doc for Cursor.java in  » Database-Client » Jackcess » com » healthmarketscience » jackcess » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » Jackcess » com.healthmarketscience.jackcess 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.healthmarketscience.jackcess.Cursor

Cursor
abstract public class Cursor implements Iterable<Map<String, Object>>(Code)
Manages iteration for a Table. Different cursors provide different methods of traversing a table. Cursors should be fairly robust in the face of table modification during traversal (although depending on how the table is traversed, row updates may or may not be seen). Multiple cursors may traverse the same table simultaneously.

The Cursor provides a variety of static utility methods to construct cursors with given characteristics or easily search for specific values. For even friendlier and more flexible construction, see CursorBuilder .

Is not thread-safe.
author:
   james


Inner Class :abstract protected class DirHandler
Inner Class :final public static class Id
Inner Class :final public static class Savepoint
Inner Class :abstract public static class Position


Constructor Summary
protected  Cursor(Id id, Table table, Position firstPos, Position lastPos)
    

Method Summary
public  voidafterLast()
     Resets this cursor for reverse traversal (sets cursor to after the last row).
public  voidbeforeFirst()
     Resets this cursor for forward traversal (sets cursor to before the first row).
public static  CursorcreateCursor(Table table)
     Creates a normal, un-indexed cursor for the given table.
public static  CursorcreateIndexCursor(Table table, Index index)
     Creates an indexed cursor for the given table.
public static  CursorcreateIndexCursor(Table table, Index index, Object[] startRow, Object[] endRow)
     Creates an indexed cursor for the given table, narrowed to the given range.
public static  CursorcreateIndexCursor(Table table, Index index, Object[] startRow, boolean startInclusive, Object[] endRow, boolean endInclusive)
     Creates an indexed cursor for the given table, narrowed to the given range.
public  booleancurrentRowMatches(Column columnPattern, Object valuePattern)
     Returns true if the current row matches the given pattern.
public  booleancurrentRowMatches(Map<String, Object> rowPattern)
     Returns true if the current row matches the given pattern.
public  voiddeleteCurrentRow()
     Delete the current row.
abstract protected  PositionfindAnotherPosition(RowState rowState, Position curPos, boolean moveForward)
     Finds the next non-deleted row after the given row (as defined by this cursor) and returns the id of the row, where "next" may be backwards if moveForward is false .
public static  Map<String, Object>findRow(Table table, Map<String, Object> rowPattern)
     Convenience method for finding a specific row in a table which matches a given row "pattern".
public static  Map<String, Object>findRow(Table table, Index index, Map<String, Object> rowPattern)
     Convenience method for finding a specific row in an indexed table which matches a given row "pattern".
public  booleanfindRow(Column columnPattern, Object valuePattern)
     Moves to the first row (as defined by the cursor) where the given column has the given value.
public  booleanfindRow(Map<String, Object> rowPattern)
     Moves to the first row (as defined by the cursor) where the given columns have the given values.
protected  booleanfindRowImpl(Column columnPattern, Object valuePattern)
     Moves to the first row (as defined by the cursor) where the given column has the given value.
protected  booleanfindRowImpl(Map<String, Object> rowPattern)
     Moves to the first row (as defined by the cursor) where the given columns have the given values.
public static  ObjectfindValue(Table table, Column column, Column columnPattern, Object valuePattern)
     Convenience method for finding a specific row in a table which matches a given row "pattern".
public static  ObjectfindValue(Table table, Index index, Column column, Column columnPattern, Object valuePattern)
     Convenience method for finding a specific row in a table which matches a given row "pattern".
public  Map<String, Object>getCurrentRow()
     Returns the current row in this cursor (Column name -> Column value).
public  Map<String, Object>getCurrentRow(Collection<String> columnNames)
     Returns the current row in this cursor (Column name -> Column value).
public  ObjectgetCurrentRowValue(Column column)
     Returns the given column from the current row.
abstract protected  DirHandlergetDirHandler(boolean moveForward)
     Returns the DirHandler for the given movement direction.
protected  PositiongetFirstPosition()
     Returns the first row id (exclusive) as defined by this cursor.
public  JetFormatgetFormat()
    
public  IdgetId()
    
public  IndexgetIndex()
    
protected  PositiongetLastPosition()
     Returns the last row id (exclusive) as defined by this cursor.
public  Map<String, Object>getNextRow()
     Moves to the next row in the table and returns it.
public  Map<String, Object>getNextRow(Collection<String> columnNames)
     Moves to the next row in the table and returns it.
public  PageChannelgetPageChannel()
    
public  Map<String, Object>getPreviousRow()
     Moves to the previous row in the table and returns it.
public  Map<String, Object>getPreviousRow(Collection<String> columnNames)
     Moves to the previous row in the table and returns it.
public  SavepointgetSavepoint()
     Returns the current state of the cursor which can be restored at a future point in time by a call to Cursor.restoreSavepoint .
public  TablegetTable()
    
public  booleanisAfterLast()
     Returns true if the cursor is currently positioned after the last row, false otherwise.
public  booleanisBeforeFirst()
     Returns true if the cursor is currently positioned before the first row, false otherwise.
public  booleanisCurrentRowDeleted()
     Returns true if the row at which the cursor is currently positioned is deleted, false otherwise (including invalid rows).
protected  booleanisUpToDate()
     Returns true if this cursor is up-to-date with respect to the relevant table and related table objects, false otherwise.
public  Iterable<Map<String, Object>>iterable(Collection<String> columnNames)
    
public  Iterator<Map<String, Object>>iterator()
     Calls beforeFirst on this cursor and returns an unmodifiable Iterator which will iterate through all the rows of this table.
public  Iterator<Map<String, Object>>iterator(Collection<String> columnNames)
     Calls beforeFirst on this table and returns an unmodifiable Iterator which will iterate through all the rows of this table, returning only the given columns.
public  intmoveNextRows(int numRows)
     Moves forward as many rows as possible up to the given number of rows.
public  intmovePreviousRows(int numRows)
     Moves backward as many rows as possible up to the given number of rows.
public  booleanmoveToNextRow()
     Moves to the next row as defined by this cursor.
public  booleanmoveToPreviousRow()
     Moves to the previous row as defined by this cursor.
public  voidreset()
     Resets this cursor for forward traversal.
protected  voidreset(boolean moveForward)
     Resets this cursor for traversing the given direction.
protected  voidrestorePosition(Position curPos)
     Restores a current position for the cursor (current position becomes previous position).
final protected  voidrestorePosition(Position curPos, Position prevPos)
     Restores a current and previous position for the cursor if the given positions are different from the current positions.
protected  voidrestorePositionImpl(Position curPos, Position prevPos)
     Restores a current and previous position for the cursor.
public  voidrestoreSavepoint(Savepoint savepoint)
     Moves the cursor to a savepoint previously returned from Cursor.getSavepoint .
public  Iterable<Map<String, Object>>reverseIterable()
     Returns an Iterable whose iterator() method calls afterLast on this cursor and returns an unmodifiable Iterator which will iterate through all the rows of this table in reverse order.
public  Iterable<Map<String, Object>>reverseIterable(Collection<String> columnNames)
     Returns an Iterable whose iterator() method calls afterLast on this table and returns an unmodifiable Iterator which will iterate through all the rows of this table in reverse order, returning only the given columns.
public  StringtoString()
    


Constructor Detail
Cursor
protected Cursor(Id id, Table table, Position firstPos, Position lastPos)(Code)




Method Detail
afterLast
public void afterLast()(Code)
Resets this cursor for reverse traversal (sets cursor to after the last row).



beforeFirst
public void beforeFirst()(Code)
Resets this cursor for forward traversal (sets cursor to before the first row).



createCursor
public static Cursor createCursor(Table table)(Code)
Creates a normal, un-indexed cursor for the given table.
Parameters:
  table - the table over which this cursor will traverse



createIndexCursor
public static Cursor createIndexCursor(Table table, Index index) throws IOException(Code)
Creates an indexed cursor for the given table.
Parameters:
  table - the table over which this cursor will traverse
Parameters:
  index - index for the table which will define traversal order aswell as enhance certain lookups



createIndexCursor
public static Cursor createIndexCursor(Table table, Index index, Object[] startRow, Object[] endRow) throws IOException(Code)
Creates an indexed cursor for the given table, narrowed to the given range.
Parameters:
  table - the table over which this cursor will traverse
Parameters:
  index - index for the table which will define traversal order aswell as enhance certain lookups
Parameters:
  startRow - the first row of data for the cursor (inclusive), or null for the first entry
Parameters:
  endRow - the last row of data for the cursor (inclusive), or null for the last entry



createIndexCursor
public static Cursor createIndexCursor(Table table, Index index, Object[] startRow, boolean startInclusive, Object[] endRow, boolean endInclusive) throws IOException(Code)
Creates an indexed cursor for the given table, narrowed to the given range.
Parameters:
  table - the table over which this cursor will traverse
Parameters:
  index - index for the table which will define traversal order aswell as enhance certain lookups
Parameters:
  startRow - the first row of data for the cursor, or null forthe first entry
Parameters:
  startInclusive - whether or not startRow is inclusive or exclusive
Parameters:
  endRow - the last row of data for the cursor, or null forthe last entry
Parameters:
  endInclusive - whether or not endRow is inclusive or exclusive



currentRowMatches
public boolean currentRowMatches(Column columnPattern, Object valuePattern) throws IOException(Code)
Returns true if the current row matches the given pattern.
Parameters:
  columnPattern - column from the table for this cursor which is beingmatched by the valuePattern
Parameters:
  valuePattern - value which is tested for equality with thecorresponding value in the current row



currentRowMatches
public boolean currentRowMatches(Map<String, Object> rowPattern) throws IOException(Code)
Returns true if the current row matches the given pattern.
Parameters:
  rowPattern - column names and values which must be equal to thecorresponding values in the current row



deleteCurrentRow
public void deleteCurrentRow() throws IOException(Code)
Delete the current row.
throws:
  IllegalStateException - if the current row is not valid (atbeginning or end of table), or already deleted.



findAnotherPosition
abstract protected Position findAnotherPosition(RowState rowState, Position curPos, boolean moveForward) throws IOException(Code)
Finds the next non-deleted row after the given row (as defined by this cursor) and returns the id of the row, where "next" may be backwards if moveForward is false . If there are no more rows, the returned rowId should equal the value returned by Cursor.getLastPosition if moving forward and Cursor.getFirstPosition if moving backward.



findRow
public static Map<String, Object> findRow(Table table, Map<String, Object> rowPattern) throws IOException(Code)
Convenience method for finding a specific row in a table which matches a given row "pattern". See Cursor.findRow(Map) for details on the rowPattern.
Parameters:
  table - the table to search
Parameters:
  rowPattern - pattern to be used to find the row the matching row or null if a match could not be found.



findRow
public static Map<String, Object> findRow(Table table, Index index, Map<String, Object> rowPattern) throws IOException(Code)
Convenience method for finding a specific row in an indexed table which matches a given row "pattern". See Cursor.findRow(Map) for details on the rowPattern.
Parameters:
  table - the table to search
Parameters:
  index - index to assist the search
Parameters:
  rowPattern - pattern to be used to find the row the matching row or null if a match could not be found.



findRow
public boolean findRow(Column columnPattern, Object valuePattern) throws IOException(Code)
Moves to the first row (as defined by the cursor) where the given column has the given value. This may be more efficient on some cursors than others. If a match is not found (or an exception is thrown), the cursor is restored to its previous state.
Parameters:
  columnPattern - column from the table for this cursor which is beingmatched by the valuePattern
Parameters:
  valuePattern - value which is equal to the corresponding value inthe matched row true if a valid row was found with the given value, false if no row was found



findRow
public boolean findRow(Map<String, Object> rowPattern) throws IOException(Code)
Moves to the first row (as defined by the cursor) where the given columns have the given values. This may be more efficient on some cursors than others. If a match is not found (or an exception is thrown), the cursor is restored to its previous state.
Parameters:
  rowPattern - column names and values which must be equal to thecorresponding values in the matched row true if a valid row was found with the given values, false if no row was found



findRowImpl
protected boolean findRowImpl(Column columnPattern, Object valuePattern) throws IOException(Code)
Moves to the first row (as defined by the cursor) where the given column has the given value. Caller manages save/restore on failure.

Default implementation scans the table from beginning to end.
Parameters:
  columnPattern - column from the table for this cursor which is beingmatched by the valuePattern
Parameters:
  valuePattern - value which is equal to the corresponding value inthe matched row true if a valid row was found with the given value, false if no row was found




findRowImpl
protected boolean findRowImpl(Map<String, Object> rowPattern) throws IOException(Code)
Moves to the first row (as defined by the cursor) where the given columns have the given values. Caller manages save/restore on failure.

Default implementation scans the table from beginning to end.
Parameters:
  rowPattern - column names and values which must be equal to thecorresponding values in the matched row true if a valid row was found with the given values, false if no row was found




findValue
public static Object findValue(Table table, Column column, Column columnPattern, Object valuePattern) throws IOException(Code)
Convenience method for finding a specific row in a table which matches a given row "pattern". See Cursor.findRow(Column,Object) for details on the pattern.

Note, a null result value is ambiguous in that it could imply no match or a matching row with null for the desired value. If distinguishing this situation is important, you will need to use a Cursor directly instead of this convenience method.
Parameters:
  table - the table to search
Parameters:
  column - column whose value should be returned
Parameters:
  columnPattern - column being matched by the valuePattern
Parameters:
  valuePattern - value from the columnPattern which will match thedesired row the matching row or null if a match could not be found.




findValue
public static Object findValue(Table table, Index index, Column column, Column columnPattern, Object valuePattern) throws IOException(Code)
Convenience method for finding a specific row in a table which matches a given row "pattern". See Cursor.findRow(Column,Object) for details on the pattern.

Note, a null result value is ambiguous in that it could imply no match or a matching row with null for the desired value. If distinguishing this situation is important, you will need to use a Cursor directly instead of this convenience method.
Parameters:
  table - the table to search
Parameters:
  index - index to assist the search
Parameters:
  column - column whose value should be returned
Parameters:
  columnPattern - column being matched by the valuePattern
Parameters:
  valuePattern - value from the columnPattern which will match thedesired row the matching row or null if a match could not be found.




getCurrentRow
public Map<String, Object> getCurrentRow() throws IOException(Code)
Returns the current row in this cursor (Column name -> Column value).



getCurrentRow
public Map<String, Object> getCurrentRow(Collection<String> columnNames) throws IOException(Code)
Returns the current row in this cursor (Column name -> Column value).
Parameters:
  columnNames - Only column names in this collection will be returned



getCurrentRowValue
public Object getCurrentRowValue(Column column) throws IOException(Code)
Returns the given column from the current row.



getDirHandler
abstract protected DirHandler getDirHandler(boolean moveForward)(Code)
Returns the DirHandler for the given movement direction.



getFirstPosition
protected Position getFirstPosition()(Code)
Returns the first row id (exclusive) as defined by this cursor.



getFormat
public JetFormat getFormat()(Code)



getId
public Id getId()(Code)



getIndex
public Index getIndex()(Code)



getLastPosition
protected Position getLastPosition()(Code)
Returns the last row id (exclusive) as defined by this cursor.



getNextRow
public Map<String, Object> getNextRow() throws IOException(Code)
Moves to the next row in the table and returns it. The next row in this table (Column name -> Column value), or null if no next row is found



getNextRow
public Map<String, Object> getNextRow(Collection<String> columnNames) throws IOException(Code)
Moves to the next row in the table and returns it.
Parameters:
  columnNames - Only column names in this collection will be returned The next row in this table (Column name -> Column value), or null if no next row is found



getPageChannel
public PageChannel getPageChannel()(Code)



getPreviousRow
public Map<String, Object> getPreviousRow() throws IOException(Code)
Moves to the previous row in the table and returns it. The previous row in this table (Column name -> Column value), or null if no previous row is found



getPreviousRow
public Map<String, Object> getPreviousRow(Collection<String> columnNames) throws IOException(Code)
Moves to the previous row in the table and returns it.
Parameters:
  columnNames - Only column names in this collection will be returned The previous row in this table (Column name -> Column value), or null if no previous row is found



getSavepoint
public Savepoint getSavepoint()(Code)
Returns the current state of the cursor which can be restored at a future point in time by a call to Cursor.restoreSavepoint .

Savepoints may be used across different cursor instances for the same table, but they must have the same Id .




getTable
public Table getTable()(Code)



isAfterLast
public boolean isAfterLast() throws IOException(Code)
Returns true if the cursor is currently positioned after the last row, false otherwise.



isBeforeFirst
public boolean isBeforeFirst() throws IOException(Code)
Returns true if the cursor is currently positioned before the first row, false otherwise.



isCurrentRowDeleted
public boolean isCurrentRowDeleted() throws IOException(Code)
Returns true if the row at which the cursor is currently positioned is deleted, false otherwise (including invalid rows).



isUpToDate
protected boolean isUpToDate()(Code)
Returns true if this cursor is up-to-date with respect to the relevant table and related table objects, false otherwise.



iterable
public Iterable<Map<String, Object>> iterable(Collection<String> columnNames)(Code)
Returns an Iterable whose iterator() method returns the result of a call to #iterator(Collection)
throws:
  IllegalStateException - if an IOException is thrown by one of theoperations, the actual exception will be contained within



iterator
public Iterator<Map<String, Object>> iterator()(Code)
Calls beforeFirst on this cursor and returns an unmodifiable Iterator which will iterate through all the rows of this table. Use of the Iterator follows the same restrictions as a call to getNextRow.
throws:
  IllegalStateException - if an IOException is thrown by one of theoperations, the actual exception will be contained within



iterator
public Iterator<Map<String, Object>> iterator(Collection<String> columnNames)(Code)
Calls beforeFirst on this table and returns an unmodifiable Iterator which will iterate through all the rows of this table, returning only the given columns. Use of the Iterator follows the same restrictions as a call to getNextRow.
throws:
  IllegalStateException - if an IOException is thrown by one of theoperations, the actual exception will be contained within



moveNextRows
public int moveNextRows(int numRows) throws IOException(Code)
Moves forward as many rows as possible up to the given number of rows. the number of rows moved.



movePreviousRows
public int movePreviousRows(int numRows) throws IOException(Code)
Moves backward as many rows as possible up to the given number of rows. the number of rows moved.



moveToNextRow
public boolean moveToNextRow() throws IOException(Code)
Moves to the next row as defined by this cursor. true if a valid next row was found, false otherwise



moveToPreviousRow
public boolean moveToPreviousRow() throws IOException(Code)
Moves to the previous row as defined by this cursor. true if a valid previous row was found, false otherwise



reset
public void reset()(Code)
Resets this cursor for forward traversal. Calls Cursor.beforeFirst .



reset
protected void reset(boolean moveForward)(Code)
Resets this cursor for traversing the given direction.



restorePosition
protected void restorePosition(Position curPos) throws IOException(Code)
Restores a current position for the cursor (current position becomes previous position).



restorePosition
final protected void restorePosition(Position curPos, Position prevPos) throws IOException(Code)
Restores a current and previous position for the cursor if the given positions are different from the current positions.



restorePositionImpl
protected void restorePositionImpl(Position curPos, Position prevPos) throws IOException(Code)
Restores a current and previous position for the cursor.



restoreSavepoint
public void restoreSavepoint(Savepoint savepoint) throws IOException(Code)
Moves the cursor to a savepoint previously returned from Cursor.getSavepoint .
throws:
  IllegalArgumentException - if the given savepoint does not have acursorId equal to this cursor's id



reverseIterable
public Iterable<Map<String, Object>> reverseIterable()(Code)
Returns an Iterable whose iterator() method calls afterLast on this cursor and returns an unmodifiable Iterator which will iterate through all the rows of this table in reverse order. Use of the Iterator follows the same restrictions as a call to getPreviousRow.
throws:
  IllegalStateException - if an IOException is thrown by one of theoperations, the actual exception will be contained within



reverseIterable
public Iterable<Map<String, Object>> reverseIterable(Collection<String> columnNames)(Code)
Returns an Iterable whose iterator() method calls afterLast on this table and returns an unmodifiable Iterator which will iterate through all the rows of this table in reverse order, returning only the given columns. Use of the Iterator follows the same restrictions as a call to getPreviousRow.
throws:
  IllegalStateException - if an IOException is thrown by one of theoperations, the actual exception will be contained within



toString
public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.