Example #1
0
  private void replay() {
    List<Tag> feTags = new ArrayList<Tag>(featureTags);
    feTags.addAll(featureElementTags);
    List<String> feNames = Arrays.asList(featureName, featureElementName);
    List<Range> feRanges = Arrays.asList(featureElementRange);
    boolean featureElementOk = filter.evaluate(feTags, feNames, feRanges);

    List<Tag> exTags = new ArrayList<Tag>(feTags);
    exTags.addAll(examplesTags);
    List<String> exNames = new ArrayList<String>(feNames);
    exNames.add(examplesName);
    List<Range> exRanges = new ArrayList<Range>(feRanges);
    exRanges.add(examplesRange);
    boolean examplesOk = filter.evaluate(exTags, exNames, exRanges);

    if (featureElementOk || examplesOk) {
      replayEvents(featureEvents);
      replayEvents(backgroundEvents);
      replayEvents(featureElementEvents);
      if (examplesOk) {
        replayEvents(examplesEvents);
      }
    }
    examplesEvents.clear();
    examplesTags.clear();
    examplesName = null;
    examplesRange = null;
  }
Example #2
0
  @Override
  public void examples(Examples examples) {
    replay();
    examplesTags = examples.getTags();
    examplesName = examples.getName();

    Range tableBodyRange;
    switch (examples.getRows().size()) {
      case 0:
        tableBodyRange =
            new Range(examples.getLineRange().getLast(), examples.getLineRange().getLast());
        break;
      case 1:
        tableBodyRange =
            new Range(examples.getRows().get(0).getLine(), examples.getRows().get(0).getLine());
        break;
      default:
        tableBodyRange =
            new Range(
                examples.getRows().get(1).getLine(),
                examples.getRows().get(examples.getRows().size() - 1).getLine());
    }
    examplesRange = new Range(examples.getLineRange().getFirst(), tableBodyRange.getLast());
    if (filter.evaluate(
        Collections.<Tag>emptyList(),
        Collections.<String>emptyList(),
        Collections.singletonList(tableBodyRange))) {
      examples.setRows(filter.filterTableBodyRows(examples.getRows()));
    }
    examplesEvents = new ArrayList<BasicStatement>();
    examplesEvents.add(examples);
  }