本文整理汇总了Java中com.sleepycat.bind.tuple.TupleOutput.writeFloat方法的典型用法代码示例。如果您正苦于以下问题:Java TupleOutput.writeFloat方法的具体用法?Java TupleOutput.writeFloat怎么用?Java TupleOutput.writeFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sleepycat.bind.tuple.TupleOutput
的用法示例。
在下文中一共展示了TupleOutput.writeFloat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
}
示例3: objectToEntry
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
public void objectToEntry(Object object, TupleOutput to) {
Inventory inventory = (Inventory)object;
to.writeString(inventory.getSku());
to.writeString(inventory.getItemName());
to.writeString(inventory.getCategory());
to.writeString(inventory.getVendor());
to.writeInt(inventory.getVendorInventory());
to.writeFloat(inventory.getVendorPrice());
}
示例4: writeValue
import com.sleepycat.bind.tuple.TupleOutput; //导入方法依赖的package包/类
private static void writeValue(final TupleOutput to, final Object value) {
if (value == null) {
to.writeString("NULL");
} else if (value instanceof Float) {
to.writeString("F");
to.writeFloat(Float.class.cast(value));
} else if (value instanceof Long) {
to.writeString("L");
to.writeLong(Long.class.cast(value));
} else if (value instanceof Integer) {
to.writeString("I");
to.writeInt(Integer.class.cast(value));
} else if (value instanceof Double) {
to.writeString("D");
to.writeDouble(Double.class.cast(value));
} else if (value instanceof String) {
to.writeString("S");
to.writeString(String.class.cast(value));
} else if (value instanceof Set) {
to.writeString("*");
to.writeInt(Set.class.cast(value).size());
for (final Object item : Set.class.cast(value)) {
writeValue(to, item);
}
} else {
throw new IllegalArgumentException(" type " + value.getClass() + " non reconnu");
}
}