Esempio n. 1
0
  public final Diagram createPSystem(final List<CharSequence2> strings2) {

    final List<PSystemFactory> factories = getAllFactories();

    final DiagramType type = DiagramType.getTypeFromArobaseStart(strings2.get(0).toString2());

    final UmlSource umlSource = new UmlSource(strings2, type == DiagramType.UML);
    final DiagramType diagramType = umlSource.getDiagramType();
    final List<PSystemError> errors = new ArrayList<PSystemError>();
    for (PSystemFactory systemFactory : factories) {
      if (diagramType != systemFactory.getDiagramType()) {
        continue;
      }
      final Diagram sys = systemFactory.createSystem(umlSource);
      if (isOk(sys)) {
        return sys;
      }
      errors.add((PSystemError) sys);
    }

    final PSystemError err = PSystemError.merge(errors);
    // if (OptionFlags.getInstance().isQuiet() == false) {
    // err.print(System.err);
    // }
    return err;
  }
Esempio n. 2
0
 public DisplayPositionned getTitle() {
   if (source == null) {
     return new DisplayPositionned(
         Display.empty(), HorizontalAlignment.CENTER, VerticalAlignment.TOP);
   }
   return new DisplayPositionned(
       source.getTitle(), HorizontalAlignment.CENTER, VerticalAlignment.TOP);
 }
Esempio n. 3
0
  public final Diagram createSystem(UmlSource source) {
    final IteratorCounter2 it = source.iterator2();
    final CharSequence2 startLine = it.next();
    if (StartUtils.isArobaseStartDiagram(startLine) == false) {
      throw new UnsupportedOperationException();
    }

    if (source.isEmpty()) {
      return buildEmptyError(source, startLine.getLocation());
    }
    AbstractPSystem sys = createEmptyDiagram();

    while (it.hasNext()) {
      if (StartUtils.isArobaseEndDiagram(it.peek())) {
        if (sys == null) {
          return null;
        }
        final String err = sys.checkFinalError();
        if (err != null) {
          return buildEmptyError(source, err, it.peek().getLocation());
        }
        if (source.getTotalLineCount() == 2) {
          return buildEmptyError(source, it.peek().getLocation());
        }
        sys.makeDiagramReady();
        if (sys.isOk() == false) {
          return null;
        }
        sys.setSource(source);
        return sys;
      }
      sys = executeOneLine(sys, source, it);
      if (sys instanceof PSystemError) {
        return sys;
      }
    }
    sys.setSource(source);
    return sys;
  }
Esempio n. 4
0
 public final String getMetadata() {
   if (source == null) {
     return getVersion();
   }
   return source.getPlainString() + "\n" + getVersion();
 }
Esempio n. 5
0
 public Display getTitle() {
   if (source == null) {
     return Display.empty();
   }
   return source.getTitle();
 }