Java Code Examples for java.io.DataOutput#writeDouble()
The following examples show how to use
java.io.DataOutput#writeDouble() .
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: BrokerTicket.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
public void toData(DataOutput out) throws IOException { out.writeInt(this.id); out.writeInt(this.brokerId); out.writeDouble(this.price); out.writeInt(this.quantity); DataSerializer.writeString(this.ticker, out); DataSerializer.writeString(this.str01, out); DataSerializer.writeString(this.str02, out); DataSerializer.writeString(this.str03, out); DataSerializer.writeString(this.str04, out); DataSerializer.writeString(this.str05, out); DataSerializer.writeString(this.str06, out); DataSerializer.writeString(this.str07, out); DataSerializer.writeString(this.str08, out); DataSerializer.writeString(this.str09, out); DataSerializer.writeString(this.str10, out); DataSerializer.writeString(this.str11, out); DataSerializer.writeString(this.str12, out); DataSerializer.writeString(this.str13, out); DataSerializer.writeString(this.str14, out); DataSerializer.writeString(this.str15, out); }
Example 2
Source File: ColGroupDDC1.java From systemds with Apache License 2.0 | 6 votes |
@Override public void write(DataOutput out, boolean skipDict) throws IOException { int numCols = getNumCols(); int numVals = getNumValues(); out.writeInt(_numRows); out.writeInt(numCols); out.writeInt(numVals); // write col indices for(int i = 0; i < _colIndexes.length; i++) out.writeInt(_colIndexes[i]); // write distinct values if(!skipDict) { for(int i = 0; i < _values.length; i++) out.writeDouble(_values[i]); } // write data for(int i = 0; i < _numRows; i++) out.writeByte(_data[i]); }
Example 3
Source File: ResourceUtil.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 5 votes |
static public void writeDoubles(DataOutput dataOutput, Number[] numbers) throws IOException { for(Number number : numbers){ dataOutput.writeDouble(number.doubleValue()); } }
Example 4
Source File: ModOperation.java From vxquery with Apache License 2.0 | 5 votes |
@Override public void operateDecimalDouble(XSDecimalPointable decp, DoublePointable doublep, DataOutput dOut) throws SystemException, IOException { double value = decp.doubleValue(); value %= doublep.doubleValue(); dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(value); }
Example 5
Source File: SQLDouble.java From gemfirexd-oss with Apache License 2.0 | 5 votes |
@Override public void toData(final DataOutput out) throws IOException { if (!isNull()) { out.writeByte(getTypeId()); out.writeDouble(this.value); return; } this.writeNullDVD(out); }
Example 6
Source File: AddOperation.java From vxquery with Apache License 2.0 | 5 votes |
@Override public void operateDoubleDouble(DoublePointable doublep1, DoublePointable doublep2, DataOutput dOut) throws SystemException, IOException { double value = doublep1.doubleValue(); value += doublep2.doubleValue(); dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(value); }
Example 7
Source File: DivideOperation.java From vxquery with Apache License 2.0 | 5 votes |
@Override public void operateFloatDecimal(FloatPointable floatp1, XSDecimalPointable decp2, DataOutput dOut) throws SystemException, IOException { if (decp2.getDecimalValue() == 0) { throw new SystemException(ErrorCode.FOAR0001); } float value = floatp1.floatValue(); value /= decp2.floatValue(); dOut.write(ValueTag.XS_FLOAT_TAG); dOut.writeDouble(value); }
Example 8
Source File: DoubleArraySerializer.java From util with Apache License 2.0 | 5 votes |
@Override public void write(double[] values, DataOutput out) throws IOException { lengthSerializer.write(values.length, out); for (double val : values) { out.writeDouble(val); } }
Example 9
Source File: SubtractOperation.java From vxquery with Apache License 2.0 | 5 votes |
@Override public void operateIntegerDouble(LongPointable longp, DoublePointable doublep, DataOutput dOut) throws SystemException, IOException { double value = longp.doubleValue(); value -= doublep.doubleValue(); dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(value); }
Example 10
Source File: CM_N_COVCell.java From systemds with Apache License 2.0 | 5 votes |
@Override public void write(DataOutput out) throws IOException { out.writeDouble(cm.w); cm.mean.write(out); cm.m2.write(out); cm.m3.write(out); cm.m4.write(out); cm.mean_v.write(out); cm.c2.write(out); }
Example 11
Source File: DoubleSerializer.java From eagle with Apache License 2.0 | 5 votes |
@Override public void serialize(Object value, DataOutput dataOutput) throws IOException { if (value instanceof Number) { value = ((Number)value).doubleValue(); } dataOutput.writeDouble((double)value); }
Example 12
Source File: FnRoundOperation.java From vxquery with Apache License 2.0 | 5 votes |
@Override public void operateDouble(DoublePointable doublep, DataOutput dOut) throws SystemException, IOException { double value = doublep.getDouble(); if (value < 0 && value >= -0.5) { value = -0.0; } else if (!Double.isNaN(value) && !Double.isInfinite(value) && value != 0.0) { value = Math.round(value); } dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(value); }
Example 13
Source File: MatchedWaypoint.java From brouter with MIT License | 5 votes |
public void writeToStream( DataOutput dos ) throws IOException { dos.writeInt( node1.ilat ); dos.writeInt( node1.ilon ); dos.writeInt( node2.ilat ); dos.writeInt( node2.ilon ); dos.writeInt( crosspoint.ilat ); dos.writeInt( crosspoint.ilon ); dos.writeInt( waypoint.ilat ); dos.writeInt( waypoint.ilon ); dos.writeDouble( radius ); }
Example 14
Source File: MetricDumpSerialization.java From flink with Apache License 2.0 | 5 votes |
private static void serializeHistogram(DataOutput out, QueryScopeInfo info, String name, Histogram histogram) throws IOException { HistogramStatistics stat = histogram.getStatistics(); long min = stat.getMin(); long max = stat.getMax(); double mean = stat.getMean(); double median = stat.getQuantile(0.5); double stddev = stat.getStdDev(); double p75 = stat.getQuantile(0.75); double p90 = stat.getQuantile(0.90); double p95 = stat.getQuantile(0.95); double p98 = stat.getQuantile(0.98); double p99 = stat.getQuantile(0.99); double p999 = stat.getQuantile(0.999); serializeMetricInfo(out, info); out.writeUTF(name); out.writeLong(min); out.writeLong(max); out.writeDouble(mean); out.writeDouble(median); out.writeDouble(stddev); out.writeDouble(p75); out.writeDouble(p90); out.writeDouble(p95); out.writeDouble(p98); out.writeDouble(p99); out.writeDouble(p999); }
Example 15
Source File: FnCeilingOperation.java From vxquery with Apache License 2.0 | 4 votes |
@Override public void operateDouble(DoublePointable doublep, DataOutput dOut) throws SystemException, IOException { dOut.write(ValueTag.XS_DOUBLE_TAG); dOut.writeDouble(Math.ceil(doublep.getDouble())); }
Example 16
Source File: DefaultExternalizableUtil.java From Openfire with Apache License 2.0 | 4 votes |
public static void writeObject(DataOutput out, Object obj) throws IOException { if (obj == null) { out.writeByte(0); } else if (obj instanceof Long) { out.writeByte(1); out.writeLong((Long) obj); } else if (obj instanceof Integer) { out.writeByte(2); out.writeInt((Integer) obj); } else if (obj instanceof String) { out.writeByte(3); out.writeUTF((String) obj); } else if (obj instanceof Double) { out.writeByte(4); out.writeDouble((Double) obj); } else if (obj instanceof Float) { out.writeByte(5); out.writeFloat((Float) obj); } else if (obj instanceof Boolean) { out.writeByte(6); out.writeBoolean((Boolean) obj); } else if (obj instanceof Date) { out.writeByte(8); out.writeLong(((Date) obj).getTime()); } else if(obj instanceof byte[]){ out.writeByte(9); // write length out.writeInt(((byte[]) obj).length); // write byte array out.write((byte[]) obj); } else { out.writeByte(10); ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(bos); oos.writeObject(obj); oos.close(); byte[] buf = bos.toByteArray(); out.writeInt(buf.length); out.write(buf); } }
Example 17
Source File: DoubleType.java From stratosphere with Apache License 2.0 | 4 votes |
@Override public void write(DataOutput out) throws IOException { out.writeDouble(this.value); }
Example 18
Source File: KahanObject.java From systemds with Apache License 2.0 | 4 votes |
public void write(DataOutput out) throws IOException { out.writeDouble(_sum); out.writeDouble(_correction); }
Example 19
Source File: GroupMax.java From MapReduce-Demo with MIT License | 4 votes |
@Override public void write(DataOutput out) throws IOException { // TODO Auto-generated method stub out.writeUTF(order_id); out.writeDouble(amount.get()); }
Example 20
Source File: LDouble.java From semafor-semantic-parser with GNU General Public License v3.0 | 4 votes |
public void write(DataOutput out) throws IOException { out.writeDouble(value); out.writeBoolean(sign); }