@Test public void testGetElement() { System.out.println("getElement"); long value = 100L; GraphRowSumValues instance = new GraphRowSumValues(); AbstractGraphPanelChartElement expResult = new GraphPanelChartSumElement(10); instance.add(value, 10); instance.getElement(value); Assert.assertTrue(instance.getElement(value).getValue() == expResult.getValue()); }
@Override public AbstractGraphPanelChartElement getElement(long value) { if (!isRollingSum) { return values.get(value); } else { if (!values.containsKey(value)) { return null; } else { long sum = 0; Iterator<Entry<Long, GraphPanelChartSumElement>> it = values.entrySet().iterator(); boolean valueReached = false; while (it.hasNext() && !valueReached) { Entry<Long, GraphPanelChartSumElement> entry = it.next(); sum += entry.getValue().getValue(); if (entry.getKey() == value) { valueReached = true; } } return new GraphPanelChartSumElement(sum); } } }
GraphRowSumValues extends AbstractGraphRow implements Iterator<Entry<Long, AbstractGraphPanelChartElement>> { @Override public AbstractGraphPanelChartElement getElement(long value) { if (!isRollingSum) { return values.get(value); } else { if (!values.containsKey(value)) { return null; } else { long sum = 0; Iterator<Entry<Long, GraphPanelChartSumElement>> it = values.entrySet().iterator(); boolean valueReached = false; while (it.hasNext() && !valueReached) { Entry<Long, GraphPanelChartSumElement> entry = it.next(); sum += entry.getValue().getValue(); if (entry.getKey() == value) { valueReached = true; } } return new GraphPanelChartSumElement(sum); } } } }
GraphRowSumValues extends AbstractGraphRow implements Iterator<Entry<Long, AbstractGraphPanelChartElement>> { @Override public AbstractGraphPanelChartElement getElement(long value) { if (!isRollingSum) { return values.get(value); } else { if (!values.containsKey(value)) { return null; } else { long sum = 0; Iterator<Entry<Long, GraphPanelChartSumElement>> it = values.entrySet().iterator(); boolean valueReached = false; while (it.hasNext() && !valueReached) { Entry<Long, GraphPanelChartSumElement> entry = it.next(); sum += entry.getValue().getValue(); if (entry.getKey() == value) { valueReached = true; } } return new GraphPanelChartSumElement(sum); } } } GraphRowSumValues();  GraphRowSumValues(boolean doRollingSum); }
GraphRowSumValues extends AbstractGraphRow implements Iterator<Entry<Long, AbstractGraphPanelChartElement>> { @Override public AbstractGraphPanelChartElement getElement(long value) { if (!isRollingSum) { return values.get(value); } else { if (!values.containsKey(value)) { return null; } else { long sum = 0; Iterator<Entry<Long, GraphPanelChartSumElement>> it = values.entrySet().iterator(); boolean valueReached = false; while (it.hasNext() && !valueReached) { Entry<Long, GraphPanelChartSumElement> entry = it.next(); sum += entry.getValue().getValue(); if (entry.getKey() == value) { valueReached = true; } } return new GraphPanelChartSumElement(sum); } } } GraphRowSumValues();  GraphRowSumValues(boolean doRollingSum); @Override void setExcludeOutOfRangeValues(boolean excludeOutOfRangeValues); @Override void add(long xVal, double yVal); Iterator<Entry<Long, AbstractGraphPanelChartElement>> iterator(); boolean hasNext(); Entry<Long, AbstractGraphPanelChartElement> next(); void remove(); @Override int size(); @Override long getMaxX(); @Override AbstractGraphPanelChartElement getElement(long value); }
GraphRowSumValues extends AbstractGraphRow implements Iterator<Entry<Long, AbstractGraphPanelChartElement>> { @Override public AbstractGraphPanelChartElement getElement(long value) { if (!isRollingSum) { return values.get(value); } else { if (!values.containsKey(value)) { return null; } else { long sum = 0; Iterator<Entry<Long, GraphPanelChartSumElement>> it = values.entrySet().iterator(); boolean valueReached = false; while (it.hasNext() && !valueReached) { Entry<Long, GraphPanelChartSumElement> entry = it.next(); sum += entry.getValue().getValue(); if (entry.getKey() == value) { valueReached = true; } } return new GraphPanelChartSumElement(sum); } } } GraphRowSumValues();  GraphRowSumValues(boolean doRollingSum); @Override void setExcludeOutOfRangeValues(boolean excludeOutOfRangeValues); @Override void add(long xVal, double yVal); Iterator<Entry<Long, AbstractGraphPanelChartElement>> iterator(); boolean hasNext(); Entry<Long, AbstractGraphPanelChartElement> next(); void remove(); @Override int size(); @Override long getMaxX(); @Override AbstractGraphPanelChartElement getElement(long value);  }