DiscreteAttribute extends AbstractIndexableAttribute implements RangeAttribute { @Override public Object getValue(int index) { if (index < 0 || index >= values.size()) return null; return values.get(index); } DiscreteAttribute(String key, AttributeLevel level); @Override int registerXAttribute(XAttribute att); @Override ImmutableList<Object> getValues(); @Override int getValueIndex(Object value); @Override Object getValue(int index); @Override int getValueSize(); @Override Object getMin(); @Override Object getMax();  }
@Test public void testGetValue() { DiscreteAttribute att1 = this.newWithOneValue("concept:name", AttributeLevel.EVENT); Assert.assertEquals((long)100, att1.getValue(0)); DiscreteAttribute att2 = this.newWithTwoValues("concept:name", AttributeLevel.EVENT); Assert.assertEquals((long)100, att2.getValue(0)); Assert.assertEquals((long)200, att2.getValue(1)); }
@Test public void testGetValueFromEmptyAttribute() { DiscreteAttribute att0 = this.newEmptyAttribute("concept:name", AttributeLevel.EVENT); Assert.assertEquals(att0.getValue(0),null); }