@Override public boolean canFilter(Example example) { for (String keyword : keywords) { if (keyword.equalsIgnoreCase(contentOf(example.at(0, 0, 0)))) { return true; } } return false; }
@SuppressWarnings("unchecked") public static <T extends Example> T[] asArray(T example) { List<Example> examples = asList(example); T[] array = ( T[] ) Array.newInstance(example.getClass(), examples.size()); return examples.toArray(array); }
@Override public String toString() { return ExampleUtil.asString(this); }
public static List<String> contentAsList(Iterable<Example> cells) { return new ArrayList<String>(Arrays.asList(content(cells))); }
public static Action parse(List<Example> cells) { return new Action(ExampleUtil.contentAsList(cells)); }
@Override public Example doFilter(Example example) { if (filter.areIncluded(content(example.at(0, 1, 0)))) { return example.nextSibling(); } return goToNextSection(example.nextSibling()); }
public static Action parse(Iterable<Example> cells) { return new Action(ExampleUtil.contentAsList(cells)); }
private String identifier(Example row) { return ExampleUtil.contentOf(row.firstChild()); } }
@Override public List<Example> actionCells(Example row) { return ExampleUtil.asList(row.at(0, 1)); } }
private static boolean isEndTag(Example table) { return table == null ? false : END_TEST.equalsIgnoreCase(ExampleUtil.contentOf(table.at(0, 0, 0))); }
private static boolean isBeginTag(Example table) { return table == null ? false : BEGIN_TEST.equalsIgnoreCase(ExampleUtil.contentOf(table.at(0, 0, 0))); }
@Override public List<Example> actionCells(Example row) { return ExampleUtil.asList(row.at(0, 1)); } }
private boolean indicatesEndOfFlow(Example table) { return "end".equalsIgnoreCase(ExampleUtil.contentOf(table.at(0, 0, 0))); }
@Override public List<Example> actionCells(Example row) { return ExampleUtil.asList(row.firstChild()); } }
protected Example goToNextSection(Example example) { for (Example table = example; table != null; table = table.nextSibling()) { if ("section".equalsIgnoreCase(contentOf(table.at(0, 0, 0)))) { return table; } } return null; }
@Override public List<Example> actionCells(Example row) { return ExampleUtil.asList(row.at(0, 1)); } }
private String identifier(Example row) { String possibleAliasIdentifier = ExampleUtil.contentOf(row.firstChild()); String aliasIdentifier = AliasLoader.get().getKeywordForAlias(possibleAliasIdentifier); return aliasIdentifier == null ? possibleAliasIdentifier : aliasIdentifier; }
@Override public List<Example> actionCells(Example row) { return ExampleUtil.asList(row.at(0, 1)); } }