예제 #1
0
 public IEntity getHistorical() {
   final Group g = getCurrentGroup();
   if (g == null) {
     return getOrCreateEntity("*historical", EntityType.PSEUDO_STATE);
   }
   return getOrCreateEntity("*historical*" + g.getCode(), EntityType.PSEUDO_STATE);
 }
예제 #2
0
 @Override
 protected CommandExecutionResult executeArg(List<String> arg) {
   final String code;
   final String display;
   if (arg.get(1) == null) {
     if (StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0)).length() == 0) {
       code = "##" + UniqueSequence.getValue();
       display = null;
     } else {
       code = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0));
       display = code;
     }
   } else {
     display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(arg.get(0));
     code = arg.get(1);
   }
   final Group currentPackage = getSystem().getCurrentGroup();
   // if (getSystem().entityExist(code)) {
   // return CommandExecutionResult.error("Package cannot have the same
   // name as an existing class");
   // }
   final Group p =
       getSystem().getOrCreateGroup(code, display, null, GroupType.PACKAGE, currentPackage);
   p.setBold(true);
   final String color = arg.get(2);
   if (color != null) {
     p.setBackColor(HtmlColor.getColorIfValid(color));
   }
   return CommandExecutionResult.ok();
 }
예제 #3
0
 public IEntity getEnd() {
   final Group p = getCurrentGroup();
   if (p == null) {
     return getOrCreateEntity("*end", EntityType.CIRCLE_END);
   }
   return getOrCreateEntity("*end*" + p.getCode(), EntityType.CIRCLE_END);
 }
예제 #4
0
 public IEntity getStart() {
   final Group g = getCurrentGroup();
   if (g == null) {
     return getOrCreateEntity("*start", EntityType.CIRCLE_START);
   }
   return getOrCreateEntity("*start*" + g.getCode(), EntityType.CIRCLE_START);
 }
예제 #5
0
 @Override
 public void endGroup() {
   final Group cur = getCurrentGroup();
   if (cur != null && cur.getType() == GroupType.CONCURRENT_STATE) {
     super.endGroup();
   }
   super.endGroup();
 }
  public CucaDiagramSimplifier2(CucaDiagram diagram, List<String> dotStrings)
      throws IOException, InterruptedException {
    this.diagram = diagram;
    boolean changed;
    do {
      changed = false;
      final Collection<Group> groups = new ArrayList<Group>(diagram.getGroups(false));
      for (Group g : groups) {
        if (diagram.isAutarkic(g)) {
          final EntityType type;
          if (g.getType() == GroupType.CONCURRENT_STATE) {
            type = EntityType.STATE_CONCURRENT;
          } else if (g.getType() == GroupType.STATE) {
            type = EntityType.STATE;
          } else if (g.getType() == GroupType.INNER_ACTIVITY) {
            type = EntityType.ACTIVITY;
          } else if (g.getType() == GroupType.CONCURRENT_ACTIVITY) {
            type = EntityType.ACTIVITY_CONCURRENT;
          } else {
            throw new IllegalStateException();
          }
          final Entity proxy =
              new Entity(
                  "#" + g.getCode(), g.getDisplay(), type, g.getParent(), diagram.getHides());
          // if (type == EntityType.STATE) {
          // manageBackColorForState(diagram, g, proxy);
          // }
          for (Member field : g.getEntityCluster().getFieldsToDisplay()) {
            proxy.addField(field);
          }
          computeImageGroup(g, proxy, dotStrings);
          diagram.overideGroup(g, proxy);
          if (proxy.getImageFile() != null) {
            diagram.ensureDelete(proxy.getImageFile());
          }

          // final IEntity entityCluster = g.getEntityCluster();
          // if (entityCluster != null && entityCluster.getImageFile()
          // != null) {
          // proxy.addSubImage(entityCluster.getImageFile());
          // }
          // if (entityCluster != null) {
          // proxy.addSubImage((Entity) entityCluster);
          // }

          for (IEntity sub : g.entities().values()) {
            final DrawFile subImage = sub.getImageFile();
            if (subImage != null) {
              proxy.addSubImage(subImage);
            }
          }

          changed = true;
        }
      }
    } while (changed);
  }
예제 #7
0
 public boolean concurrentState() {
   final Group cur = getCurrentGroup();
   if (cur != null && cur.getType() == GroupType.CONCURRENT_STATE) {
     super.endGroup();
   }
   final Group conc1 =
       getOrCreateGroup(
           "CONC" + UniqueSequence.getValue(),
           "",
           null,
           GroupType.CONCURRENT_STATE,
           getCurrentGroup());
   conc1.setDashed(true);
   if (cur != null && cur.getType() == GroupType.STATE) {
     cur.moveEntitiesTo(conc1);
     super.endGroup();
     final Group conc2 =
         getOrCreateGroup(
             "CONC" + UniqueSequence.getValue(),
             "",
             null,
             GroupType.CONCURRENT_STATE,
             getCurrentGroup());
     conc2.setDashed(true);
   }
   return true;
 }
예제 #8
0
 protected final String getFullyQualifiedCode(String code) {
   if (code.startsWith("\\") || code.startsWith("~") || code.startsWith(".")) {
     return code.substring(1);
   }
   if (code.contains(".")) {
     return code;
   }
   final Group g = this.getCurrentGroup();
   if (g == null) {
     return code;
   }
   final String namespace = g.getNamespace();
   if (namespace == null) {
     return code;
   }
   return namespace + "." + code;
 }
예제 #9
0
 public IEntity getHistorical(String codeGroup) {
   final Group g = getOrCreateGroup(codeGroup, null, null, GroupType.STATE, null);
   final IEntity result = getOrCreateEntity("*historical*" + g.getCode(), EntityType.PSEUDO_STATE);
   endGroup();
   return result;
 }