use of org.kie.dmn.validation.dtanalysis.model.Interval in project drools by kiegroup.
the class IntervalTest method testFlatten.
@Test
public void testFlatten() {
Interval a = new Interval(RangeBoundary.CLOSED, 0, 3, RangeBoundary.OPEN, 0, 0);
Interval b = new Interval(RangeBoundary.CLOSED, 1, 2, RangeBoundary.CLOSED, 0, 0);
Interval c = new Interval(RangeBoundary.CLOSED, 3, 4, RangeBoundary.CLOSED, 0, 0);
List<Interval> result = Interval.flatten(Arrays.asList(c, b, a));
assertThat(result, contains(new Interval(RangeBoundary.CLOSED, 0, 4, RangeBoundary.CLOSED, 0, 0)));
}
use of org.kie.dmn.validation.dtanalysis.model.Interval in project drools by kiegroup.
the class IntervalTest method testNoFlatten.
@Test
public void testNoFlatten() {
Interval a = new Interval(RangeBoundary.CLOSED, LocalDate.parse("2021-01-01"), LocalDate.parse("2021-03-31"), RangeBoundary.CLOSED, 0, 0);
Interval b = new Interval(RangeBoundary.OPEN, LocalDate.parse("2021-04-01"), LocalDate.parse("2021-04-30"), RangeBoundary.CLOSED, 0, 0);
List<Interval> result = Interval.flatten(Arrays.asList(b, a));
Assertions.assertThat(result).containsExactly(a, b);
}
use of org.kie.dmn.validation.dtanalysis.model.Interval in project drools by kiegroup.
the class IntervalTest method testFlatten2.
@Test
public void testFlatten2() {
Interval a = new Interval(RangeBoundary.CLOSED, 0, 3, RangeBoundary.OPEN, 0, 0);
Interval b = new Interval(RangeBoundary.CLOSED, 1, 2, RangeBoundary.CLOSED, 0, 0);
Interval c = new Interval(RangeBoundary.OPEN, 3, 4, RangeBoundary.CLOSED, 0, 0);
List<Interval> result = Interval.flatten(Arrays.asList(c, b, a));
assertThat(result, contains(new Interval(RangeBoundary.CLOSED, 0, 3, RangeBoundary.OPEN, 0, 0), new Interval(RangeBoundary.OPEN, 3, 4, RangeBoundary.CLOSED, 0, 0)));
}
use of org.kie.dmn.validation.dtanalysis.model.Interval in project drools by kiegroup.
the class IntervalTest method testFlatten4.
@Test
public void testFlatten4() {
Interval a = new Interval(RangeBoundary.CLOSED, LocalDate.parse("2021-01-01"), LocalDate.parse("2021-03-31"), RangeBoundary.CLOSED, 0, 0);
Interval b = new Interval(RangeBoundary.CLOSED, LocalDate.parse("2021-04-01"), LocalDate.parse("2021-04-30"), RangeBoundary.CLOSED, 0, 0);
List<Interval> result = Interval.flatten(Arrays.asList(b, a));
Assertions.assertThat(result).containsExactly(new Interval(RangeBoundary.CLOSED, LocalDate.parse("2021-01-01"), LocalDate.parse("2021-04-30"), RangeBoundary.CLOSED, 0, 0));
}
use of org.kie.dmn.validation.dtanalysis.model.Interval in project drools by kiegroup.
the class IntervalTest method testInvertOverDomain2.
@Test
public void testInvertOverDomain2() {
Interval a = new Interval(RangeBoundary.CLOSED, "i", "o", RangeBoundary.OPEN, 9, 8);
Interval domain = new Interval(RangeBoundary.CLOSED, "a", "u", RangeBoundary.CLOSED, 0, 0);
List<Interval> result = Interval.invertOverDomain(a, domain);
assertThat(result, hasSize(2));
assertInterval(result.get(0), RangeBoundary.CLOSED, "a", "i", RangeBoundary.OPEN, 9, 8);
assertInterval(result.get(1), RangeBoundary.CLOSED, "o", "u", RangeBoundary.CLOSED, 9, 8);
}
Aggregations