Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013

com.healthmarketscience.jackcess
Class Index

java.lang.Object
  extended by com.healthmarketscience.jackcess.Index
All Implemented Interfaces:
java.lang.Comparable<Index>

public class Index
extends java.lang.Object
implements java.lang.Comparable<Index>

Access table (logical) index. Logical indexes are backed for IndexData, where one or more logical indexes could be backed by the same data.


Nested Class Summary
static class Index.ForeignKeyReference
          Information about a foreign key reference defined in an index (when referential integrity should be enforced).
 
Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
protected Index(java.nio.ByteBuffer tableBuffer, java.util.List<IndexData> indexDatas, JetFormat format)
           
 
Method Summary
 void addRow(java.lang.Object[] row, RowId rowId)
          Adds a row to this index Forces index initialization.
 int compareTo(Index other)
           
 java.lang.Object[] constructIndexRow(java.util.Map<java.lang.String,?> row)
          Constructs an array of values appropriate for this index from the given column values.
 java.lang.Object[] constructIndexRow(java.lang.String colName, java.lang.Object value)
          Constructs an array of values appropriate for this index from the given column value.
 java.lang.Object[] constructIndexRowFromEntry(java.lang.Object... values)
          Constructs an array of values appropriate for this index from the given column values, expected to match the columns for this index.
 IndexData.EntryCursor cursor()
          Gets a new cursor for this index.
 IndexData.EntryCursor cursor(java.lang.Object[] startRow, boolean startInclusive, java.lang.Object[] endRow, boolean endInclusive)
          Gets a new cursor for this index, narrowed to the range defined by the given startRow and endRow.
 void deleteRow(java.lang.Object[] row, RowId rowId)
          Removes a row from this index Forces index initialization.
 java.util.List<IndexData.ColumnDescriptor> getColumns()
          Returns the Columns for this index (unmodifiable)
 JetFormat getFormat()
           
 IndexData getIndexData()
           
 byte getIndexFlags()
           
 int getIndexNumber()
           
 java.lang.String getName()
           
 PageChannel getPageChannel()
           
 Index.ForeignKeyReference getReference()
           
 Index getReferencedIndex()
           
 Table getTable()
           
 int getUniqueEntryCount()
           
 int getUniqueEntryCountOffset()
           
 void initialize()
          Forces initialization of this index (actual parsing of index pages). normally, the index will not be initialized until the entries are actually needed.
 boolean isForeignKey()
           
 boolean isInitialized()
          Whether or not the complete index state has been read.
 boolean isPrimaryKey()
           
 boolean isUnique()
          Whether or not index entries must be unique.
 void setName(java.lang.String name)
           
 boolean shouldIgnoreNulls()
          Whether or not null values are actually recorded in the index.
 java.lang.String toString()
           
 void update()
          Writes the current index state to the database.
protected static void writeDefinitions(com.healthmarketscience.jackcess.TableCreator creator, java.nio.ByteBuffer buffer)
          Writes the logical index definitions into a table definition buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

Index

protected Index(java.nio.ByteBuffer tableBuffer,
                java.util.List<IndexData> indexDatas,
                JetFormat format)
         throws java.io.IOException
Throws:
java.io.IOException
Method Detail

getIndexData

public IndexData getIndexData()

getTable

public Table getTable()

getFormat

public JetFormat getFormat()

getPageChannel

public PageChannel getPageChannel()

getIndexNumber

public int getIndexNumber()

getIndexFlags

public byte getIndexFlags()

getUniqueEntryCount

public int getUniqueEntryCount()

getUniqueEntryCountOffset

public int getUniqueEntryCountOffset()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

isPrimaryKey

public boolean isPrimaryKey()

isForeignKey

public boolean isForeignKey()

getReference

public Index.ForeignKeyReference getReference()

getReferencedIndex

public Index getReferencedIndex()
                         throws java.io.IOException
Returns:
the Index referenced by this Index's ForeignKeyReference (if it has one), otherwise null.
Throws:
java.io.IOException

shouldIgnoreNulls

public boolean shouldIgnoreNulls()
Whether or not null values are actually recorded in the index.


isUnique

public boolean isUnique()
Whether or not index entries must be unique.

Some notes about uniqueness:


getColumns

public java.util.List<IndexData.ColumnDescriptor> getColumns()
Returns the Columns for this index (unmodifiable)


isInitialized

public boolean isInitialized()
Whether or not the complete index state has been read.


initialize

public void initialize()
                throws java.io.IOException
Forces initialization of this index (actual parsing of index pages). normally, the index will not be initialized until the entries are actually needed.

Throws:
java.io.IOException

update

public void update()
            throws java.io.IOException
Writes the current index state to the database.

Forces index initialization.

Throws:
java.io.IOException

addRow

public void addRow(java.lang.Object[] row,
                   RowId rowId)
            throws java.io.IOException
Adds a row to this index

Forces index initialization.

Parameters:
row - Row to add
rowId - rowId of the row to be added
Throws:
java.io.IOException

deleteRow

public void deleteRow(java.lang.Object[] row,
                      RowId rowId)
               throws java.io.IOException
Removes a row from this index

Forces index initialization.

Parameters:
row - Row to remove
rowId - rowId of the row to be removed
Throws:
java.io.IOException

cursor

public IndexData.EntryCursor cursor()
                             throws java.io.IOException
Gets a new cursor for this index.

Forces index initialization.

Throws:
java.io.IOException

cursor

public IndexData.EntryCursor cursor(java.lang.Object[] startRow,
                                    boolean startInclusive,
                                    java.lang.Object[] endRow,
                                    boolean endInclusive)
                             throws java.io.IOException
Gets a new cursor for this index, narrowed to the range defined by the given startRow and endRow.

Forces index initialization.

Parameters:
startRow - the first row of data for the cursor, or null for the first entry
startInclusive - whether or not startRow is inclusive or exclusive
endRow - the last row of data for the cursor, or null for the last entry
endInclusive - whether or not endRow is inclusive or exclusive
Throws:
java.io.IOException

constructIndexRowFromEntry

public java.lang.Object[] constructIndexRowFromEntry(java.lang.Object... values)
Constructs an array of values appropriate for this index from the given column values, expected to match the columns for this index.

Returns:
the appropriate sparse array of data
Throws:
java.lang.IllegalArgumentException - if the wrong number of values are provided

constructIndexRow

public java.lang.Object[] constructIndexRow(java.lang.String colName,
                                            java.lang.Object value)
Constructs an array of values appropriate for this index from the given column value.

Returns:
the appropriate sparse array of data or null if not all columns for this index were provided

constructIndexRow

public java.lang.Object[] constructIndexRow(java.util.Map<java.lang.String,?> row)
Constructs an array of values appropriate for this index from the given column values.

Returns:
the appropriate sparse array of data or null if not all columns for this index were provided

toString

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

compareTo

public int compareTo(Index other)
Specified by:
compareTo in interface java.lang.Comparable<Index>

writeDefinitions

protected static void writeDefinitions(com.healthmarketscience.jackcess.TableCreator creator,
                                       java.nio.ByteBuffer buffer)
                                throws java.io.IOException
Writes the logical index definitions into a table definition buffer.

Parameters:
buffer - Buffer to write to
indexes - List of IndexBuilders to write definitions for
Throws:
java.io.IOException

Elexis: Das führende OpenSource-Arztpraxisprogamm
im deutschsprachigen Raum
Java doc für Elexis version 2.1.7.dev vom 01.09.2013