/** * Extract the account ranges of the configured accountRage at set the ranges. Examples: "4830,4947", "4000-4799" or "6300,6800-6855" */ private synchronized void initialize() { if (initialized == true) { return; } try { accountNumberRanges = new IntRanges(accountRangeConfig); } catch (final Exception ex) { log.warn("Couldn't parse number range of businessAssessmentRow '" + accountRangeConfig + "':" + ex.getMessage(), ex); } initialized = true; } }
/** * The number ranges of the account numbers for the creditors, e. g. "10000-12999". * @return the creditorsAccountNumberRanges */ public IntRanges getCreditorsAccountNumberRanges() { return (IntRanges) new IntRanges(creditorsAccountNumberRangesString).setNullRangeMatchesAlways(true); }
/** * The number ranges of the account numbers for the debitors, e. g. "10000-12999". * @return the debitorsAccountNumberRanges */ public IntRanges getDebitorsAccountNumberRanges() { return (IntRanges) new IntRanges(debitorsAccountNumberRangesString).setNullRangeMatchesAlways(true); }
private void checkExceptions(final String rangesString) { try { testValueList(new IntRanges(rangesString), -5); fail("Exception excepted for string: " + rangesString); } catch (final IllegalArgumentException ex) { // OK } } }
testListSizes(new IntRanges(null), 0, 0); testListSizes(new IntRanges(""), 0, 0); testListSizes(new IntRanges(" "), 0, 0); testListSizes(new IntRanges(", , "), 0, 0); testValueList(new IntRanges("5-7"), (int[]) null); testValueList(new IntRanges("-5"), -5); testValueList(new IntRanges("-5,-5--3,-8,0"), -5, -8, 0); testRangeList(new IntRanges("2,5"), (Range<Integer>[]) null); testRangeList(new IntRanges("2-5"), r(2, 5)); testRangeList(new IntRanges("-2--5"), r(-5, -2)); testRangeList(new IntRanges("-5,-5--3,-8,0"), r(-5, -3)); testRangeList(new IntRanges("2-5,-5--3,-8,0"), r(2, 5), r(-5, -3)); assertEquals("", new IntRanges(null).toString()); assertEquals("1", new IntRanges("1").toString()); assertEquals("-10--5", new IntRanges("-5--10").toString()); assertEquals("2-5,-5--3,-8,0", new IntRanges("2-5,-5--3,-8,0").toString()); assertFalse(new IntRanges("").doesMatch(null)); doesNotMatch(new IntRanges(""), 0, 42, -1); doesMatch(new IntRanges("42"), 42); doesNotMatch(new IntRanges("42"), 0, -1); doesMatch((IntRanges) new IntRanges("").setNullRangeMatchesAlways(true), 0, 42); doesNotMatch(new IntRanges(""), 0, -1);