Java Code Examples for com.sleepycat.bind.tuple.TupleBinding#outputToEntry()

The following examples show how to use com.sleepycat.bind.tuple.TupleBinding#outputToEntry() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractSearchStructure.java    From multimedia-indexing with Apache License 2.0 6 votes vote down vote up
/**
 * This method is used to set the geolocation of a previously indexed vector. If the geolocation is
 * already set, this method replaces it.
 * 
 * @param iid
 *            The internal id of the vector
 * @param latitude
 * @param longitude
 * @return true if geolocation is successfully set, false otherwise
 */
public boolean setGeolocation(int iid, double latitude, double longitude) {
	if (iid < 0 || iid > loadCounter) {
		System.out.println("Internal id " + iid + " is out of range!");
		return false;
	}
	DatabaseEntry key = new DatabaseEntry();
	DatabaseEntry data = new DatabaseEntry();

	IntegerBinding.intToEntry(iid, key);
	TupleOutput output = new TupleOutput();
	output.writeDouble(latitude);
	output.writeDouble(longitude);
	TupleBinding.outputToEntry(output, data);

	if (iidToGeolocationDB.put(null, key, data) == OperationStatus.SUCCESS) {
		return true;
	} else {
		return false;
	}
}
 
Example 2
Source File: UpgradeFrom7To8.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
void storeVirtualHostHierarchyRecord(Database hierarchyDb, Transaction txn, UUID id, UUID virtualHostId)
{
    DatabaseEntry key = new DatabaseEntry();
    DatabaseEntry value = new DatabaseEntry();
    UUIDTupleBinding.getInstance().objectToEntry(virtualHostId, value);
    TupleOutput tupleOutput = new TupleOutput();
    tupleOutput.writeLong(id.getMostSignificantBits());
    tupleOutput.writeLong(id.getLeastSignificantBits());
    tupleOutput.writeString("VirtualHost");
    TupleBinding.outputToEntry(tupleOutput, key);
    hierarchyDb.put(txn, key, value);
}
 
Example 3
Source File: PreparedTransactionBinding.java    From qpid-broker-j with Apache License 2.0 5 votes vote down vote up
public static void objectToEntry(final PreparedTransaction preparedTransaction, final DatabaseEntry value)
{
    TupleOutput tupleOutput = new TupleOutput();
    writeRecords(preparedTransaction.getEnqueues(), tupleOutput);
    writeRecords(preparedTransaction.getDequeues(), tupleOutput);
    TupleBinding.outputToEntry(tupleOutput, value);
}
 
Example 4
Source File: IVFPQ.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given (byte) code.
 * 
 * @param code
 *            The code
 */
private void appendPersistentIndex(int listId, byte[] code) {
	// write id, listId and code
	TupleOutput output = new TupleOutput();
	output.writeInt(listId);
	for (int i = 0; i < numSubVectors; i++) {
		output.writeByte(code[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToIvfpqDB.put(null, key, data);
}
 
Example 5
Source File: IVFPQ.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given (short) code.
 * 
 * @param code
 *            The code
 */
private void appendPersistentIndex(int listId, short[] code) {
	// write id, listId and code
	TupleOutput output = new TupleOutput();
	output.writeInt(listId);
	for (int i = 0; i < numSubVectors; i++) {
		output.writeShort(code[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToIvfpqDB.put(null, key, data);
}
 
Example 6
Source File: PQ.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given (byte) code.
 * 
 * @param code
 *            The code
 */
private void appendPersistentIndex(byte[] code) {
	// write id and code
	TupleOutput output = new TupleOutput();
	for (int i = 0; i < numSubVectors; i++) {
		output.writeByte(code[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToPqDB.put(null, key, data);
}
 
Example 7
Source File: PQ.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given (short) code.
 * 
 * @param code
 *            The code
 */
private void appendPersistentIndex(short[] code) {
	// write id and code
	TupleOutput output = new TupleOutput();
	for (int i = 0; i < numSubVectors; i++) {
		output.writeShort(code[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToPqDB.put(null, key, data);
}
 
Example 8
Source File: Linear.java    From multimedia-indexing with Apache License 2.0 5 votes vote down vote up
/**
 * Appends the persistent index with the given vector.
 * 
 * @param vector
 *            The vector
 */
private void appendPersistentIndex(double[] vector) {
	TupleOutput output = new TupleOutput();
	for (int i = 0; i < vectorLength; i++) {
		output.writeDouble(vector[i]);
	}
	DatabaseEntry data = new DatabaseEntry();
	TupleBinding.outputToEntry(output, data);
	DatabaseEntry key = new DatabaseEntry();
	IntegerBinding.intToEntry(loadCounter, key);
	iidToVectorDB.put(null, key, data);
}