RLPark 1.0.0
Reinforcement Learning Framework in Java

DropInteger.java

Go to the documentation of this file.
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 DropInteger extends DropData implements ScalarReader, ScalarWriter {
00010   protected int value;
00011 
00012   public DropInteger(String label) {
00013     this(label, false, -1);
00014   }
00015 
00016   public DropInteger(String label, int value) {
00017     this(label, value, -1);
00018   }
00019 
00020   public DropInteger(String label, int value, int index) {
00021     this(label, true, index);
00022     this.value = value;
00023   }
00024 
00025   protected DropInteger(String label, boolean readOnly, int index) {
00026     super(label, readOnly, index);
00027   }
00028 
00029   @Override
00030   public void setDouble(double value) {
00031     assert !readOnly;
00032     this.value = (int) value;
00033   }
00034 
00035   @Override
00036   public DropData clone(String label, int index) {
00037     if (readOnly)
00038       return new DropInteger(label, value, index);
00039     return new DropInteger(label, false, index);
00040   }
00041 
00042   @Override
00043   public int getInt(LiteByteBuffer buffer) {
00044     return buffer.getInt(index);
00045   }
00046 
00047   @Override
00048   public double getDouble(LiteByteBuffer buffer) {
00049     return getInt(buffer);
00050   }
00051 
00052   @Override
00053   public void putData(LiteByteBuffer buffer) {
00054     buffer.putInt(value);
00055   }
00056 
00057   @Override
00058   public int size() {
00059     return IntSize;
00060   }
00061 
00062   @Override
00063   public Range range() {
00064     return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE);
00065   }
00066 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark