@Test public void testCompatibilitySingleOther() { Assert.assertFalse(codec.areOutcomesCompatible(new String[] {OTHER})); }
@Override public boolean areOutcomesCompatible(String[] outcomes) { List<String> start = new ArrayList<>(); List<String> cont = new ArrayList<>(); for (int i = 0; i < outcomes.length; i++) { String outcome = outcomes[i]; if (outcome.endsWith(BioCodec.START)) { start.add(outcome.substring(0, outcome.length() - BioCodec.START.length())); } else if (outcome.endsWith(BioCodec.CONTINUE)) { cont.add(outcome.substring(0, outcome.length() - BioCodec.CONTINUE.length())); } else if (!outcome.equals(BioCodec.OTHER)) { return false; } } if (start.size() == 0) { return false; } else { for (String contPreffix : cont) { if (!start.contains(contPreffix)) { return false; } } } return true; }
BioCodec implements SequenceCodec<String> { @Override public boolean areOutcomesCompatible(String[] outcomes) { List<String> start = new ArrayList<>(); List<String> cont = new ArrayList<>(); for (int i = 0; i < outcomes.length; i++) { String outcome = outcomes[i]; if (outcome.endsWith(BioCodec.START)) { start.add(outcome.substring(0, outcome.length() - BioCodec.START.length())); } else if (outcome.endsWith(BioCodec.CONTINUE)) { cont.add(outcome.substring(0, outcome.length() - BioCodec.CONTINUE.length())); } else if (!outcome.equals(BioCodec.OTHER)) { return false; } } if (start.size() == 0) { return false; } else { for (String contPreffix : cont) { if (!start.contains(contPreffix)) { return false; } } } return true; } }
BioCodec implements SequenceCodec<String> { @Override public boolean areOutcomesCompatible(String[] outcomes) { List<String> start = new ArrayList<>(); List<String> cont = new ArrayList<>(); for (int i = 0; i < outcomes.length; i++) { String outcome = outcomes[i]; if (outcome.endsWith(BioCodec.START)) { start.add(outcome.substring(0, outcome.length() - BioCodec.START.length())); } else if (outcome.endsWith(BioCodec.CONTINUE)) { cont.add(outcome.substring(0, outcome.length() - BioCodec.CONTINUE.length())); } else if (!outcome.equals(BioCodec.OTHER)) { return false; } } if (start.size() == 0) { return false; } else { for (String contPreffix : cont) { if (!start.contains(contPreffix)) { return false; } } } return true; }  }
BioCodec implements SequenceCodec<String> { @Override public boolean areOutcomesCompatible(String[] outcomes) { List<String> start = new ArrayList<>(); List<String> cont = new ArrayList<>(); for (int i = 0; i < outcomes.length; i++) { String outcome = outcomes[i]; if (outcome.endsWith(BioCodec.START)) { start.add(outcome.substring(0, outcome.length() - BioCodec.START.length())); } else if (outcome.endsWith(BioCodec.CONTINUE)) { cont.add(outcome.substring(0, outcome.length() - BioCodec.CONTINUE.length())); } else if (!outcome.equals(BioCodec.OTHER)) { return false; } } if (start.size() == 0) { return false; } else { for (String contPreffix : cont) { if (!start.contains(contPreffix)) { return false; } } } return true; }  Span[] decode(List<String> c); String[] encode(Span[] names, int length); NameFinderSequenceValidator createSequenceValidator(); @Override boolean areOutcomesCompatible(String[] outcomes); }
BioCodec implements SequenceCodec<String> { @Override public boolean areOutcomesCompatible(String[] outcomes) { List<String> start = new ArrayList<>(); List<String> cont = new ArrayList<>(); for (int i = 0; i < outcomes.length; i++) { String outcome = outcomes[i]; if (outcome.endsWith(BioCodec.START)) { start.add(outcome.substring(0, outcome.length() - BioCodec.START.length())); } else if (outcome.endsWith(BioCodec.CONTINUE)) { cont.add(outcome.substring(0, outcome.length() - BioCodec.CONTINUE.length())); } else if (!outcome.equals(BioCodec.OTHER)) { return false; } } if (start.size() == 0) { return false; } else { for (String contPreffix : cont) { if (!start.contains(contPreffix)) { return false; } } } return true; }  Span[] decode(List<String> c); String[] encode(Span[] names, int length); NameFinderSequenceValidator createSequenceValidator(); @Override boolean areOutcomesCompatible(String[] outcomes); static final String START; static final String CONTINUE; static final String OTHER; }