EventList<Integer> original = new BasicEventList<Integer>();
List<Integer> values = GlazedListsTests.intArrayToIntegerCollection(new int [] { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 0, 10, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 1 });
original.addAll(values);
// prepare a filter to filter our list
AtLeastMatcherEditor editor = new AtLeastMatcherEditor();
FilterList<Integer> myFilterList = new FilterList<Integer>(original, editor);
ListConsistencyListener<Integer> listConsistencyListener = ListConsistencyListener.install(myFilterList);
listConsistencyListener.setPreviousElementTracked(true);
// relax the list
editor.setMinimum(11);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(10);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(0);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(10);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(11);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(0);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
// now try constrain
values = GlazedListsTests.intArrayToIntegerCollection(new int[] { 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11 });
original.clear();
original.addAll(values);
// constrain the list
editor.setMinimum(10);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(11);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(12);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(10);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
// now try more changes
values = GlazedListsTests.intArrayToIntegerCollection(new int[] { 8, 6, 7, 5, 3, 0, 9 });
original.clear();
original.addAll(values);
// constrain the list
editor.setMinimum(5);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(10);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(1);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(0);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
editor.setMinimum(1);
assertEquals(myFilterList, Matchers.select(original, editor.getMatcher()));
}