@Test public void matchCycle() { List<Object> matchValues = Arrays.<Object>asList(newVDouble(1.0), newVDouble(2.0), newVDouble(3.0), newVDouble(4.0)); List<Object> values = Arrays.<Object>asList(newVDouble(1.0), newVDouble(2.0), newVDouble(3.0), newVDouble(4.0)); assertThat(Validators.matchCycle(VTypeMatchMask.VALUE, 0, matchValues, values), equalTo(true)); values = Arrays.<Object>asList(newVDouble(1.0), newVDouble(2.0), newVDouble(3.0), newVDouble(4.0), newVDouble(1.0), newVDouble(2.0), newVDouble(3.0), newVDouble(4.0), newVDouble(1.0), newVDouble(2.0)); assertThat(Validators.matchCycle(VTypeMatchMask.VALUE, 0, matchValues, values), equalTo(true)); values = Arrays.<Object>asList(newVDouble(3.0), newVDouble(4.0), newVDouble(1.0), newVDouble(2.0)); assertThat(Validators.matchCycle(VTypeMatchMask.VALUE, 0, matchValues, values), equalTo(false)); assertThat(Validators.matchCycle(VTypeMatchMask.VALUE, 1, matchValues, values), equalTo(false)); assertThat(Validators.matchCycle(VTypeMatchMask.VALUE, 2, matchValues, values), equalTo(true)); }
static boolean matchCycle(VTypeMatchMask mask, int start, List<Object> expected, List<Object> actual) { int currentExpected = start; for (int currentActual = 0; currentActual < actual.size(); currentActual++) { if (mask.match(expected.get(currentExpected), actual.get(currentActual)) != null) { return false; } currentExpected++; if (currentExpected == expected.size()) { currentExpected = 0; } } return true; }
Validators { static boolean matchCycle(VTypeMatchMask mask, int start, List<Object> expected, List<Object> actual) { int currentExpected = start; for (int currentActual = 0; currentActual < actual.size(); currentActual++) { if (mask.match(expected.get(currentExpected), actual.get(currentActual)) != null) { return false; } currentExpected++; if (currentExpected == expected.size()) { currentExpected = 0; } } return true; } }
Validators { static boolean matchCycle(VTypeMatchMask mask, int start, List<Object> expected, List<Object> actual) { int currentExpected = start; for (int currentActual = 0; currentActual < actual.size(); currentActual++) { if (mask.match(expected.get(currentExpected), actual.get(currentActual)) != null) { return false; } currentExpected++; if (currentExpected == expected.size()) { currentExpected = 0; } } return true; }  }
Validators { static boolean matchCycle(VTypeMatchMask mask, int start, List<Object> expected, List<Object> actual) { int currentExpected = start; for (int currentActual = 0; currentActual < actual.size(); currentActual++) { if (mask.match(expected.get(currentExpected), actual.get(currentActual)) != null) { return false; } currentExpected++; if (currentExpected == expected.size()) { currentExpected = 0; } } return true; }  static Validator cycleValidator(final VTypeMatchMask mask, final List<Object> matches); }
Validators { static boolean matchCycle(VTypeMatchMask mask, int start, List<Object> expected, List<Object> actual) { int currentExpected = start; for (int currentActual = 0; currentActual < actual.size(); currentActual++) { if (mask.match(expected.get(currentExpected), actual.get(currentActual)) != null) { return false; } currentExpected++; if (currentExpected == expected.size()) { currentExpected = 0; } } return true; }  static Validator cycleValidator(final VTypeMatchMask mask, final List<Object> matches);  }