private LinkType getLinkType(RegexResult arg) { final RegexPartialMatch match = arg.get("ARROW"); // Log.println("type=" + match); final LinkDecor decors1 = getDecors1(match.get(1)); final LinkDecor decors2 = getDecors2(match.get(5)); // Log.println("Adecors1=" + decors1); // Log.println("Adecors2=" + decors2); LinkType result = new LinkType(decors2, decors1); if (match.get(0).contains(".")) { result = result.getDashed(); } return result; }
static IEntity getEntity( ActivityDiagram system, Map<String, RegexPartialMatch> arg, final boolean start) { final String suf = start ? "" : "2"; final RegexPartialMatch openBracket = arg.get("OPENBRACKET" + suf); if (openBracket != null && openBracket.get(0) != null) { return system.createInnerActivity(); } if (arg.get("STAR" + suf).get(0) != null) { if (start) { return system.getStart(); } return system.getEnd(); } final String code = arg.get("CODE" + suf).get(0); if (code != null) { return system.getOrCreate(code, code, getTypeIfExisting(system, code)); } final String bar = arg.get("BAR" + suf).get(0); if (bar != null) { return system.getOrCreate(bar, bar, EntityType.SYNCHRO_BAR); } final RegexPartialMatch quoted = arg.get("QUOTED" + suf); if (quoted.get(0) != null) { final String quotedCode = quoted.get(1) == null ? quoted.get(0) : quoted.get(1); return system.getOrCreate(quotedCode, quoted.get(0), getTypeIfExisting(system, quotedCode)); } final String first = arg.get("FIRST" + suf).get(0); if (first == null) { return system.getLastEntityConsulted(); } throw new UnsupportedOperationException(); }
private Direction getDirection(RegexResult arg) { final RegexPartialMatch match = arg.get("ARROW"); final LinkDecor decors1 = getDecors1(match.get(1)); final LinkDecor decors2 = getDecors2(match.get(5)); // Log.println("Bdecors1=" + decors1); // Log.println("Bdecors2=" + decors2); String s = arg.get("ARROW", 0); // Log.println("direction1=" + s); s = s.replaceAll("[^-.=\\w]", ""); if (s.startsWith("o")) { s = s.substring(1); } if (s.endsWith("o")) { s = s.substring(0, s.length() - 1); } // Log.println("direction2=" + s); // if (decors1 == LinkDecor.NONE && decors2 == LinkDecor.NONE) { // return StringUtils.getQueueDirection(s); // } // if (decors1 == LinkDecor.ARROW && decors2 == LinkDecor.NONE) { // return StringUtils.getQueueDirection(s); // } // if (decors1 == LinkDecor.NONE && decors2 == LinkDecor.ARROW) { // return StringUtils.getQueueDirection(s); // } Direction result = StringUtils.getQueueDirection(s); if (isInversed(decors1, decors2) && s.matches(".*\\w.*")) { result = result.getInv(); } // Log.println("result="+result); return result; }