@Test public void testGetValue() { DataReservoir reservoir = new DataReservoir(); reservoir.updateReservoir(1, 4, 4); reservoir.updateReservoir(2, 4, 12); reservoir.updateReservoir(3, 4, 4); reservoir.updateReservoir(4, 4, 100); ValueArray result = reservoir.getValue("epoch||4~sigma||2.0~obs||3").asArray(); assertEquals(5, result.size()); assertEquals(86, DoubleMath.roundToLong(result.get(0).asDouble().getDouble(), RoundingMode.HALF_UP)); assertEquals(100, result.get(1).asLong().getLong()); assertEquals(7, DoubleMath.roundToLong(result.get(2).asDouble().getDouble(), RoundingMode.HALF_UP)); assertEquals(4, DoubleMath.roundToLong(result.get(3).asDouble().getDouble(), RoundingMode.HALF_UP)); assertEquals(14, result.get(4).asLong().getLong()); assertEquals(0, reservoir.getValue("mode||get~epoch||0").asLong().getLong()); assertEquals(4, reservoir.getValue("mode||get~epoch||1").asLong().getLong()); assertEquals(12, reservoir.getValue("mode||get~epoch||2").asLong().getLong()); assertEquals(4, reservoir.getValue("mode||get~epoch||3").asLong().getLong()); assertEquals(100, reservoir.getValue("mode||get~epoch||4").asLong().getLong()); assertEquals(0, reservoir.getValue("mode||get~epoch||5").asLong().getLong()); }
@Override public ValueObject getValue(String key) { if (key == null) { return null; } ValueObject value = generateValueObject(key, "||"); if (value instanceof DataReservoirValue) { DataReservoirValue dataReservoirValue = (DataReservoirValue) value; value = dataReservoirValue.setDoubleToLongClone(true).setRawClone(false); } return value; }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public ValueObject getValue(String key) { if (key == null) { return null; } ValueObject value = generateValueObject(key, "||"); if (value instanceof DataReservoirValue) { DataReservoirValue dataReservoirValue = (DataReservoirValue) value; value = dataReservoirValue.setDoubleToLongClone(true).setRawClone(false); } return value; } }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public ValueObject getValue(String key) { if (key == null) { return null; } ValueObject value = generateValueObject(key, "||"); if (value instanceof DataReservoirValue) { DataReservoirValue dataReservoirValue = (DataReservoirValue) value; value = dataReservoirValue.setDoubleToLongClone(true).setRawClone(false); } return value; } DataReservoir();  DataReservoir(DataReservoir other);  DataReservoir(long minEpoch, int[] reservoir); }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public ValueObject getValue(String key) { if (key == null) { return null; } ValueObject value = generateValueObject(key, "||"); if (value instanceof DataReservoirValue) { DataReservoirValue dataReservoirValue = (DataReservoirValue) value; value = dataReservoirValue.setDoubleToLongClone(true).setRawClone(false); } return value; } DataReservoir();  DataReservoir(DataReservoir other);  DataReservoir(long minEpoch, int[] reservoir); DataReservoir merge(DataReservoir other); @Override boolean updateChildData(DataTreeNodeUpdater state,
            DataTreeNode childNode, DataReservoir.Config conf); @Override ValueObject getValue(String key); @Override List<DataTreeNode> getNodes(DataTreeNode parent, String key); @Override byte[] bytesEncode(long version); @Override void bytesDecode(byte[] b, long version); }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public ValueObject getValue(String key) { if (key == null) { return null; } ValueObject value = generateValueObject(key, "||"); if (value instanceof DataReservoirValue) { DataReservoirValue dataReservoirValue = (DataReservoirValue) value; value = dataReservoirValue.setDoubleToLongClone(true).setRawClone(false); } return value; } DataReservoir();  DataReservoir(DataReservoir other);  DataReservoir(long minEpoch, int[] reservoir); DataReservoir merge(DataReservoir other); @Override boolean updateChildData(DataTreeNodeUpdater state,
            DataTreeNode childNode, DataReservoir.Config conf); @Override ValueObject getValue(String key); @Override List<DataTreeNode> getNodes(DataTreeNode parent, String key); @Override byte[] bytesEncode(long version); @Override void bytesDecode(byte[] b, long version);  }