Java tutorial
// Description: Java6 in-memory RAM DbIO implementation for Index. /* * MSS Code Factory 1.10 * * Copyright (c) 2012 Mark Sobkow * * This program is available as free software under the GNU GPL v3, or * under a commercial license from Mark Sobkow. For commercial licensing * details, please contact msobkow@sasktel.net. * * Under the terms of the GPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *********************************************************************** * * Code manufactured * by MSS Code Factory version 1.9.3294 * * $Revision: 26 $ */ package net.sourceforge.msscodefactory.v1_10.MSSBamRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_9.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.v1_10.MSSBam.*; import net.sourceforge.msscodefactory.v1_10.MSSBamBL.*; import net.sourceforge.msscodefactory.v1_10.MSSBamBLRam.*; /* * MSSBamRamIndexTable in-memory RAM DbIO implementation * for Index. */ public class MSSBamRamIndexTable implements IMSSBamIndexTable { private MSSBamBLRamSchema schema; private Map<MSSBamAnyObjPKey, MSSBamIndexBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamIndexBuff>(); private SortedMap<MSSBamIndexBySchemaIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff>> dictBySchemaIdx = new TreeMap<MSSBamIndexBySchemaIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff>>(); private SortedMap<MSSBamIndexByTableIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff>> dictByTableIdx = new TreeMap<MSSBamIndexByTableIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff>>(); public MSSBamRamIndexTable(MSSBamBLRamSchema argSchema) { schema = argSchema; } public void createIndex(MSSBamAuthorization Authorization, MSSBamIndexBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(Buff.getRequiredId()); MSSBamIndexBySchemaIdxKey keySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey(); keySchemaIdx.setRequiredSchemaId(Buff.getRequiredSchemaId()); MSSBamIndexByTableIdxKey keyTableIdx = schema.getFactoryIndex().newTableIdxKey(); keyTableIdx.setRequiredTableId(Buff.getRequiredTableId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createIndex", pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createIndex", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableTable().readDerivedByIdIdx(Authorization, Buff.getRequiredTableId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createIndex", "Container", "Table", "Table", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdictSchemaIdx; if (dictBySchemaIdx.containsKey(keySchemaIdx)) { subdictSchemaIdx = dictBySchemaIdx.get(keySchemaIdx); } else { subdictSchemaIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexBuff>(); dictBySchemaIdx.put(keySchemaIdx, subdictSchemaIdx); } subdictSchemaIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdictTableIdx; if (dictByTableIdx.containsKey(keyTableIdx)) { subdictTableIdx = dictByTableIdx.get(keyTableIdx); } else { subdictTableIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexBuff>(); dictByTableIdx.put(keyTableIdx, subdictTableIdx); } subdictTableIdx.put(pkey, Buff); } public MSSBamIndexBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamIndex.readDerived() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(PKey.getRequiredId()); MSSBamIndexBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamIndexBuff[] readAllDerived(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamIndex.readAllDerived() "; MSSBamIndexBuff[] retList = new MSSBamIndexBuff[dictByPKey.values().size()]; Iterator<MSSBamIndexBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public MSSBamIndexBuff[] readDerivedByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByTenantIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByTenantIdx(Authorization, TenantId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamIndexBuff)) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } } public MSSBamIndexBuff[] readDerivedByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByScopeIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByScopeIdx(Authorization, ScopeId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamIndexBuff)) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } } public MSSBamIndexBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByAuthorIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByAuthorIdx(Authorization, AuthorId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamIndexBuff)) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } } public MSSBamIndexBuff readDerivedByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByUNameIdx() "; MSSBamAnyObjBuff buff = schema.getTableAnyObj().readDerivedByUNameIdx(Authorization, ScopeId, Name); if (buff == null) { return (null); } else if (buff instanceof MSSBamIndexBuff) { return ((MSSBamIndexBuff) buff); } else { return (null); } } public MSSBamIndexBuff[] readDerivedBySchemaIdx(MSSBamAuthorization Authorization, long SchemaId) { final String S_ProcName = "MSSBamRamIndex.readDerivedBySchemaIdx() "; MSSBamIndexBySchemaIdxKey key = schema.getFactoryIndex().newSchemaIdxKey(); key.setRequiredSchemaId(SchemaId); MSSBamIndexBuff[] recArray; if (dictBySchemaIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdictSchemaIdx = dictBySchemaIdx.get(key); recArray = new MSSBamIndexBuff[subdictSchemaIdx.size()]; Iterator<MSSBamIndexBuff> iter = subdictSchemaIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamIndexBuff[0]; } return (recArray); } public MSSBamIndexBuff[] readDerivedByTableIdx(MSSBamAuthorization Authorization, long TableId) { final String S_ProcName = "MSSBamRamIndex.readDerivedByTableIdx() "; MSSBamIndexByTableIdxKey key = schema.getFactoryIndex().newTableIdxKey(); key.setRequiredTableId(TableId); MSSBamIndexBuff[] recArray; if (dictByTableIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdictTableIdx = dictByTableIdx.get(key); recArray = new MSSBamIndexBuff[subdictTableIdx.size()]; Iterator<MSSBamIndexBuff> iter = subdictTableIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamIndexBuff[0]; } return (recArray); } public MSSBamIndexBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByIdIdx() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(Id); MSSBamIndexBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamIndexBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamIndex.readBuff() "; MSSBamIndexBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("IDX"))) { buff = null; } return (buff); } public MSSBamIndexBuff[] readAllBuff(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamIndex.readAllBuff() "; MSSBamIndexBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); MSSBamIndexBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("IDX")) { filteredList.add(buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } public MSSBamIndexBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByIdIdx() "; MSSBamAnyObjBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamIndexBuff) buff); } else { return (null); } } public MSSBamIndexBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } public MSSBamIndexBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByScopeIdx(Authorization, ScopeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } public MSSBamIndexBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByAuthorIdx(Authorization, AuthorId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } public MSSBamIndexBuff readBuffByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByUNameIdx() "; MSSBamAnyObjBuff buff = readDerivedByUNameIdx(Authorization, ScopeId, Name); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamIndexBuff) buff); } else { return (null); } } public MSSBamIndexBuff[] readBuffBySchemaIdx(MSSBamAuthorization Authorization, long SchemaId) { final String S_ProcName = "MSSBamRamIndex.readBuffBySchemaIdx() "; MSSBamIndexBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); MSSBamIndexBuff[] buffList = readDerivedBySchemaIdx(Authorization, SchemaId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("IDX")) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } public MSSBamIndexBuff[] readBuffByTableIdx(MSSBamAuthorization Authorization, long TableId) { final String S_ProcName = "MSSBamRamIndex.readBuffByTableIdx() "; MSSBamIndexBuff buff; ArrayList<MSSBamIndexBuff> filteredList = new ArrayList<MSSBamIndexBuff>(); MSSBamIndexBuff[] buffList = readDerivedByTableIdx(Authorization, TableId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("IDX")) { filteredList.add((MSSBamIndexBuff) buff); } } return (filteredList.toArray(new MSSBamIndexBuff[0])); } public void updateIndex(MSSBamAuthorization Authorization, MSSBamIndexBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamIndexBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateIndex", "Existing record not found", "Index", pkey); } MSSBamIndexBySchemaIdxKey existingKeySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey(); existingKeySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId()); MSSBamIndexBySchemaIdxKey newKeySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey(); newKeySchemaIdx.setRequiredSchemaId(Buff.getRequiredSchemaId()); MSSBamIndexByTableIdxKey existingKeyTableIdx = schema.getFactoryIndex().newTableIdxKey(); existingKeyTableIdx.setRequiredTableId(existing.getRequiredTableId()); MSSBamIndexByTableIdxKey newKeyTableIdx = schema.getFactoryIndex().newTableIdxKey(); newKeyTableIdx.setRequiredTableId(Buff.getRequiredTableId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateIndex", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTable().readDerivedByIdIdx(Authorization, Buff.getRequiredTableId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateIndex", "Container", "Table", "Table", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictBySchemaIdx.get(existingKeySchemaIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySchemaIdx.containsKey(newKeySchemaIdx)) { subdict = dictBySchemaIdx.get(newKeySchemaIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexBuff>(); dictBySchemaIdx.put(newKeySchemaIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTableIdx.get(existingKeyTableIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTableIdx.containsKey(newKeyTableIdx)) { subdict = dictByTableIdx.get(newKeyTableIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamIndexBuff>(); dictByTableIdx.put(newKeyTableIdx, subdict); } subdict.put(pkey, Buff); } public void deleteIndex(MSSBamAuthorization Authorization, MSSBamIndexBuff Buff) { final String S_ProcName = "MSSBamRamIndexTable.deleteIndex() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamIndexBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteIndex", "Existing record not found", "Index", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteIndex", pkey); } MSSBamIndexBySchemaIdxKey keySchemaIdx = schema.getFactoryIndex().newSchemaIdxKey(); keySchemaIdx.setRequiredSchemaId(existing.getRequiredSchemaId()); MSSBamIndexByTableIdxKey keyTableIdx = schema.getFactoryIndex().newTableIdxKey(); keyTableIdx.setRequiredTableId(existing.getRequiredTableId()); // Validate reverse foreign keys if (schema.getTableIndexCol().readDerivedByIndexIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteIndex", "Container", "Index", "IndexCol", pkey); } if (schema.getTableRelation().readDerivedByFromKeyIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteIndex", "Lookup", "FromIndex", "Relation", pkey); } if (schema.getTableRelation().readDerivedByToKeyIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteIndex", "Lookup", "ToIndex", "Relation", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdict; dictByPKey.remove(pkey); subdict = dictBySchemaIdx.get(keySchemaIdx); subdict.remove(pkey); subdict = dictByTableIdx.get(keyTableIdx); subdict.remove(pkey); } public MSSBamCursor openIndexCursorAll(MSSBamAuthorization Authorization) { MSSBamCursor cursor = new MSSBamRamIndexCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public MSSBamCursor openIndexCursorBySchemaIdx(MSSBamAuthorization Authorization, long SchemaId) { MSSBamCursor cursor; MSSBamIndexBySchemaIdxKey key = schema.getFactoryIndex().newSchemaIdxKey(); key.setRequiredSchemaId(SchemaId); if (dictBySchemaIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdictSchemaIdx = dictBySchemaIdx.get(key); cursor = new MSSBamRamIndexCursor(Authorization, schema, subdictSchemaIdx.values()); } else { cursor = new MSSBamRamIndexCursor(Authorization, schema, new ArrayList<MSSBamIndexBuff>()); } return (cursor); } public MSSBamCursor openIndexCursorByTableIdx(MSSBamAuthorization Authorization, long TableId) { MSSBamCursor cursor; MSSBamIndexByTableIdxKey key = schema.getFactoryIndex().newTableIdxKey(); key.setRequiredTableId(TableId); if (dictByTableIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamIndexBuff> subdictTableIdx = dictByTableIdx.get(key); cursor = new MSSBamRamIndexCursor(Authorization, schema, subdictTableIdx.values()); } else { cursor = new MSSBamRamIndexCursor(Authorization, schema, new ArrayList<MSSBamIndexBuff>()); } return (cursor); } public void closeIndexCursor(MSSBamCursor Cursor) { // Cursor.DataReader.Close(); } public MSSBamIndexBuff nextIndexCursor(MSSBamCursor Cursor) { MSSBamRamIndexCursor cursor = (MSSBamRamIndexCursor) Cursor; MSSBamIndexBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public MSSBamIndexBuff prevIndexCursor(MSSBamCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; MSSBamIndexBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextIndexCursor(Cursor); } return (rec); } public MSSBamIndexBuff firstIndexCursor(MSSBamCursor Cursor) { int targetRowIdx = 1; MSSBamIndexBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextIndexCursor(Cursor); } return (rec); } public MSSBamIndexBuff lastIndexCursor(MSSBamCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastIndexCursor"); } public MSSBamIndexBuff nthIndexCursor(MSSBamCursor Cursor, int Idx) { int targetRowIdx = Idx; MSSBamIndexBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextIndexCursor(Cursor); } return (rec); } }