RLPark 1.0.0
Reinforcement Learning Framework in Java

DropTime.java

Go to the documentation of this file.
00001 package rlpark.plugin.robot.internal.disco.drops;
00002 
00003 import rlpark.plugin.robot.internal.sync.LiteByteBuffer;
00004 
00005 
00006 
00007 public class DropTime extends DropData {
00008   static final public long startingTime = System.currentTimeMillis();
00009   static final public String TIMELABEL = "Time";
00010   private long time;
00011 
00012   public DropTime() {
00013     this(-1);
00014   }
00015 
00016   public DropTime(int index) {
00017     super(TIMELABEL, false, index);
00018   }
00019 
00020   public void set() {
00021     set(System.currentTimeMillis() - startingTime);
00022   }
00023 
00024   public void set(long time) {
00025     this.time = time;
00026   }
00027 
00028   @Override
00029   public int size() {
00030     return 2 * IntSize;
00031   }
00032 
00033   @Override
00034   public void putData(LiteByteBuffer buffer) {
00035     buffer.putInt((int) time);
00036   }
00037 
00038   public long getData(LiteByteBuffer buffer, int index) {
00039     // long longValue = buffer.getInt(index);
00040     // time = 0xFFFFFFFFL & longValue;
00041     return System.currentTimeMillis();
00042   }
00043 
00044   @Override
00045   public DropData clone(String label, int index) {
00046     return new DropTime(index);
00047   }
00048 
00049   @Override
00050   public String toString() {
00051     return String.valueOf(time()) + "s";
00052   }
00053 
00054   public long time() {
00055     return time;
00056   }
00057 }
 All Classes Namespaces Files Functions Variables Enumerations
Zephyr
RLPark