@Test public void testUnitFollowedByBegin() { String outcome = START_A; String[] inputSequence = new String[] {"AnyType", "TypeA", "something"}; String[] outcomesSequence = new String[] {UNIT_A}; Assert.assertTrue(validator.validSequence(1, inputSequence, outcomesSequence, outcome)); }
public boolean validSequence(int i, String[] inputSequence, String[] outcomesSequence, String outcome) { if (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST)) { int li = outcomesSequence.length - 1; if (li == -1) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.OTHER) || outcomesSequence[li].endsWith(BilouCodec.UNIT)) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.LAST) && (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST))) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.CONTINUE) || outcomesSequence[li].endsWith(BilouCodec.START)) { String previousNameType = NameFinderME.extractNameType(outcomesSequence[li]); String nameType = NameFinderME.extractNameType(outcome); if (previousNameType != null || nameType != null) { if (nameType != null) { if (nameType.equals(previousNameType)) { return true; } } return false; } } } if (outcomesSequence.length > 0) { if (outcome.endsWith(BilouCodec.START) || outcome.endsWith(BilouCodec.OTHER) || outcome.endsWith(BilouCodec.UNIT)) { if (outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.START) || outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.CONTINUE)) { return false; } } } return true; }
BilouNameFinderSequenceValidator implements
    SequenceValidator<String> { public boolean validSequence(int i, String[] inputSequence, String[] outcomesSequence, String outcome) { if (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST)) { int li = outcomesSequence.length - 1; if (li == -1) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.OTHER) || outcomesSequence[li].endsWith(BilouCodec.UNIT)) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.LAST) && (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST))) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.CONTINUE) || outcomesSequence[li].endsWith(BilouCodec.START)) { String previousNameType = NameFinderME.extractNameType(outcomesSequence[li]); String nameType = NameFinderME.extractNameType(outcome); if (previousNameType != null || nameType != null) { if (nameType != null) { if (nameType.equals(previousNameType)) { return true; } } return false; } } } if (outcomesSequence.length > 0) { if (outcome.endsWith(BilouCodec.START) || outcome.endsWith(BilouCodec.OTHER) || outcome.endsWith(BilouCodec.UNIT)) { if (outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.START) || outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.CONTINUE)) { return false; } } } return true; } }
BilouNameFinderSequenceValidator implements
    SequenceValidator<String> { public boolean validSequence(int i, String[] inputSequence, String[] outcomesSequence, String outcome) { if (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST)) { int li = outcomesSequence.length - 1; if (li == -1) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.OTHER) || outcomesSequence[li].endsWith(BilouCodec.UNIT)) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.LAST) && (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST))) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.CONTINUE) || outcomesSequence[li].endsWith(BilouCodec.START)) { String previousNameType = NameFinderME.extractNameType(outcomesSequence[li]); String nameType = NameFinderME.extractNameType(outcome); if (previousNameType != null || nameType != null) { if (nameType != null) { if (nameType.equals(previousNameType)) { return true; } } return false; } } } if (outcomesSequence.length > 0) { if (outcome.endsWith(BilouCodec.START) || outcome.endsWith(BilouCodec.OTHER) || outcome.endsWith(BilouCodec.UNIT)) { if (outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.START) || outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.CONTINUE)) { return false; } } } return true; }  }
BilouNameFinderSequenceValidator implements
    SequenceValidator<String> { public boolean validSequence(int i, String[] inputSequence, String[] outcomesSequence, String outcome) { if (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST)) { int li = outcomesSequence.length - 1; if (li == -1) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.OTHER) || outcomesSequence[li].endsWith(BilouCodec.UNIT)) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.LAST) && (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST))) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.CONTINUE) || outcomesSequence[li].endsWith(BilouCodec.START)) { String previousNameType = NameFinderME.extractNameType(outcomesSequence[li]); String nameType = NameFinderME.extractNameType(outcome); if (previousNameType != null || nameType != null) { if (nameType != null) { if (nameType.equals(previousNameType)) { return true; } } return false; } } } if (outcomesSequence.length > 0) { if (outcome.endsWith(BilouCodec.START) || outcome.endsWith(BilouCodec.OTHER) || outcome.endsWith(BilouCodec.UNIT)) { if (outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.START) || outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.CONTINUE)) { return false; } } } return true; }  boolean validSequence(int i, String[] inputSequence,
                               String[] outcomesSequence, String outcome); }
BilouNameFinderSequenceValidator implements
    SequenceValidator<String> { public boolean validSequence(int i, String[] inputSequence, String[] outcomesSequence, String outcome) { if (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST)) { int li = outcomesSequence.length - 1; if (li == -1) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.OTHER) || outcomesSequence[li].endsWith(BilouCodec.UNIT)) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.LAST) && (outcome.endsWith(BilouCodec.CONTINUE) || outcome.endsWith(BilouCodec.LAST))) { return false; } else if (outcomesSequence[li].endsWith(BilouCodec.CONTINUE) || outcomesSequence[li].endsWith(BilouCodec.START)) { String previousNameType = NameFinderME.extractNameType(outcomesSequence[li]); String nameType = NameFinderME.extractNameType(outcome); if (previousNameType != null || nameType != null) { if (nameType != null) { if (nameType.equals(previousNameType)) { return true; } } return false; } } } if (outcomesSequence.length > 0) { if (outcome.endsWith(BilouCodec.START) || outcome.endsWith(BilouCodec.OTHER) || outcome.endsWith(BilouCodec.UNIT)) { if (outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.START) || outcomesSequence[outcomesSequence.length - 1].endsWith(BilouCodec.CONTINUE)) { return false; } } } return true; }  boolean validSequence(int i, String[] inputSequence,
                               String[] outcomesSequence, String outcome);  }