/** * Returns the object identified by id. * * @param id * The identifier for the object to be retrieved. * @return The requested object. */ public T get(long id) { long objectOffset; T data; // Get the object offset from the index store. objectOffset = indexStoreReader.get(id).getValue(); // Read the object from the object store. data = objectStoreReader.get(objectOffset); return data; }
/** * Returns the object identified by id. * * @param id * The identifier for the object to be retrieved. * @return The requested object. */ public T get(long id) { long objectOffset; T data; // Get the object offset from the index store. objectOffset = indexStoreReader.get(id).getValue(); // Read the object from the object store. data = objectStoreReader.get(objectOffset); return data; }
elementSize = 0; } else { indexStoreReader.get(0); elementSize = indexStoreReader.position(); elementCount = dataLength / elementSize;
elementSize = 0; } else { indexStoreReader.get(0); elementSize = indexStoreReader.position(); elementCount = dataLength / elementSize;
/** * Returns the index element identified by id. * * @param key * The identifier for the index element to be retrieved. * @return The requested object. */ public T get(K key) { long keyIndex; // Determine the location of the key within the index. keyIndex = getKeyIndex(key); if (keyIndex < elementCount) { T element; K locatedKey; element = indexStoreReader.get(keyIndex * elementSize); locatedKey = element.getKey(); if (ordering.compare(key, locatedKey) == 0) { return element; } } throw new NoSuchIndexElementException("Requested key " + key + " does not exist."); }
/** * Returns the index element identified by id. * * @param key * The identifier for the index element to be retrieved. * @return The requested object. */ public T get(K key) { long keyIndex; // Determine the location of the key within the index. keyIndex = getKeyIndex(key); if (keyIndex < elementCount) { T element; K locatedKey; element = indexStoreReader.get(keyIndex * elementSize); locatedKey = element.getKey(); if (ordering.compare(key, locatedKey) == 0) { return element; } } throw new NoSuchIndexElementException("Requested key " + key + " does not exist."); }
intervalMidKey = indexStoreReader.get(intervalMid * elementSize).getKey();
intervalMidKey = indexStoreReader.get(intervalMid * elementSize).getKey();