Example usage for java.io ObjectOutput writeDouble

List of usage examples for java.io ObjectOutput writeDouble

Introduction

In this page you can find the example usage for java.io ObjectOutput writeDouble.

Prototype

void writeDouble(double v) throws IOException;

Source Link

Document

Writes a double value, which is comprised of eight bytes, to the output stream.

Usage

From source file:net.openhft.chronicle.wire.benchmarks.Data.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    out.writeDouble(price);
    out.writeLong(longInt);/*  ww w.  j a  v  a2s  .c o m*/
    out.writeInt(smallInt);
    out.writeBoolean(flag);
    out.writeObject(side);
    out.writeObject(getText());
}

From source file:hivemall.fm.FFMPredictionModel.java

@Override
public void writeExternal(@Nonnull ObjectOutput out) throws IOException {
    out.writeDouble(_w0);
    final int factors = _factors;
    out.writeInt(factors);//from   w w w.j a v a2  s. c  o  m
    out.writeInt(_numFeatures);
    out.writeInt(_numFields);

    int used = _map.size();
    out.writeInt(used);

    final int[] keys = _map.getKeys();
    final int size = keys.length;
    out.writeInt(size);

    final byte[] states = _map.getStates();
    writeStates(states, out);

    final long[] values = _map.getValues();

    final HeapBuffer buf = _buf;
    final Entry e = new Entry(buf, factors);
    final float[] Vf = new float[factors];
    for (int i = 0; i < size; i++) {
        if (states[i] != IntOpenHashTable.FULL) {
            continue;
        }
        ZigZagLEB128Codec.writeSignedInt(keys[i], out);
        e.setOffset(values[i]);
        writeEntry(e, factors, Vf, out);
    }

    // help GC
    this._map = null;
    this._buf = null;
}

From source file:com.splicemachine.derby.impl.sql.execute.operations.SpliceBaseOperation.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    SpliceLogUtils.trace(LOG, "writeExternal");
    out.writeDouble(optimizerEstimatedCost);
    out.writeDouble(optimizerEstimatedRowCount);
    out.writeObject(operationInformation);
    out.writeBoolean(isTopResultSet);/* w  w  w  .ja  va 2  s. co m*/
}

From source file:es.udc.gii.common.eaf.algorithm.population.Individual.java

/**
 * This method is called whenever an instance of this class has to be serialized.<p>
 * /*from w w w.  j  ava  2  s . c  o m*/
 * It might write to the output <code>out</code> the evaluation results
 * or the genotype information or both, deppending on the value of 
 * Individual#getSerializeEvalResults and Individual#getSerializeGenotype,
 * which are always writen at the beginning of the output to know later what
 * type of information is contained in the data.<p>
 * 
 * Subclasses should override this method if they introduce new attibutes.
 * Remember to call <code>super.writeExternal()</code> in order to
 * be sure that the state of the parent class is serialized.    
 * 
 * @param out - DataOutput to write the serialized bytes to.
 * @throws java.io.IOException
 */
@Override
public void writeExternal(ObjectOutput out) throws IOException {

    /* Phenotype serialized? */
    out.writeBoolean(this.serializeEvalResults);

    /* Genotype serialized? */
    out.writeBoolean(this.serializeGenotype);

    if (this.serializeEvalResults) {
        /* Serialize number of violated constraints */
        out.writeInt(this.violatedConstraints);

        /* Serialize fitness */
        out.writeDouble(this.fitness);

        /* Serialize objective values */
        if (this.objectives == null) {
            out.writeInt(-1);
        } else {
            out.writeInt(this.objectives.size());
            for (Double d : this.objectives) {
                out.writeDouble(d.doubleValue());
            }
        }

        /* Serialize constraint values */
        if (this.constraints == null) {
            out.writeInt(-1);
        } else {
            out.writeInt(this.constraints.size());
            for (Double d : this.constraints) {
                out.writeDouble(d.doubleValue());
            }
        }
    }

    if (this.serializeGenotype) {
        /* Serialize the chromosomes */
        if (this.chromosomes == null) {
            out.writeInt(-1);
        } else {
            out.writeInt(this.chromosomes.length);
            for (int i = 0; i < this.chromosomes.length; i++) {
                int genes = this.chromosomes[i].getNumElements();
                out.writeInt(genes);

                for (int j = 0; j < genes; j++) {
                    out.writeDouble(this.chromosomes[i].getElement(j));
                }
            }
        }
    }

}

From source file:gnu.trove.map.custom_hash.TObjectDoubleCustomHashMap.java

public void writeExternal(ObjectOutput out) throws IOException {
    // VERSION//  w  w  w  .  j  a v  a  2s  .  c o m
    out.writeByte(0);

    // SUPER
    super.writeExternal(out);

    // STRATEGY
    out.writeObject(strategy);

    // NO_ENTRY_VALUE
    out.writeDouble(no_entry_value);

    // NUMBER OF ENTRIES
    out.writeInt(_size);

    // ENTRIES
    for (int i = _set.length; i-- > 0;) {
        if (_set[i] != REMOVED && _set[i] != FREE) {
            out.writeObject(_set[i]);
            out.writeDouble(_values[i]);
        }
    }
}

From source file:com.joey.software.regionSelectionToolkit.controlers.ImageProfileTool.java

@Override
public void writeExternal(ObjectOutput out) throws IOException {
    int version = 1;
    out.writeInt(version);/*from   w  w w . j  a v a2 s. com*/

    out.writeInt(dataPoints);
    out.writeInt(crossColor.getRGB());
    out.writeDouble(pointSize);

    out.writeInt(value.length);
    for (int i = 0; i < value.length; i++) {
        out.writeFloat(value[i]);
    }

    out.writeInt(selectionData.length);
    for (int i = 0; i < selectionData.length; i++) {
        out.writeFloat(selectionData[i]);
    }

    out.writeInt(useData.length);
    for (int i = 0; i < useData.length; i++) {
        out.writeBoolean(useData[i]);
    }

    out.writeDouble((Double) offset.getValue());
    out.writeBoolean(showOffset.isSelected());

}

From source file:org.knime.al.util.noveltydetection.kernel.KernelCalculator.java

@Override
public void writeExternal(final ObjectOutput out) throws IOException {
    // write kernelFunction
    out.writeUTF(m_kernelFunction.getClass().getName());
    m_kernelFunction.writeExternal(out);

    // write trainingData
    // rows//ww  w  . j  av  a2s .  co m
    out.writeInt(m_rowCount);
    // columns
    out.writeInt(m_colCount);
    // data
    for (final double[] row : m_trainingData) {
        for (final double col : row) {
            out.writeDouble(col);
        }
    }

}

From source file:org.knime.al.util.noveltydetection.knfst.KNFST.java

@Override
public void writeExternal(final ObjectOutput arg0) throws IOException {
    // write kernel
    arg0.writeUTF(m_kernel.getClass().getName());
    m_kernel.writeExternal(arg0);/*from   ww  w  .j  ava  2  s  .  c  om*/

    // write projection
    // rows
    arg0.writeInt(m_projection.getRowDimension());
    // columns
    arg0.writeInt(m_projection.getColumnDimension());
    // data
    final double[][] projData = m_projection.getData();
    for (final double[] row : projData) {
        for (final double cell : row) {
            arg0.writeDouble(cell);
        }
    }

    // write targetPoints
    // rows
    arg0.writeInt(m_targetPoints.getRowDimension());
    // columns
    arg0.writeInt(m_targetPoints.getColumnDimension());
    // data
    final double[][] tarData = m_targetPoints.getData();
    for (final double[] row : tarData) {
        for (final double cell : row) {
            arg0.writeDouble(cell);
        }
    }

    // write betweenClassDistances
    // length
    arg0.writeInt(m_betweenClassDistances.length);
    // data
    for (final double dist : m_betweenClassDistances) {
        arg0.writeDouble(dist);
    }
}