本文整理汇总了Java中com.sleepycat.bind.tuple.TupleOutput类的典型用法代码示例。如果您正苦于以下问题:Java TupleOutput类的具体用法?Java TupleOutput怎么用?Java TupleOutput使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TupleOutput类属于com.sleepycat.bind.tuple包,在下文中一共展示了TupleOutput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
@Override
public void objectToEntry(Object conceptVectorObject, TupleOutput to) {
ConceptVector conceptvector = (ConceptVector) conceptVectorObject;
int numberofentries = conceptvector.getStoredValueCount();
to.writeInt(numberofentries);
if (conceptvector.isSquaredNormCalculated()) {
to.writeFloat(conceptvector.getSquaredNorm().floatValue());
}
else {
to.writeFloat(-1f);
}
MapCursor<Integer, Float> entrycursor = conceptvector.values.getEntryCursor();
while (entrycursor.isValid()) {
to.writeInt(entrycursor.key());
to.writeFloat(entrycursor.value());
entrycursor.next();
}
}
示例2: createSecondaryKeys
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
@Override
public void createSecondaryKeys(TupleInput primaryKeyInput,
TupleInput dataInput,
Set<TupleOutput> indexKeys) {
long begin, end;
primaryKeyInput.skipFast(13);
begin = primaryKeyInput.readUnsignedInt() >> 10;
primaryKeyInput.skipFast(4);
end = primaryKeyInput.readUnsignedInt() >> 10;
for (long i = begin; i <= end; ++i) {
TupleOutput o = getTupleOutput(null);
o.writeUnsignedInt(i);
indexKeys.add(o);
}
}
示例3: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
public boolean createSecondaryKey(SecondaryDatabase secondary,
DatabaseEntry key, DatabaseEntry data, DatabaseEntry result) {
TupleInput dataInput = new TupleInput(data.getData());
TupleOutput indexKeyOutput = new TupleOutput();
int p = idxList.size() - 1;
//System.out.println("key lenght"+idxList.size());
for(int l = 0; l < size && p >= 0; l++) {
long tmp = dataInput.readLong();
//while(p>=0)
if(l == idxList.get(p)) {
// System.out.print("key "+l+" = "+tmp +" ");
indexKeyOutput.writeLong(tmp);
p--;
}
}
//System.out.println("");
result.setData(indexKeyOutput.getBufferBytes());
return true;
}
示例4: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
/**
* @param secondary
* @param key
* @param data
* @param result
*/
public boolean createSecondaryKey(SecondaryDatabase secondary,
DatabaseEntry key, DatabaseEntry data, DatabaseEntry result) {
TupleInput dataInput = new TupleInput(data.getData());
TupleOutput indexKeyOutput = new TupleOutput();
int p = idxList.size() - 1;
for(int l = 0; l < size && p >= 0; l++) {
long tmp = dataInput.readLong();
if(l == idxList.get(p)) {
indexKeyOutput.writeLong(tmp);
p--;
}
}
result.setData(indexKeyOutput.getBufferBytes());
return true;
}
示例5: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
public boolean createSecondaryKey(SecondaryDatabase db,
DatabaseEntry primaryKeyEntry,
DatabaseEntry dataEntry,
DatabaseEntry indexKeyEntry)
throws DatabaseException {
TupleOutput output = getTupleOutput(null);
TupleInput primaryKeyInput = entryToInput(primaryKeyEntry);
Object dataInput = dataBinding.entryToObject(dataEntry);
if (createSecondaryKey(primaryKeyInput, dataInput, output)) {
outputToEntry(output, indexKeyEntry);
return true;
} else {
return false;
}
}
示例6: testBufferOverride
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
public void testBufferOverride() {
TupleOutput out = new TupleOutput(new byte[10]);
CachedOutputBinding binding = new CachedOutputBinding(out);
binding.used = false;
binding.objectToEntry("x", buffer);
assertEquals("x", binding.entryToObject(buffer));
assertTrue(binding.used);
binding.used = false;
binding.objectToEntry("aaaaaaaaaaaaaaaaaaaaaa", buffer);
assertEquals("aaaaaaaaaaaaaaaaaaaaaa", binding.entryToObject(buffer));
assertTrue(binding.used);
binding.used = false;
binding.objectToEntry("x", buffer);
assertEquals("x", binding.entryToObject(buffer));
assertTrue(binding.used);
}
示例7: marshalSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
public boolean marshalSecondaryKey(String keyName, TupleOutput keyOutput) {
if ("1".equals(keyName)) {
if (indexKey1.length() > 0) {
keyOutput.writeString(indexKey1);
return true;
} else {
return false;
}
} else if ("2".equals(keyName)) {
if (indexKey1.length() > 0) {
keyOutput.writeString(indexKey2);
return true;
} else {
return false;
}
} else {
throw new IllegalArgumentException("Unknown keyName: " + keyName);
}
}
示例8: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
@Override
public void objectToEntry(Object object, TupleOutput to) {
ConceptToConceptVectorRecordIndexEntry conceptToRecordIndexEntry = (ConceptToConceptVectorRecordIndexEntry) object;
to.writeFloat(conceptToRecordIndexEntry.sumOfValuesInRecords);
int numberofentries = conceptToRecordIndexEntry.conceptVectorRecordIDs.size();
to.writeInt(numberofentries);
Iterator<Integer> iterator = conceptToRecordIndexEntry.conceptVectorRecordIDs.iterator();
while (iterator.hasNext()){
to.writeInt(iterator.next());
}
}
示例9: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
@Override
public void objectToEntry(Object arg0, TupleOutput to) {
SortedIntListSet set = (SortedIntListSet) arg0;
int numberofentries = set.size();
to.writeInt(numberofentries);
Iterator<Integer> iterator = set.iterator();
while (iterator.hasNext()) {
to.writeInt(iterator.next());
}
}
示例10: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
@Override
public void objectToEntry(Object obj, TupleOutput to) {
SortedIntList2IntMap map = (SortedIntList2IntMap)obj;
to.writeInt(map.size());
Iterator<MapEntry> it = map.entryIterator();
while(it.hasNext()){
MapEntry me = it.next();
to.writeInt(me.getKey());
to.writeInt(me.getValue());
}
}
示例11: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
public void objectToEntry(HGPersistentHandle[] link, TupleOutput output) {
//HGPersistentHandle[] link = (HGPersistentHandle[])x;
byte[] buffer = new byte[link.length * handleSize];
for (int i = 0; i < link.length; i++) {
HGPersistentHandle handle = (HGPersistentHandle)link[i];
System.arraycopy(handle.toByteArray(), 0, buffer, i * handleSize, handleSize);
}
output.writeFast(buffer);
}
示例12: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
public void objectToEntry(HGPersistentHandle[] link, TupleOutput output)
{
byte [] buffer = new byte[link.length * handleSize];
for (int i = 0; i < link.length; i++)
{
HGPersistentHandle handle = (HGPersistentHandle)link[i];
System.arraycopy(handle.toByteArray(), 0,
buffer, i*handleSize,
handleSize);
}
output.writeFast(buffer);
}
示例13: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
/**
* Extract the supplier key from a shipment key/value pair. The
* supplier key is stored in the shipment key, so the shipment value is
* not used.
*/
public boolean createSecondaryKey(TupleInput primaryKeyInput,
Object valueInput,
TupleOutput indexKeyOutput) {
primaryKeyInput.readString(); // skip the partNumber
String supplierNumber = primaryKeyInput.readString();
indexKeyOutput.writeString(supplierNumber);
return true;
}
示例14: intKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
private byte[] intKey(long fileNum, long seqNum) {
TupleOutput out = new TupleOutput();
out.writeUnsignedInt(fileNum);
out.writeUnsignedInt(seqNum);
return out.toByteArray();
}
示例15: createSecondaryKey
import com.sleepycat.bind.tuple.TupleOutput; //导入依赖的package包/类
/**
* Extract the city key from a supplier key/eval pair. The city key
* is stored in the supplier eval, so the supplier key is not used.
*/
public boolean createSecondaryKey(TupleInput primaryKeyInput,
Object valueInput, TupleOutput indexKeyOutput) {
sorcer.core.provider.ProviderRuntime runtime
= (sorcer.core.provider.ProviderRuntime) valueInput;
String providerName;
providerName = runtime.getProviderName();
if (providerName != null) {
indexKeyOutput.writeString(runtime.getProviderName());
return true;
} else {
return false;
}
}