@Test public void testGetNodes() { DataReservoir reservoir = new DataReservoir(); reservoir.updateReservoir(1, 4, 4); reservoir.updateReservoir(2, 4, 12); reservoir.updateReservoir(3, 4, 4); reservoir.updateReservoir(4, 4, 100); List<DataTreeNode> result = reservoir.getNodes(null, "epoch=4~sigma=2.0~obs=3"); assertEquals(1, result.size()); DataTreeNode node = result.iterator().next(); assertEquals(node.getName(), "delta"); assertEquals(86, node.getCounter()); node = node.getIterator().next(); assertEquals(node.getName(), "measurement"); assertEquals(100, node.getCounter()); node = node.getIterator().next(); assertEquals(node.getName(), "mean"); assertEquals(7, node.getCounter()); node = node.getIterator().next(); assertEquals(node.getName(), "stddev"); assertEquals(4, node.getCounter()); node = node.getIterator().next(); assertEquals(node.getName(), "threshold"); assertEquals(14, node.getCounter()); }
@Override public List<DataTreeNode> getNodes(DataTreeNode parent, String key) { if (key == null) { return null; } DataReservoirValue value = (DataReservoirValue) generateValueObject(key, "="); return computeResult(value); }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public List<DataTreeNode> getNodes(DataTreeNode parent, String key) { if (key == null) { return null; } DataReservoirValue value = (DataReservoirValue) generateValueObject(key, "="); return computeResult(value); } }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public List<DataTreeNode> getNodes(DataTreeNode parent, String key) { if (key == null) { return null; } DataReservoirValue value = (DataReservoirValue) generateValueObject(key, "="); return computeResult(value); } DataReservoir();  DataReservoir(DataReservoir other);  DataReservoir(long minEpoch, int[] reservoir); }
DataReservoir extends TreeNodeData<DataReservoir.Config> implements BytesCodable { @Override public List<DataTreeNode> getNodes(DataTreeNode parent, String key) { if (key == null) { return null; } DataReservoirValue value = (DataReservoirValue) generateValueObject(key, "="); return computeResult(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 List<DataTreeNode> getNodes(DataTreeNode parent, String key) { if (key == null) { return null; } DataReservoirValue value = (DataReservoirValue) generateValueObject(key, "="); return computeResult(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);  }