/** * Write out the value of long field * * @param field - field description (name and data type) * @param value - field value */ public void write(FieldBase field, LongFieldValue value) { buf.putLong(value.getLong()); }
/** * Write out the value of long field * * @param field - field description (name and data type) * @param value - field value */ public void write(FieldBase field, LongFieldValue value) { buf.putLong(value.getLong()); }
public static void serializeLongField(JsonGenerator generator, FieldBase field, LongFieldValue value) { serializeLong(generator, field, value.getLong()); }
public static BigDecimal asBigDecimal(NumericFieldValue value) { if (value instanceof ByteFieldValue) { return BigDecimal.valueOf(((ByteFieldValue)value).getByte()); } else if (value instanceof DoubleFieldValue) { return BigDecimal.valueOf(((DoubleFieldValue)value).getDouble()); } else if (value instanceof FloatFieldValue) { return BigDecimal.valueOf(((FloatFieldValue)value).getFloat()); } else if (value instanceof IntegerFieldValue) { return BigDecimal.valueOf(((IntegerFieldValue)value).getInteger()); } else if (value instanceof LongFieldValue) { return BigDecimal.valueOf(((LongFieldValue)value).getLong()); } throw new IllegalArgumentException("Unsupported numeric field value type '" + value.getClass().getName() + "'."); }
@Override protected void doExecute(ExecutionContext ctx) { long input = ((LongFieldValue)ctx.getValue()).getLong(); ctx.setValue(new StringFieldValue(Long.toHexString(input))); }
@Override protected void doExecute(ExecutionContext ctx) { long input = ((LongFieldValue)ctx.getValue()).getLong(); byte[] output = new byte[8]; for (int i = 0; i < output.length; ++i) { output[i] = (byte)(input & 0xffL); input >>>= 8; } String encoded = new Base64(0).encodeToString(output); ctx.setValue(new StringFieldValue(encoded)); }
@Override protected void doExecute(ExecutionContext ctx) { PredicateFieldValue predicate = ((PredicateFieldValue)ctx.getValue()).clone(); IntegerFieldValue arity = (IntegerFieldValue)ctx.getVariable("arity"); LongFieldValue lower_bound = (LongFieldValue)ctx.getVariable("lower_bound"); LongFieldValue upper_bound = (LongFieldValue)ctx.getVariable("upper_bound"); Long lower = lower_bound != null? lower_bound.getLong() : null; Long upper = upper_bound != null? upper_bound.getLong() : null; PredicateOptions options = new PredicateOptions(arity.getInteger(), lower, upper); predicate.setPredicate(optimizer.process(predicate.getPredicate(), options)); ctx.setValue(predicate); }