RLPark 1.0.0
Reinforcement Learning Framework in Java
|
00001 package rlpark.plugin.robot.internal.disco.drops; 00002 00003 00004 import rlpark.plugin.rltoys.math.ranges.Range; 00005 import rlpark.plugin.robot.internal.disco.datatype.ScalarReader; 00006 import rlpark.plugin.robot.internal.disco.datatype.ScalarWriter; 00007 import rlpark.plugin.robot.internal.sync.LiteByteBuffer; 00008 00009 public class DropFloat extends DropData implements ScalarReader, ScalarWriter { 00010 protected float value; 00011 00012 public DropFloat(String label) { 00013 this(label, -1); 00014 } 00015 00016 protected DropFloat(String label, int index) { 00017 super(label, false, index); 00018 } 00019 00020 public DropFloat(String label, float value, int index) { 00021 super(label, true, index); 00022 this.value = value; 00023 } 00024 00025 @Override 00026 public DropData clone(String label, int index) { 00027 if (readOnly) 00028 return new DropFloat(label, value, index); 00029 return new DropFloat(label, index); 00030 } 00031 00032 @Override 00033 public int getInt(LiteByteBuffer buffer) { 00034 return (int) getDouble(buffer); 00035 } 00036 00037 @Override 00038 public void putData(LiteByteBuffer buffer) { 00039 buffer.putFloat(value); 00040 } 00041 00042 @Override 00043 public int size() { 00044 return FloatSize; 00045 } 00046 00047 @Override 00048 public double getDouble(LiteByteBuffer buffer) { 00049 return buffer.getFloat(index); 00050 } 00051 00052 @Override 00053 public void setDouble(double value) { 00054 this.value = (float) value; 00055 } 00056 00057 @Override 00058 public Range range() { 00059 return new Range(-Float.MAX_VALUE, Float.MAX_VALUE); 00060 } 00061 }