private int countEvents = 0;
private int countElements = 0;
@Test
public void testEventsPerformance() {
IndexedAttributeModel attModel = new IndexedAttributeModel();
attModel.addAttributeListener(new AttributeListener() {
public void attributesChanged(AttributeEvent event) {
if(event.is(AttributeEvent.EventType.SET_VALUE)) {
countEvents++;
countElements+=event.getData().getTouchedValues().length;
}
}
});
//Add table
AttributeTableImpl table = new AttributeTableImpl(attModel, "table");
attModel.addTable(table);
//Add Column
AttributeColumnImpl col = table.addColumn("test", AttributeType.DOUBLE);
AttributeRowImpl r1 = attModel.getFactory().newRowForTable("table", 1.0);
AttributeRowImpl r2 = attModel.getFactory().newRowForTable("table", 1.0);
for(int i=0;i<1000000;i++) {
r1.setValue(col.getIndex(), Math.random());
r2.setValue(col.getIndex(), Math.random());
}