import java.util.List;
import java.util.ArrayList;
-import com.healthmarketscience.jackcess.impl.ColumnImpl;
-
/**
* Information about a relationship between two tables in the database.
*
private final Table _toTable;
/** the columns in the "from" table in this relationship (aligned w/
toColumns list) */
- private List<ColumnImpl> _toColumns;
+ private final List<Column> _toColumns;
/** the columns in the "to" table in this relationship (aligned w/
toColumns list) */
- private List<ColumnImpl> _fromColumns;
+ private final List<Column> _fromColumns;
/** the various flags describing this relationship */
private final int _flags;
{
_name = name;
_fromTable = fromTable;
- _fromColumns = new ArrayList<ColumnImpl>(
- Collections.nCopies(numCols, (ColumnImpl)null));
+ _fromColumns = new ArrayList<Column>(
+ Collections.nCopies(numCols, (Column)null));
_toTable = toTable;
- _toColumns = new ArrayList<ColumnImpl>(
- Collections.nCopies(numCols, (ColumnImpl)null));
+ _toColumns = new ArrayList<Column>(
+ Collections.nCopies(numCols, (Column)null));
_flags = flags;
}
return _fromTable;
}
- public List<ColumnImpl> getFromColumns() {
+ public List<Column> getFromColumns() {
return _fromColumns;
}
return _toTable;
}
- public List<ColumnImpl> getToColumns() {
+ public List<Column> getToColumns() {
return _toColumns;
}
/*
-Copyright (c) 2007 Health Market Science, Inc.
+Copyright (c) 2013 James Ahlborn
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
-
-You can contact Health Market Science at info@healthmarketscience.com
-or at the following address:
-
-Health Market Science
-2700 Horizon Drive
-Suite 200
-King of Prussia, PA 19406
*/
package com.healthmarketscience.jackcess;
-import org.apache.commons.lang.builder.CompareToBuilder;
-
-
/**
* Uniquely identifies a row of data within the access database.
*
* @author James Ahlborn
*/
-public class RowId implements Comparable<RowId>
+public interface RowId extends Comparable<RowId>
{
- /** special page number which will sort before any other valid page
- number */
- public static final int FIRST_PAGE_NUMBER = -1;
- /** special page number which will sort after any other valid page
- number */
- public static final int LAST_PAGE_NUMBER = -2;
-
- /** special row number representing an invalid row number */
- public static final int INVALID_ROW_NUMBER = -1;
-
- /** type attributes for RowIds which simplify comparisons */
- public enum Type {
- /** comparable type indicating this RowId should always compare less than
- normal RowIds */
- ALWAYS_FIRST,
- /** comparable type indicating this RowId should always compare
- normally */
- NORMAL,
- /** comparable type indicating this RowId should always compare greater
- than normal RowIds */
- ALWAYS_LAST;
- }
-
- /** special rowId which will sort before any other valid rowId */
- public static final RowId FIRST_ROW_ID = new RowId(
- FIRST_PAGE_NUMBER, INVALID_ROW_NUMBER);
-
- /** special rowId which will sort after any other valid rowId */
- public static final RowId LAST_ROW_ID = new RowId(
- LAST_PAGE_NUMBER, INVALID_ROW_NUMBER);
-
- private final int _pageNumber;
- private final int _rowNumber;
- private final Type _type;
-
- /**
- * Creates a new <code>RowId</code> instance.
- *
- */
- public RowId(int pageNumber,int rowNumber) {
- _pageNumber = pageNumber;
- _rowNumber = rowNumber;
- _type = ((_pageNumber == FIRST_PAGE_NUMBER) ? Type.ALWAYS_FIRST :
- ((_pageNumber == LAST_PAGE_NUMBER) ? Type.ALWAYS_LAST :
- Type.NORMAL));
- }
-
- public int getPageNumber() {
- return _pageNumber;
- }
-
- public int getRowNumber() {
- return _rowNumber;
- }
-
- /**
- * Returns {@code true} if this rowId potentially represents an actual row
- * of data, {@code false} otherwise.
- */
- public boolean isValid() {
- return((getRowNumber() >= 0) && (getPageNumber() >= 0));
- }
-
- public Type getType() {
- return _type;
- }
-
- public int compareTo(RowId other) {
- return new CompareToBuilder()
- .append(getType(), other.getType())
- .append(getPageNumber(), other.getPageNumber())
- .append(getRowNumber(), other.getRowNumber())
- .toComparison();
- }
-
- @Override
- public int hashCode() {
- return getPageNumber() ^ getRowNumber();
- }
- @Override
- public boolean equals(Object o) {
- return ((this == o) ||
- ((o != null) && (getClass() == o.getClass()) &&
- (getPageNumber() == ((RowId)o).getPageNumber()) &&
- (getRowNumber() == ((RowId)o).getRowNumber())));
- }
-
- @Override
- public String toString() {
- return getPageNumber() + ":" + getRowNumber();
- }
-
}
/** first position for the TableScanCursor */
private static final ScanPosition FIRST_SCAN_POSITION =
- new ScanPosition(RowId.FIRST_ROW_ID);
+ new ScanPosition(RowIdImpl.FIRST_ROW_ID);
/** last position for the TableScanCursor */
private static final ScanPosition LAST_SCAN_POSITION =
- new ScanPosition(RowId.LAST_ROW_ID);
+ new ScanPosition(RowIdImpl.LAST_ROW_ID);
/** identifier for this cursor */
private final IdImpl _id;
// figure out how many rows are left on this page so we can find the
// next row
- RowId curRowId = curPos.getRowId();
+ RowIdImpl curRowId = curPos.getRowId();
TableImpl.positionAtRowHeader(rowState, curRowId);
int currentRowNumber = curRowId.getRowNumber();
while(true) {
currentRowNumber = handler.getAnotherRowNumber(currentRowNumber);
- curRowId = new RowId(curRowId.getPageNumber(), currentRowNumber);
+ curRowId = new RowIdImpl(curRowId.getPageNumber(), currentRowNumber);
TableImpl.positionAtRowHeader(rowState, curRowId);
if(!rowState.isValid()) {
// load next page
- curRowId = new RowId(handler.getAnotherPageNumber(),
- RowId.INVALID_ROW_NUMBER);
+ curRowId = new RowIdImpl(handler.getAnotherPageNumber(),
+ RowIdImpl.INVALID_ROW_NUMBER);
TableImpl.positionAtRowHeader(rowState, curRowId);
if(!rowState.isHeaderPageNumberValid()) {
/**
* Returns the unique RowId of the position of the cursor.
*/
- public abstract RowId getRowId();
+ public abstract RowIdImpl getRowId();
/**
* Returns {@code true} if the subclass specific info in a Position is
*/
private static final class ScanPosition extends PositionImpl
{
- private final RowId _rowId;
+ private final RowIdImpl _rowId;
- private ScanPosition(RowId rowId) {
+ private ScanPosition(RowIdImpl rowId) {
_rowId = rowId;
}
@Override
- public RowId getRowId() {
+ public RowIdImpl getRowId() {
return _rowId;
}
}
@Override
- public RowId getRowId() {
+ public RowIdImpl getRowId() {
return getEntry().getRowId();
}
/** special entry which is less than any other entry */
public static final Entry FIRST_ENTRY =
- createSpecialEntry(RowId.FIRST_ROW_ID);
+ createSpecialEntry(RowIdImpl.FIRST_ROW_ID);
/** special entry which is greater than any other entry */
public static final Entry LAST_ENTRY =
- createSpecialEntry(RowId.LAST_ROW_ID);
+ createSpecialEntry(RowIdImpl.LAST_ROW_ID);
/** special object which will always be greater than any other value, when
searching for an index entry range in a multi-value index */
* @param row Row to add
* @param rowId rowId of the row to be added
*/
- public void addRow(Object[] row, RowId rowId)
+ public void addRow(Object[] row, RowIdImpl rowId)
throws IOException
{
int nullCount = countNullValues(row);
* @param row Row to remove
* @param rowId rowId of the row to be removed
*/
- public void deleteRow(Object[] row, RowId rowId)
+ public void deleteRow(Object[] row, RowIdImpl rowId)
throws IOException
{
int nullCount = countNullValues(row);
startEntryBytes = createEntryBytes(startRow);
startEntry = new Entry(startEntryBytes,
(startInclusive ?
- RowId.FIRST_ROW_ID : RowId.LAST_ROW_ID));
+ RowIdImpl.FIRST_ROW_ID : RowIdImpl.LAST_ROW_ID));
}
Entry endEntry = LAST_ENTRY;
if(endRow != null) {
createEntryBytes(endRow));
endEntry = new Entry(endEntryBytes,
(endInclusive ?
- RowId.LAST_ROW_ID : RowId.FIRST_ROW_ID));
+ RowIdImpl.LAST_ROW_ID : RowIdImpl.FIRST_ROW_ID));
}
return new EntryCursor(findEntryPosition(startEntry),
findEntryPosition(endEntry));
/**
* Creates one of the special index entries.
*/
- private static Entry createSpecialEntry(RowId rowId) {
+ private static Entry createSpecialEntry(RowIdImpl rowId) {
return new Entry((byte[])null, rowId);
}
/**
* Returns the EntryType based on the given entry info.
*/
- private static EntryType determineEntryType(byte[] entryBytes, RowId rowId)
+ private static EntryType determineEntryType(byte[] entryBytes,
+ RowIdImpl rowId)
{
if(entryBytes != null) {
- return ((rowId.getType() == RowId.Type.NORMAL) ?
+ return ((rowId.getType() == RowIdImpl.Type.NORMAL) ?
EntryType.NORMAL :
- ((rowId.getType() == RowId.Type.ALWAYS_FIRST) ?
+ ((rowId.getType() == RowIdImpl.Type.ALWAYS_FIRST) ?
EntryType.FIRST_VALID : EntryType.LAST_VALID));
} else if(!rowId.isValid()) {
// this is a "special" entry (first/last)
- return ((rowId.getType() == RowId.Type.ALWAYS_FIRST) ?
+ return ((rowId.getType() == RowIdImpl.Type.ALWAYS_FIRST) ?
EntryType.ALWAYS_FIRST : EntryType.ALWAYS_LAST);
}
throw new IllegalArgumentException("Values was null for valid entry");
public static class Entry implements Comparable<Entry>
{
/** page/row on which this row is stored */
- private final RowId _rowId;
+ private final RowIdImpl _rowId;
/** the entry value */
private final byte[] _entryBytes;
/** comparable type for the entry */
* @param rowId rowId in which the row is stored
* @param type the type of the entry
*/
- private Entry(byte[] entryBytes, RowId rowId, EntryType type) {
+ private Entry(byte[] entryBytes, RowIdImpl rowId, EntryType type) {
_rowId = rowId;
_entryBytes = entryBytes;
_type = type;
* @param entryBytes encoded bytes for this index entry
* @param rowId rowId in which the row is stored
*/
- private Entry(byte[] entryBytes, RowId rowId)
+ private Entry(byte[] entryBytes, RowIdImpl rowId)
{
this(entryBytes, rowId, determineEntryType(entryBytes, rowId));
}
int page = ByteUtil.get3ByteInt(buffer, ENTRY_BYTE_ORDER);
int row = ByteUtil.getUnsignedByte(buffer);
- _rowId = new RowId(page, row);
+ _rowId = new RowIdImpl(page, row);
_type = EntryType.NORMAL;
}
- public RowId getRowId() {
+ public RowIdImpl getRowId() {
return _rowId;
}
* @param type the type of the entry
* @param subPageNumber the sub-page to which this node entry refers
*/
- private NodeEntry(byte[] entryBytes, RowId rowId, EntryType type,
+ private NodeEntry(byte[] entryBytes, RowIdImpl rowId, EntryType type,
Integer subPageNumber) {
super(entryBytes, rowId, type);
_subPageNumber = subPageNumber;
public void beforeEntry(Object[] row)
throws IOException
{
- restorePosition(
- new Entry(IndexData.this.createEntryBytes(row), RowId.FIRST_ROW_ID));
+ restorePosition(new Entry(IndexData.this.createEntryBytes(row),
+ RowIdImpl.FIRST_ROW_ID));
}
/**
public void afterEntry(Object[] row)
throws IOException
{
- restorePosition(
- new Entry(IndexData.this.createEntryBytes(row), RowId.LAST_ROW_ID));
+ restorePosition(new Entry(IndexData.this.createEntryBytes(row),
+ RowIdImpl.LAST_ROW_ID));
}
/**
* @param row Row to add
* @param rowId rowId of the row to be added
*/
- public void addRow(Object[] row, RowId rowId)
+ public void addRow(Object[] row, RowIdImpl rowId)
throws IOException
{
getIndexData().addRow(row, rowId);
* @param row Row to remove
* @param rowId rowId of the row to be removed
*/
- public void deleteRow(Object[] row, RowId rowId)
+ public void deleteRow(Object[] row, RowIdImpl rowId)
throws IOException
{
getIndexData().deleteRow(row, rowId);
--- /dev/null
+/*
+Copyright (c) 2007 Health Market Science, Inc.
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+USA
+
+You can contact Health Market Science at info@healthmarketscience.com
+or at the following address:
+
+Health Market Science
+2700 Horizon Drive
+Suite 200
+King of Prussia, PA 19406
+*/
+
+package com.healthmarketscience.jackcess.impl;
+
+import org.apache.commons.lang.builder.CompareToBuilder;
+import com.healthmarketscience.jackcess.RowId;
+
+
+/**
+ * Uniquely identifies a row of data within the access database.
+ *
+ * @author James Ahlborn
+ */
+public class RowIdImpl implements RowId
+{
+ /** special page number which will sort before any other valid page
+ number */
+ public static final int FIRST_PAGE_NUMBER = -1;
+ /** special page number which will sort after any other valid page
+ number */
+ public static final int LAST_PAGE_NUMBER = -2;
+
+ /** special row number representing an invalid row number */
+ public static final int INVALID_ROW_NUMBER = -1;
+
+ /** type attributes for RowIds which simplify comparisons */
+ public enum Type {
+ /** comparable type indicating this RowId should always compare less than
+ normal RowIds */
+ ALWAYS_FIRST,
+ /** comparable type indicating this RowId should always compare
+ normally */
+ NORMAL,
+ /** comparable type indicating this RowId should always compare greater
+ than normal RowIds */
+ ALWAYS_LAST;
+ }
+
+ /** special rowId which will sort before any other valid rowId */
+ public static final RowIdImpl FIRST_ROW_ID = new RowIdImpl(
+ FIRST_PAGE_NUMBER, INVALID_ROW_NUMBER);
+
+ /** special rowId which will sort after any other valid rowId */
+ public static final RowIdImpl LAST_ROW_ID = new RowIdImpl(
+ LAST_PAGE_NUMBER, INVALID_ROW_NUMBER);
+
+ private final int _pageNumber;
+ private final int _rowNumber;
+ private final Type _type;
+
+ /**
+ * Creates a new <code>RowId</code> instance.
+ *
+ */
+ public RowIdImpl(int pageNumber,int rowNumber) {
+ _pageNumber = pageNumber;
+ _rowNumber = rowNumber;
+ _type = ((_pageNumber == FIRST_PAGE_NUMBER) ? Type.ALWAYS_FIRST :
+ ((_pageNumber == LAST_PAGE_NUMBER) ? Type.ALWAYS_LAST :
+ Type.NORMAL));
+ }
+
+ public int getPageNumber() {
+ return _pageNumber;
+ }
+
+ public int getRowNumber() {
+ return _rowNumber;
+ }
+
+ /**
+ * Returns {@code true} if this rowId potentially represents an actual row
+ * of data, {@code false} otherwise.
+ */
+ public boolean isValid() {
+ return((getRowNumber() >= 0) && (getPageNumber() >= 0));
+ }
+
+ public Type getType() {
+ return _type;
+ }
+
+ public int compareTo(RowId other) {
+ return compareTo((RowIdImpl)other);
+ }
+
+ public int compareTo(RowIdImpl other) {
+ return new CompareToBuilder()
+ .append(getType(), other.getType())
+ .append(getPageNumber(), other.getPageNumber())
+ .append(getRowNumber(), other.getRowNumber())
+ .toComparison();
+ }
+
+ @Override
+ public int hashCode() {
+ return getPageNumber() ^ getRowNumber();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return ((this == o) ||
+ ((o != null) && (getClass() == o.getClass()) &&
+ (getPageNumber() == ((RowIdImpl)o).getPageNumber()) &&
+ (getRowNumber() == ((RowIdImpl)o).getRowNumber())));
+ }
+
+ @Override
+ public String toString() {
+ return getPageNumber() + ":" + getRowNumber();
+ }
+
+}
* allows for more complex table interactions.
* @usage _advanced_method_
*/
- public void deleteRow(RowState rowState, RowId rowId) throws IOException {
+ public void deleteRow(RowState rowState, RowIdImpl rowId)
+ throws IOException
+ {
requireValidRowId(rowId);
// ensure that the relevant row state is up-to-date
* e.g. {@link Cursor#getCurrentRowValue}.
* @usage _advanced_method_
*/
- public Object getRowValue(RowState rowState, RowId rowId, ColumnImpl column)
+ public Object getRowValue(RowState rowState, RowIdImpl rowId,
+ ColumnImpl column)
throws IOException
{
if(this != column.getTable()) {
* @usage _advanced_method_
*/
public Map<String, Object> getRow(
- RowState rowState, RowId rowId, Collection<String> columnNames)
+ RowState rowState, RowIdImpl rowId, Collection<String> columnNames)
throws IOException
{
requireValidRowId(rowId);
* @return a ByteBuffer of the relevant page, or null if row was invalid
* @usage _advanced_method_
*/
- public static ByteBuffer positionAtRowHeader(RowState rowState, RowId rowId)
+ public static ByteBuffer positionAtRowHeader(RowState rowState,
+ RowIdImpl rowId)
throws IOException
{
ByteBuffer rowBuffer = rowState.setHeaderRow(rowId);
* invalid or deleted
* @usage _advanced_method_
*/
- public static ByteBuffer positionAtRowData(RowState rowState, RowId rowId)
+ public static ByteBuffer positionAtRowData(RowState rowState,
+ RowIdImpl rowId)
throws IOException
{
positionAtRowHeader(rowState, rowId);
int overflowRowNum = ByteUtil.getUnsignedByte(rowBuffer, rowStart);
int overflowPageNum = ByteUtil.get3ByteInt(rowBuffer, rowStart + 1);
rowBuffer = rowState.setOverflowRow(
- new RowId(overflowPageNum, overflowRowNum));
+ new RowIdImpl(overflowPageNum, overflowRowNum));
rowNum = overflowRowNum;
} else {
dataPage.put(rowData[i]);
// update the indexes
- RowId rowId = new RowId(pageNumber, rowNum);
+ RowIdImpl rowId = new RowIdImpl(pageNumber, rowNum);
for(IndexData indexData : _indexDatas) {
indexData.addRow(row, rowId);
}
* {@link Cursor#setCurrentRowValue} and {@link Cursor#updateCurrentRow}.
* @usage _advanced_method_
*/
- public void updateRow(RowState rowState, RowId rowId, Object... row)
+ public void updateRow(RowState rowState, RowIdImpl rowId, Object... row)
throws IOException
{
requireValidRowId(rowId);
PageChannel.INVALID_PAGE_NUMBER);
pageNumber = _addRowBufferH.getPageNumber();
- RowId headerRowId = rowState.getHeaderRowId();
+ RowIdImpl headerRowId = rowState.getHeaderRowId();
ByteBuffer headerPage = rowState.getHeaderPage();
if(pageNumber == headerRowId.getPageNumber()) {
// new row is on the same page as header row, share page
/**
* @throws IllegalStateException if the given rowId is invalid
*/
- private static void requireValidRowId(RowId rowId) {
+ private static void requireValidRowId(RowIdImpl rowId) {
if(!rowId.isValid()) {
throw new IllegalArgumentException("Given rowId is invalid: " + rowId);
}
/**
* @throws IllegalStateException if the given row is invalid or deleted
*/
- private static void requireNonDeletedRow(RowState rowState, RowId rowId) {
+ private static void requireNonDeletedRow(RowState rowState, RowIdImpl rowId)
+ {
if(!rowState.isValid()) {
throw new IllegalArgumentException(
"Given rowId is invalid for this table: " + rowId);
/** Buffer used for reading the header row data pages */
private final TempPageHolder _headerRowBufferH;
/** the header rowId */
- private RowId _headerRowId = RowId.FIRST_ROW_ID;
+ private RowIdImpl _headerRowId = RowIdImpl.FIRST_ROW_ID;
/** the number of rows on the header page */
private int _rowsOnHeaderPage;
/** the rowState status */
private ByteBuffer _finalRowBuffer;
/** the rowId which contains the final data (after following any overflow
pointers) */
- private RowId _finalRowId = null;
+ private RowIdImpl _finalRowId = null;
/** true if the row values array has data */
private boolean _haveRowValues;
/** values read from the last row */
return _finalRowBuffer;
}
- public RowId getFinalRowId() {
+ public RowIdImpl getFinalRowId() {
if(_finalRowId == null) {
_finalRowId = getHeaderRowId();
}
_varColOffsets = varColOffsets;
}
- public RowId getHeaderRowId() {
+ public RowIdImpl getHeaderRowId() {
return _headerRowId;
}
return _headerRowBufferH.getPage(getPageChannel());
}
- private ByteBuffer setHeaderRow(RowId rowId)
+ private ByteBuffer setHeaderRow(RowIdImpl rowId)
throws IOException
{
checkForModification();
return _finalRowBuffer;
}
- private ByteBuffer setOverflowRow(RowId rowId)
+ private ByteBuffer setOverflowRow(RowIdImpl rowId)
throws IOException
{
// this should never see modifications because it only happens within
}
protected int getFirstPageNumber() {
- return bitIndexToPageNumber(getNextBitIndex(-1), RowId.LAST_PAGE_NUMBER);
+ return bitIndexToPageNumber(getNextBitIndex(-1),
+ RowIdImpl.LAST_PAGE_NUMBER);
}
protected int getNextPageNumber(int curPage) {
return bitIndexToPageNumber(
getNextBitIndex(pageNumberToBitIndex(curPage)),
- RowId.LAST_PAGE_NUMBER);
+ RowIdImpl.LAST_PAGE_NUMBER);
}
protected int getNextBitIndex(int curIndex) {
protected int getLastPageNumber() {
return bitIndexToPageNumber(getPrevBitIndex(_pageNumbers.length()),
- RowId.FIRST_PAGE_NUMBER);
+ RowIdImpl.FIRST_PAGE_NUMBER);
}
protected int getPrevPageNumber(int curPage) {
return bitIndexToPageNumber(
getPrevBitIndex(pageNumberToBitIndex(curPage)),
- RowId.FIRST_PAGE_NUMBER);
+ RowIdImpl.FIRST_PAGE_NUMBER);
}
protected int getPrevBitIndex(int curIndex) {
private int updatePosition(int pageNumber) {
if(pageNumber < UsageMap.this.getFirstPageNumber()) {
- pageNumber = RowId.FIRST_PAGE_NUMBER;
+ pageNumber = RowIdImpl.FIRST_PAGE_NUMBER;
} else if(pageNumber > UsageMap.this.getLastPageNumber()) {
- pageNumber = RowId.LAST_PAGE_NUMBER;
+ pageNumber = RowIdImpl.LAST_PAGE_NUMBER;
}
return pageNumber;
}
}
@Override
public int getBeginningPageNumber() {
- return RowId.FIRST_PAGE_NUMBER;
+ return RowIdImpl.FIRST_PAGE_NUMBER;
}
@Override
public int getEndPageNumber() {
- return RowId.LAST_PAGE_NUMBER;
+ return RowIdImpl.LAST_PAGE_NUMBER;
}
}
}
@Override
public int getBeginningPageNumber() {
- return RowId.LAST_PAGE_NUMBER;
+ return RowIdImpl.LAST_PAGE_NUMBER;
}
@Override
public int getEndPageNumber() {
- return RowId.FIRST_PAGE_NUMBER;
+ return RowIdImpl.FIRST_PAGE_NUMBER;
}
}
import static com.healthmarketscience.jackcess.impl.JetFormatTest.*;
import junit.framework.TestCase;
import com.healthmarketscience.jackcess.impl.JetFormatTest;
+import com.healthmarketscience.jackcess.impl.RowIdImpl;
import com.healthmarketscience.jackcess.util.ColumnMatcher;
import com.healthmarketscience.jackcess.util.SimpleColumnMatcher;
import com.healthmarketscience.jackcess.util.CaseInsensitiveColumnMatcher;
public void testRowId() throws Exception {
// test special cases
- RowId rowId1 = new RowId(1, 2);
- RowId rowId2 = new RowId(1, 3);
- RowId rowId3 = new RowId(2, 1);
+ RowIdImpl rowId1 = new RowIdImpl(1, 2);
+ RowIdImpl rowId2 = new RowIdImpl(1, 3);
+ RowIdImpl rowId3 = new RowIdImpl(2, 1);
- List<RowId> sortedRowIds = new ArrayList<RowId>(new TreeSet<RowId>(
- Arrays.asList(rowId1, rowId2, rowId3, RowId.FIRST_ROW_ID,
- RowId.LAST_ROW_ID)));
+ List<RowIdImpl> sortedRowIds =
+ new ArrayList<RowIdImpl>(new TreeSet<RowIdImpl>(
+ Arrays.asList(rowId1, rowId2, rowId3, RowIdImpl.FIRST_ROW_ID,
+ RowIdImpl.LAST_ROW_ID)));
- assertEquals(Arrays.asList(RowId.FIRST_ROW_ID, rowId1, rowId2, rowId3,
- RowId.LAST_ROW_ID),
+ assertEquals(Arrays.asList(RowIdImpl.FIRST_ROW_ID, rowId1, rowId2, rowId3,
+ RowIdImpl.LAST_ROW_ID),
sortedRowIds);
}
import java.util.SortedSet;
import java.util.TreeSet;
-import junit.framework.TestCase;
-
import static com.healthmarketscience.jackcess.Database.*;
import static com.healthmarketscience.jackcess.DatabaseTest.*;
-import static com.healthmarketscience.jackcess.impl.JetFormatTest.*;
-import com.healthmarketscience.jackcess.impl.IndexImpl;
import com.healthmarketscience.jackcess.impl.ByteUtil;
+import com.healthmarketscience.jackcess.impl.IndexCodesTest;
import com.healthmarketscience.jackcess.impl.IndexData;
+import com.healthmarketscience.jackcess.impl.IndexImpl;
+import static com.healthmarketscience.jackcess.impl.JetFormatTest.*;
+import com.healthmarketscience.jackcess.impl.RowIdImpl;
import com.healthmarketscience.jackcess.impl.TableImpl;
-import com.healthmarketscience.jackcess.impl.IndexCodesTest;
+import junit.framework.TestCase;
/**
* @author James Ahlborn
IOException failure = null;
try {
- ((IndexImpl)index).addRow(row, new RowId(400 + i, 0));
+ ((IndexImpl)index).addRow(row, new RowIdImpl(400 + i, 0));
} catch(IOException e) {
failure = e;
}