Java 类com.badlogic.gdx.math.FloatCounter 实例源码

项目:gdx-cclibs    文件:FloatCounterSerializer.java   
@Override
public FloatCounter read(Kryo kryo, Input input, Class<FloatCounter> type) {
    WindowedMean windowedMean = kryo.readObjectOrNull(input, WindowedMean.class);
    FloatCounter floatCounter = new FloatCounter(windowedMean == null ? 0 : windowedMean.getWindowSize());
    if (windowedMean != null) {
        float[] windowedMeanValues = windowedMean.getWindowValues();
        for (float f : windowedMeanValues) { // restores the private WindowedMean
            floatCounter.put(f);
        }
    }
    floatCounter.count = input.readInt();
    floatCounter.total = input.readFloat();
    floatCounter.min = input.readFloat();
    floatCounter.max = input.readFloat();
    floatCounter.average = input.readFloat();
    floatCounter.latest = input.readFloat();
    floatCounter.value = input.readFloat();
    return floatCounter;
}
项目:gdx-cclibs    文件:FloatCounterSerializer.java   
@Override
public FloatCounter copy (Kryo kryo, FloatCounter original) {
    WindowedMean windowedMean = original.mean;
    FloatCounter floatCounter = new FloatCounter(windowedMean == null ? 0 : windowedMean.getWindowSize());
    if (windowedMean != null) {
        float[] windowedMeanValues = windowedMean.getWindowValues();
        for (float f : windowedMeanValues) { // restores the private WindowedMean
            floatCounter.put(f);
        }
    }
    floatCounter.count = original.count;
    floatCounter.total = original.total;
    floatCounter.min = original.min;
    floatCounter.max = original.max;
    floatCounter.average = original.average;
    floatCounter.latest = original.latest;
    floatCounter.value = original.value;
    return floatCounter;
}
项目:gdx-cclibs    文件:FloatCounterSerializer.java   
@Override
public void write(Kryo kryo, Output output, FloatCounter floatCounter) {
    kryo.writeObjectOrNull(output, floatCounter.mean, WindowedMean.class);
    output.writeInt(floatCounter.count);
    output.writeFloat(floatCounter.total);
    output.writeFloat(floatCounter.min);
    output.writeFloat(floatCounter.max);
    output.writeFloat(floatCounter.average);
    output.writeFloat(floatCounter.latest);
    output.writeFloat(floatCounter.value);
}
项目:tafl    文件:TaflGameSimulation.java   
private static String toString(FloatCounter counter) {
    StringBuilder sb = new StringBuilder();
    sb.append("{count = " + counter.count);
    sb.append(", total = " + counter.total);
    sb.append(", min = " + counter.min);
    sb.append(", max = " + counter.max);
    sb.append(", average = " + counter.average);
    sb.append(", value = " + counter.value);
    sb.append("}");
    return sb.toString();
}
项目:libgdxcn    文件:PerformanceCounter.java   
public PerformanceCounter (final String name, final int windowSize) {
    this.name = name;
    this.time = new FloatCounter(windowSize);
    this.load = new FloatCounter(1);
}
项目:tafl    文件:AISearchAgent.java   
public AISearchAgent(
        TranspositionTable transpositionTable,
        HistoryTable historyTable,
        BoardEvaluator<U> evaluator,
        RulesChecker rulesChecker,
        int depth) {
    this.transTable = transpositionTable;
    this.historyTable = historyTable;
    this.evaluator = evaluator;
    this.rulesChecker = rulesChecker;
    this.depth = depth;
    this.random = new Random();

    depthCounters = new Array<FloatCounter>();
    for (int i = 0; i < depth; i++) {
        depthCounters.add(new FloatCounter(0){
            @Override
            public String toString() {
                StringBuilder sb = new StringBuilder();
                sb.append("{count = " + count);
                sb.append(", total = " + total);
                sb.append(", min = " + min);
                sb.append(", max = " + max);
                sb.append(", average = " + average);
                sb.append(", value = " + value);
                sb.append("}");
                return sb.toString();
            }
        });
    }

    this.arrayPool = new Pool<Array<Move>>(){
        @Override
        protected Array<Move> newObject() {
            return new Array<Move>();
        }

        @Override
        public void free (Array<Move> object) {
            object.size = 0;
            super.free(object);
        }
    };
}
项目:ModularArmour    文件:PerformanceCounter.java   
public PerformanceCounter(final String name, final int windowSize) {
    this.name = name;
    this.time = new FloatCounter(windowSize);
    this.load = new FloatCounter(1);
}