@Test public void testWrite() { SuffixASCIIWriter<String, String> writer = new SuffixASCIIWriter<>(); ObservationTable<String, String> ot = ObservationTableSource.otWithFourSuffixes(); Assert.assertEquals(OTUtils.toString(ot, writer), ";A;B;A,B"); }
@Override public void write(ObservationTable<? extends I, ? extends D> table, Appendable out) throws IOException { List<? extends Word<? extends I>> suffixes = table.getSuffixes(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Word<? extends I> word : suffixes) { if (first) { first = false; } else { sb.append(WORD_DELIMITER); } String stringRepresentation = wordToString(word); if (stringRepresentation.contains(WORD_DELIMITER)) { throw new IllegalArgumentException( "Delimiter '" + WORD_DELIMITER + "' must not be used in symbol names. " + "Symbol containing the delimiter was '" + stringRepresentation + '\''); } else { sb.append(stringRepresentation); } } out.append(sb.toString()); }
SuffixASCIIWriter extends AbstractObservationTableWriter<I, D> { @Override public void write(ObservationTable<? extends I, ? extends D> table, Appendable out) throws IOException { List<? extends Word<? extends I>> suffixes = table.getSuffixes(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Word<? extends I> word : suffixes) { if (first) { first = false; } else { sb.append(WORD_DELIMITER); } String stringRepresentation = wordToString(word); if (stringRepresentation.contains(WORD_DELIMITER)) { throw new IllegalArgumentException( "Delimiter '" + WORD_DELIMITER + "' must not be used in symbol names. " + "Symbol containing the delimiter was '" + stringRepresentation + '\''); } else { sb.append(stringRepresentation); } } out.append(sb.toString()); } }
SuffixASCIIWriter extends AbstractObservationTableWriter<I, D> { @Override public void write(ObservationTable<? extends I, ? extends D> table, Appendable out) throws IOException { List<? extends Word<? extends I>> suffixes = table.getSuffixes(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Word<? extends I> word : suffixes) { if (first) { first = false; } else { sb.append(WORD_DELIMITER); } String stringRepresentation = wordToString(word); if (stringRepresentation.contains(WORD_DELIMITER)) { throw new IllegalArgumentException( "Delimiter '" + WORD_DELIMITER + "' must not be used in symbol names. " + "Symbol containing the delimiter was '" + stringRepresentation + '\''); } else { sb.append(stringRepresentation); } } out.append(sb.toString()); } SuffixASCIIWriter(); }
SuffixASCIIWriter extends AbstractObservationTableWriter<I, D> { @Override public void write(ObservationTable<? extends I, ? extends D> table, Appendable out) throws IOException { List<? extends Word<? extends I>> suffixes = table.getSuffixes(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Word<? extends I> word : suffixes) { if (first) { first = false; } else { sb.append(WORD_DELIMITER); } String stringRepresentation = wordToString(word); if (stringRepresentation.contains(WORD_DELIMITER)) { throw new IllegalArgumentException( "Delimiter '" + WORD_DELIMITER + "' must not be used in symbol names. " + "Symbol containing the delimiter was '" + stringRepresentation + '\''); } else { sb.append(stringRepresentation); } } out.append(sb.toString()); } SuffixASCIIWriter(); @Override void write(ObservationTable<? extends I, ? extends D> table, Appendable out); }
SuffixASCIIWriter extends AbstractObservationTableWriter<I, D> { @Override public void write(ObservationTable<? extends I, ? extends D> table, Appendable out) throws IOException { List<? extends Word<? extends I>> suffixes = table.getSuffixes(); StringBuilder sb = new StringBuilder(); boolean first = true; for (Word<? extends I> word : suffixes) { if (first) { first = false; } else { sb.append(WORD_DELIMITER); } String stringRepresentation = wordToString(word); if (stringRepresentation.contains(WORD_DELIMITER)) { throw new IllegalArgumentException( "Delimiter '" + WORD_DELIMITER + "' must not be used in symbol names. " + "Symbol containing the delimiter was '" + stringRepresentation + '\''); } else { sb.append(stringRepresentation); } } out.append(sb.toString()); } SuffixASCIIWriter(); @Override void write(ObservationTable<? extends I, ? extends D> table, Appendable out);  }