Java Code Examples for com.esotericsoftware.kryo.io.Input#readFloat()

The following examples show how to use com.esotericsoftware.kryo.io.Input#readFloat() . 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: FloatOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
@Override
public MapMetaData<Float> read(Kryo kryo, Input input, Class<MapMetaData<Float>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Float>> mapDataList = new ArrayList<>(thatMapSegNum);
        thatMapMetaData.setMapDataList(mapDataList);

        for (int i = 0; i < thatMapSegNum; i++) {
            int dataNum = thatMapMetaData.getDataNum(i);
            Map<String, Float> mapData = new HashMap<>(dataNum);
            mapDataList.add(mapData);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Float val = input.readFloat();
                mapData.put(key, val);
            }
        }
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatMapMetaData;
}
 
Example 2
Source File: FeatureSerializer.java    From StormCV with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Override
protected Feature readObject(Kryo kryo, Input input, Class<Feature> clas, long requestId, String streamId, long sequenceNr) throws Exception {
	String name = input.readString();
	long duration = input.readLong();
	List<Descriptor> sparseDescriptors = kryo.readObject(input, ArrayList.class);
	
		int xl = input.readInt();
		float[][][] denseDescriptor = null;
		if(xl > 0){
			int yl = input.readInt();
			int zl = input.readInt();
			denseDescriptor = new float[xl][yl][zl];
			for(int x=0; x<xl; x++){
				for(int y=0; y<yl; y++){
					for(int z=0; z<zl; z++){
						denseDescriptor[x][y][z] = input.readFloat();
					}
				}
			}
		}
	
	Feature feature = new Feature(streamId, sequenceNr, name, duration, sparseDescriptors, denseDescriptor);
	feature.setRequestId(requestId);
	return feature;
}
 
Example 3
Source File: FloatOperand.java    From ytk-mp4j with MIT License 6 votes vote down vote up
public ArrayMetaData<float[]> read(Kryo kryo, Input input, Class<ArrayMetaData<float[]>> type) {
    try {
        float[] arrData = arrayMetaData.getArrData();
        thatArrMetaData = arrayMetaData.recv(input);
        int arrSegNum = thatArrMetaData.getSegNum();
        for (int i = 0; i < arrSegNum; i++) {
            int from = thatArrMetaData.getFrom(i);
            int to = thatArrMetaData.getTo(i);
            for (int j = from; j < to; j++) {
                arrData[j] = input.readFloat();
            }
        }
        thatArrMetaData.setArrData(arrData);
    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatArrMetaData;

}
 
Example 4
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public Interpolation.ElasticOut read(Kryo kryo, Input input, Class<Interpolation.ElasticOut> type) {
	return new Interpolation.ElasticOut(
		input.readFloat(),
		input.readFloat(),
		MathUtils.round(input.readFloat()),
		input.readFloat());
}
 
Example 5
Source File: IntHistogram.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private CDF( final Kryo kryo, final Input input ) {
    final int len = input.readInt();
    cdfFractions = new float[len];
    for ( int idx = 0; idx != len; ++idx ) {
        cdfFractions[idx] = input.readFloat();
    }
    nCounts = input.readLong();
}
 
Example 6
Source File: LibraryStatistics.java    From gatk with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private LibraryStatistics( final Kryo kryo, final Input input ) {
    fragmentSizeCDF = new IntHistogram.CDF.Serializer().read(kryo, input, IntHistogram.CDF.class);
    median = fragmentSizeCDF.median();
    negativeMAD = fragmentSizeCDF.leftMedianDeviation(median);
    positiveMAD = fragmentSizeCDF.rightMedianDeviation(median);
    coverage = input.readFloat();
    meanBaseQuality = input.readFloat();
    nReads = input.readLong();
    readStartFrequency = input.readFloat();
}
 
Example 7
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 5 votes vote down vote up
@Override
public Interpolation.Elastic read(Kryo kryo, Input input, Class<Interpolation.Elastic> type) {
	return new Interpolation.Elastic(
		input.readFloat(),
		input.readFloat(),
		MathUtils.round(input.readFloat()),
		input.readFloat());
}
 
Example 8
Source File: WeightApproximateQuantile.java    From ytk-learn with MIT License 5 votes vote down vote up
@Override
public Summary read(Kryo kryo, Input input, Class<Summary> type) {
    Summary summary = new Summary();
    int len = input.readInt();
    summary.value = new float[len];
    for (int i = 0; i < len; i++) {
        summary.value[i] = input.readFloat();
    }

    len = input.readInt();
    summary.rmin = new double[len];
    for (int i = 0; i < len; i++) {
        summary.rmin[i] = input.readDouble();
    }

    len = input.readInt();
    summary.rmax = new double[len];
    for (int i = 0; i < len; i++) {
        summary.rmax[i] = input.readDouble();
    }

    len = input.readInt();
    summary.w = new float[len];
    for (int i = 0; i < len; i++) {
        summary.w[i] = input.readFloat();
    }

    summary.capacity = input.readInt();
    summary.cursor = input.readInt();
    summary.B = input.readDouble();
    summary.exact = input.readBoolean();
    summary.eps = input.readDouble();

    summary.poolMap = new TreeMap<>();
    PoolNode poolNode = summary.getPoolNode(summary.capacity);

    return summary;
}
 
Example 9
Source File: SplitInfo.java    From ytk-learn with MIT License 5 votes vote down vote up
@Override
public SplitInfo read(Kryo kryo, Input input, Class<SplitInfo> type) {
    SplitInfo splitInfo = new SplitInfo();
    splitInfo.lossChg = input.readFloat();
    splitInfo.splitIndex = input.readInt();
    splitInfo.splitValue = input.readFloat();
    int len = input.readInt();
    splitInfo.splitSlotInterval = new int[len];
    for (int i = 0; i < len; i++) {
        splitInfo.splitSlotInterval[i] = input.readInt();
    }
    return splitInfo;
}
 
Example 10
Source File: FloatOperand.java    From ytk-mp4j with MIT License 5 votes vote down vote up
public MapMetaData<Float> read(Kryo kryo, Input input, Class<MapMetaData<Float>> type) {
    try {
        thatMapMetaData = mapMetaData.recv(input);
        int thatMapSegNum = thatMapMetaData.getSegNum();
        List<Map<String, Float>> thatMapListData = new ArrayList<>(thatMapSegNum);
        List<Integer> thatDataNums = new ArrayList<>(thatMapSegNum);
        for (int i = 0; i < thatMapSegNum; i++) {
            Map<String, Float> thisMapData = mapMetaData.getMapDataList().get(i);
            int dataNum = thatMapMetaData.getDataNum(i);
            for (int j = 0; j < dataNum; j++) {
                String key = input.readString();
                Float val = input.readFloat();

                Float thisVal = thisMapData.get(key);
                if (thisVal == null) {
                    thisMapData.put(key, val);
                } else {
                    thisMapData.put(key, operator.apply(thisVal, val));
                }
            }
            thatMapListData.add(thisMapData);
            thatDataNums.add(thisMapData.size());
        }

        thatMapMetaData.setMapDataList(thatMapListData);
        thatMapMetaData.setDataNums(thatDataNums);

    } catch (IOException e) {
        LOG.error("double array read exception", e);
        System.exit(1);
    }
    return thatMapMetaData;
}
 
Example 11
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolation.ExpOut read(Kryo kryo, Input input, Class<Interpolation.ExpOut> type) {
	return new Interpolation.ExpOut(input.readFloat(), input.readFloat());
}
 
Example 12
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolation.ExpIn read(Kryo kryo, Input input, Class<Interpolation.ExpIn> type) {
	return new Interpolation.ExpIn(input.readFloat(), input.readFloat());
}
 
Example 13
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public GaussianFloatDistribution read (Kryo kryo, Input input, Class<GaussianFloatDistribution> type) {
	return new GaussianFloatDistribution(input.readFloat(), input.readFloat());
}
 
Example 14
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolation.Exp read(Kryo kryo, Input input, Class<Interpolation.Exp> type) {
	return new Interpolation.Exp(input.readFloat(), input.readFloat());
}
 
Example 15
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolation.Swing read(Kryo kryo, Input input, Class<Interpolation.Swing> type) {
	return new Interpolation.Swing(input.readFloat());
}
 
Example 16
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolation.SwingIn read(Kryo kryo, Input input, Class<Interpolation.SwingIn> type) {
	return new Interpolation.SwingIn(input.readFloat());
}
 
Example 17
Source File: OrionKryoSerialization.java    From artemis-odb-orion with Apache License 2.0 4 votes vote down vote up
@Override
public Interpolation.SwingOut read(Kryo kryo, Input input, Class<Interpolation.SwingOut> type) {
	return new Interpolation.SwingOut(input.readFloat());
}
 
Example 18
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public UniformFloatDistribution read (Kryo kryo, Input input, Class<UniformFloatDistribution> type) {
	return new UniformFloatDistribution(input.readFloat(), input.readFloat());
}
 
Example 19
Source File: ReadMetadata.java    From gatk with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private ReadMetadata( final Kryo kryo, final Input input ) {
    final int crossContigIgnoreSetSize = input.readInt();
    this.crossContigIgnoreSet = new HashSet<>(SVUtils.hashMapCapacity(crossContigIgnoreSetSize));
    for ( int idx = 0; idx != crossContigIgnoreSetSize; ++idx ) {
        crossContigIgnoreSet.add(input.readInt());
    }

    final int groupMapSize = input.readInt();
    readGroupToLibrary = new HashMap<>(SVUtils.hashMapCapacity(groupMapSize));
    for ( int idx = 0; idx != groupMapSize; ++idx ) {
        final String groupName = input.readString();
        final String libName = input.readString();
        readGroupToLibrary.put(groupName, libName);
    }

    final int contigMapSize = input.readInt();
    contigNameToID = new HashMap<>(SVUtils.hashMapCapacity(contigMapSize));
    for ( int idx = 0; idx != contigMapSize; ++idx ) {
        final String contigName = input.readString();
        final int contigId = input.readInt();
        contigNameToID.put(contigName, contigId);
    }
    contigIDToName = buildContigIDToNameArray(contigNameToID);

    nReads = input.readLong();
    avgReadLen = input.readInt();
    nRefBases = input.readLong();
    maxReadsInPartition = input.readLong();
    coverage = input.readFloat();
    meanBaseQuality = input.readFloat();

    final int nPartitions = input.readInt();
    partitionBounds = new PartitionBounds[nPartitions];
    final PartitionBounds.Serializer boundsSerializer = new PartitionBounds.Serializer();
    for ( int idx = 0; idx != nPartitions; ++idx ) {
        partitionBounds[idx] = boundsSerializer.read(kryo, input, PartitionBounds.class);
    }

    final int libMapSize = input.readInt();
    final LibraryStatistics.Serializer statsSerializer = new LibraryStatistics.Serializer();
    libraryToFragmentStatistics = new HashMap<>(SVUtils.hashMapCapacity(libMapSize));
    for ( int idx = 0; idx != libMapSize; ++idx ) {
        final String libraryName = input.readString();
        final LibraryStatistics stats = statsSerializer.read(kryo, input, LibraryStatistics.class);
        libraryToFragmentStatistics.put(libraryName, stats);
    }

}
 
Example 20
Source File: KryoUtils.java    From gdx-ai with Apache License 2.0 4 votes vote down vote up
@Override
public TriangularFloatDistribution read (Kryo kryo, Input input, Class<TriangularFloatDistribution> type) {
	return new TriangularFloatDistribution(input.readFloat(), input.readFloat(), input.readFloat());
}