@Test public void getFeatureData() { result.newFeature("foo.1"); result.setFeatureValue("bar", 1); result.setFeatureValue("baz", "one"); result.newFeature("foo.2"); result.setFeatureValue("bar", 2); result.setFeatureValue("baz", "two"); assertEquals("foo.1", result.getFeatureId(0)); Map<String, Object> featureData = result.getFeatureData(0); assertEquals(1, featureData.get("bar")); assertEquals("one", featureData.get("baz")); assertEquals("foo.2", result.getFeatureId(1)); featureData = result.getFeatureData(1); assertEquals(2, featureData.get("bar")); assertEquals("two", featureData.get("baz")); }
public Map<String, Object> getFeatureData(int featureIndex) { if (featureIndex < 0 || featureIndex >= getNumFeatures()) { throw new IndexOutOfBoundsException("Invalid index value: " + featureIndex); } return Collections.unmodifiableMap(items.get(featureIndex).data); }
InfoToolResult { public Map<String, Object> getFeatureData(int featureIndex) { if (featureIndex < 0 || featureIndex >= getNumFeatures()) { throw new IndexOutOfBoundsException("Invalid index value: " + featureIndex); } return Collections.unmodifiableMap(items.get(featureIndex).data); } }
InfoToolResult { public Map<String, Object> getFeatureData(int featureIndex) { if (featureIndex < 0 || featureIndex >= getNumFeatures()) { throw new IndexOutOfBoundsException("Invalid index value: " + featureIndex); } return Collections.unmodifiableMap(items.get(featureIndex).data); } InfoToolResult(); }
InfoToolResult { public Map<String, Object> getFeatureData(int featureIndex) { if (featureIndex < 0 || featureIndex >= getNumFeatures()) { throw new IndexOutOfBoundsException("Invalid index value: " + featureIndex); } return Collections.unmodifiableMap(items.get(featureIndex).data); } InfoToolResult(); void newFeature(String id); void setFeatureValue(Name name, Object value); void setFeatureValue(String name, Object value); int getNumFeatures(); @Override String toString(); Map<String, Object> getFeatureData(int featureIndex); String getFeatureId(int featureIndex); }
InfoToolResult { public Map<String, Object> getFeatureData(int featureIndex) { if (featureIndex < 0 || featureIndex >= getNumFeatures()) { throw new IndexOutOfBoundsException("Invalid index value: " + featureIndex); } return Collections.unmodifiableMap(items.get(featureIndex).data); } InfoToolResult(); void newFeature(String id); void setFeatureValue(Name name, Object value); void setFeatureValue(String name, Object value); int getNumFeatures(); @Override String toString(); Map<String, Object> getFeatureData(int featureIndex); String getFeatureId(int featureIndex);  }