コード例 #1
0
  private void deleteParagraph(int nr, List<Section> sections) {
    int temp = nr;

    for (Section s : sections) {
      nr = temp;
      temp -= s.nrOfParagraphs();

      if (temp >= 0) continue;

      if (s.getClass() == SectionContainer.class)
        deleteParagraph(nr, ((SectionContainer) s).getSubSections());
      else {
        SectionContent sc = (SectionContent) s;
        sc.removeParagraph(sc.getParagraph(nr));
      }

      break;
    }
  }
コード例 #2
0
    private List<Template> getPartOfSpeechTemplates(final Section section) {
      if (section.getTitleElement() != null) {
        final List<Template> templates =
            getTemplate(section.getTitleElement().getTemplates(), "Wortart");
        if (!templates.isEmpty()) {
          return templates;
        }
      }

      final List<Content> contentList = section.getContentList();
      if (contentList != null) {
        for (final Content content : contentList) {
          final List<Template> result = getTemplate(content.getTemplates(), "Wortart");
          if (!result.isEmpty()) {
            return result;
          }
        }
      }

      return Collections.emptyList();
    }
コード例 #3
0
  private void handleSection(Section s, StringBuilder sb) {
    EnumMap<SIT, EnumMap<CIT, Boolean>> hp = null;

    if (s.getTitle() != null)
      hp = sectionHandling.get(SectionType.USER_SECTION.toString() + s.getTitle().toUpperCase());
    if (hp == null)
      hp =
          sectionHandling.get(
              SectionType.SECTION_LEVEL.toString() + (s.getLevel() - levelModifier));
    if (hp == null) hp = sectionHandling.get(SectionType.DEFAULT_SECTION.toString());
    if (hp == null) {
      System.err.println(
          "Cannot get Handling Parameters for Section:\""
              + s.getTitle()
              + "\" Level:"
              + s.getLevel());
      return;
    }

    handleContent(s.getTitleElement(), hp.get(SIT.TITLE), sb);

    if (s.getClass() == SectionContainer.class) {
      if (hp.get(SIT.SUBS) != null) handleContent(s, hp.get(SIT.SUBS), sb);
      else for (Section ss : ((SectionContainer) s).getSubSections()) handleSection(ss, sb);
    } else {
      EnumMap<CIT, Boolean> hpx;

      hpx = hp.get(SIT.TABLE);
      if (hpx != null) for (Table t : s.getTables()) handleContent(t, hpx, sb);

      hpx = hp.get(SIT.NESTLIST);
      if (hpx != null) for (NestedList nl : s.getNestedLists()) handleContent(nl, hpx, sb);

      hpx = hp.get(SIT.PARA);
      if (hpx != null) for (Paragraph p : s.getParagraphs()) handleContent(p, hpx, sb);

      hpx = hp.get(SIT.DEFLIST);
      if (hpx != null) for (DefinitionList dl : s.getDefinitionLists()) handleContent(dl, hpx, sb);
    }
  }