RLPark 1.0.0
Reinforcement Learning Framework in Java
|
00001 package rlpark.plugin.robot.internal.disco.datagroup; 00002 00003 import rlpark.plugin.robot.internal.disco.drops.Drop; 00004 import rlpark.plugin.robot.internal.disco.drops.DropData; 00005 import rlpark.plugin.robot.internal.sync.LiteByteBuffer; 00006 00007 public abstract class DataObjectGroup<T> extends DataGroup { 00008 public DataObjectGroup(Drop drop) { 00009 this("", drop); 00010 } 00011 00012 public DataObjectGroup(String prefix, Drop drop) { 00013 super(prefix, drop); 00014 } 00015 00016 protected abstract T getValue(LiteByteBuffer byteBuffer, DropData dropData); 00017 00018 public void set(T... values) { 00019 assert values.length == dropDatas.length; 00020 for (int i = 0; i < values.length; i++) 00021 setValue(dropDatas[i], values[i]); 00022 } 00023 00024 public void get(LiteByteBuffer byteBuffer, T[] values) { 00025 assert values.length == dropDatas.length; 00026 for (int i = 0; i < values.length; i++) 00027 values[i] = getValue(byteBuffer, dropDatas[i]); 00028 } 00029 00030 abstract protected void setValue(DropData dropData, T value); 00031 }