コード例 #1
0
  public void writeSection(
      ManchesterOWLSyntax keyword,
      Collection<?> content,
      String delimeter,
      boolean newline,
      OWLOntology... ontologiesList) {

    String sec = keyword.toString();
    if (!content.isEmpty() || renderingDirector.renderEmptyFrameSection(keyword, ontologiesList)) {
      fireSectionRenderingPrepared(sec);
      writeSection(keyword);
      writeOntologiesList(ontologiesList);
      incrementTab(4);
      writeNewLine();
      fireSectionRenderingStarted(sec);
      for (Iterator<?> it = content.iterator(); it.hasNext(); ) {
        Object obj = it.next();
        fireSectionItemPrepared(sec);
        if (obj instanceof OWLObject) {
          ((OWLObject) obj).accept(this);
        } else {
          write(obj.toString());
        }
        if (it.hasNext()) {
          write(delimeter);
          fireSectionItemFinished(sec);
          if (newline) {
            writeNewLine();
          }
        } else {
          fireSectionItemFinished(sec);
        }
      }
      fireSectionRenderingFinished(sec);
      popTab();
      writeNewLine();
      writeNewLine();
    }
  }
コード例 #2
0
  public void writeSection(
      ManchesterOWLSyntax keyword,
      SectionMap content,
      String delimeter,
      boolean newline,
      OWLOntology... ontologiesList) {
    String sec = keyword.toString();
    if (!content.isEmpty() || renderingDirector.renderEmptyFrameSection(keyword, ontologiesList)) {
      fireSectionRenderingPrepared(sec);
      writeSection(keyword);
      writeOntologiesList(ontologiesList);
      incrementTab(4);
      writeNewLine();
      fireSectionRenderingStarted(sec);
      for (Iterator<?> it = content.getSectionObjects().iterator(); it.hasNext(); ) {
        Object obj = it.next();
        Set<Set<OWLAnnotation>> annotationSets = content.getAnnotationsForSectionObject(obj);
        for (Iterator<Set<OWLAnnotation>> annosSetIt = annotationSets.iterator();
            annosSetIt.hasNext(); ) {
          Set<OWLAnnotation> annos = annosSetIt.next();
          fireSectionItemPrepared(sec);
          if (!annos.isEmpty()) {
            incrementTab(4);
            writeNewLine();
            write(ManchesterOWLSyntax.ANNOTATIONS.toString());
            write(": ");
            pushTab(getIndent() + 1);
            for (Iterator<OWLAnnotation> annoIt = annos.iterator(); annoIt.hasNext(); ) {
              annoIt.next().accept(this);
              if (annoIt.hasNext()) {
                write(", ");
                writeNewLine();
              }
            }
            popTab();
            popTab();
            writeNewLine();
          }
          // Write actual object
          if (obj instanceof OWLObject) {
            ((OWLObject) obj).accept(this);
          } else if (obj instanceof Collection) {
            for (Iterator<?> listIt = ((Collection<?>) obj).iterator(); listIt.hasNext(); ) {
              Object o = listIt.next();
              if (o instanceof OWLObject) {
                ((OWLObject) o).accept(this);
              } else {
                write(o.toString());
              }
              if (listIt.hasNext()) {
                write(delimeter);
                if (newline) {
                  writeNewLine();
                }
              }
            }

          } else {
            write(obj.toString());
          }
          if (it.hasNext()) {
            write(delimeter);
            fireSectionItemFinished(sec);
            if (newline) {
              writeNewLine();
            }
          } else {
            fireSectionItemFinished(sec);
          }

          if (annosSetIt.hasNext()) {
            write(",");
            writeNewLine();
          }
        }
      }
      fireSectionRenderingFinished(sec);
      popTab();
      writeNewLine();
      writeNewLine();
    }
  }