@Test public void testSetRangeWithNulls() { final RangeMatcherEditor<Date,Date> matcherEditor = new RangeMatcherEditor<>(); final CountingMatcherEditorListener<Date> counter = new CountingMatcherEditorListener<>(); matcherEditor.addMatcherEditorListener(counter); counter.assertCounterState(0, 0, 0, 0, 0); matcherEditor.setRange(may, jul); counter.assertCounterState(0, 0, 0, 1, 0); matcherEditor.setRange(may, null); counter.assertCounterState(0, 0, 0, 1, 1); matcherEditor.setRange(null, null); counter.assertCounterState(1, 0, 0, 1, 1); matcherEditor.setRange(null, null); counter.assertCounterState(1, 0, 0, 1, 1); matcherEditor.setRange(may, jul); counter.assertCounterState(1, 0, 0, 2, 1); matcherEditor.setRange(null, jul); counter.assertCounterState(1, 0, 0, 2, 2); matcherEditor.setRange(null, null); counter.assertCounterState(2, 0, 0, 2, 2); matcherEditor.setRange(may, jul); counter.assertCounterState(2, 0, 0, 3, 2); matcherEditor.setRange(null, null); counter.assertCounterState(3, 0, 0, 3, 2); matcherEditor.setRange(may, null); counter.assertCounterState(3, 0, 0, 4, 2); matcherEditor.setRange(null, null); counter.assertCounterState(4, 0, 0, 4, 2); matcherEditor.setRange(null, jul); counter.assertCounterState(4, 0, 0, 5, 2); }
public void setRange(D newStart, D newEnd) { if (newStart != null && newEnd != null && newStart.compareTo(newEnd) > 0) { final D temp = newEnd; newEnd = newStart; newStart = temp; } try { if (newStart == null && newEnd == null) { if (currentRangeStart != null || currentRangeEnd != null) { fireMatchAll(); } return; } boolean isRelaxed = false; boolean isConstrained = false; int newStartVsOldStart = compare(newStart, currentRangeStart, true); isRelaxed |= newStartVsOldStart < 0; isConstrained |= newStartVsOldStart > 0; int newEndVsOldEnd = compare(newEnd, currentRangeEnd, false); isRelaxed |= newEndVsOldEnd > 0; isConstrained |= newEndVsOldEnd < 0; final Matcher<E> matcher = Matchers.rangeMatcher(newStart, newEnd, filterator); if (isRelaxed && isConstrained) { fireChanged(matcher); } else if (isRelaxed) { fireRelaxed(matcher); } else if (isConstrained) { fireConstrained(matcher); } } finally { currentRangeStart = newStart; currentRangeEnd = newEnd; } }
RangeMatcherEditor extends AbstractMatcherEditor<E> { public void setRange(D newStart, D newEnd) { if (newStart != null && newEnd != null && newStart.compareTo(newEnd) > 0) { final D temp = newEnd; newEnd = newStart; newStart = temp; } try { if (newStart == null && newEnd == null) { if (currentRangeStart != null || currentRangeEnd != null) { fireMatchAll(); } return; } boolean isRelaxed = false; boolean isConstrained = false; int newStartVsOldStart = compare(newStart, currentRangeStart, true); isRelaxed |= newStartVsOldStart < 0; isConstrained |= newStartVsOldStart > 0; int newEndVsOldEnd = compare(newEnd, currentRangeEnd, false); isRelaxed |= newEndVsOldEnd > 0; isConstrained |= newEndVsOldEnd < 0; final Matcher<E> matcher = Matchers.rangeMatcher(newStart, newEnd, filterator); if (isRelaxed && isConstrained) { fireChanged(matcher); } else if (isRelaxed) { fireRelaxed(matcher); } else if (isConstrained) { fireConstrained(matcher); } } finally { currentRangeStart = newStart; currentRangeEnd = newEnd; } } }
RangeMatcherEditor extends AbstractMatcherEditor<E> { public void setRange(D newStart, D newEnd) { if (newStart != null && newEnd != null && newStart.compareTo(newEnd) > 0) { final D temp = newEnd; newEnd = newStart; newStart = temp; } try { if (newStart == null && newEnd == null) { if (currentRangeStart != null || currentRangeEnd != null) { fireMatchAll(); } return; } boolean isRelaxed = false; boolean isConstrained = false; int newStartVsOldStart = compare(newStart, currentRangeStart, true); isRelaxed |= newStartVsOldStart < 0; isConstrained |= newStartVsOldStart > 0; int newEndVsOldEnd = compare(newEnd, currentRangeEnd, false); isRelaxed |= newEndVsOldEnd > 0; isConstrained |= newEndVsOldEnd < 0; final Matcher<E> matcher = Matchers.rangeMatcher(newStart, newEnd, filterator); if (isRelaxed && isConstrained) { fireChanged(matcher); } else if (isRelaxed) { fireRelaxed(matcher); } else if (isConstrained) { fireConstrained(matcher); } } finally { currentRangeStart = newStart; currentRangeEnd = newEnd; } } RangeMatcherEditor();  RangeMatcherEditor(Filterator<D,E> filterator); }
RangeMatcherEditor extends AbstractMatcherEditor<E> { public void setRange(D newStart, D newEnd) { if (newStart != null && newEnd != null && newStart.compareTo(newEnd) > 0) { final D temp = newEnd; newEnd = newStart; newStart = temp; } try { if (newStart == null && newEnd == null) { if (currentRangeStart != null || currentRangeEnd != null) { fireMatchAll(); } return; } boolean isRelaxed = false; boolean isConstrained = false; int newStartVsOldStart = compare(newStart, currentRangeStart, true); isRelaxed |= newStartVsOldStart < 0; isConstrained |= newStartVsOldStart > 0; int newEndVsOldEnd = compare(newEnd, currentRangeEnd, false); isRelaxed |= newEndVsOldEnd > 0; isConstrained |= newEndVsOldEnd < 0; final Matcher<E> matcher = Matchers.rangeMatcher(newStart, newEnd, filterator); if (isRelaxed && isConstrained) { fireChanged(matcher); } else if (isRelaxed) { fireRelaxed(matcher); } else if (isConstrained) { fireConstrained(matcher); } } finally { currentRangeStart = newStart; currentRangeEnd = newEnd; } } RangeMatcherEditor();  RangeMatcherEditor(Filterator<D,E> filterator); Filterator<D,E> getFilterator(); void setRange(D newStart, D newEnd); }
RangeMatcherEditor extends AbstractMatcherEditor<E> { public void setRange(D newStart, D newEnd) { if (newStart != null && newEnd != null && newStart.compareTo(newEnd) > 0) { final D temp = newEnd; newEnd = newStart; newStart = temp; } try { if (newStart == null && newEnd == null) { if (currentRangeStart != null || currentRangeEnd != null) { fireMatchAll(); } return; } boolean isRelaxed = false; boolean isConstrained = false; int newStartVsOldStart = compare(newStart, currentRangeStart, true); isRelaxed |= newStartVsOldStart < 0; isConstrained |= newStartVsOldStart > 0; int newEndVsOldEnd = compare(newEnd, currentRangeEnd, false); isRelaxed |= newEndVsOldEnd > 0; isConstrained |= newEndVsOldEnd < 0; final Matcher<E> matcher = Matchers.rangeMatcher(newStart, newEnd, filterator); if (isRelaxed && isConstrained) { fireChanged(matcher); } else if (isRelaxed) { fireRelaxed(matcher); } else if (isConstrained) { fireConstrained(matcher); } } finally { currentRangeStart = newStart; currentRangeEnd = newEnd; } } RangeMatcherEditor();  RangeMatcherEditor(Filterator<D,E> filterator); Filterator<D,E> getFilterator(); void setRange(D newStart, D newEnd);  }