protected String getTokenName(Token parent, String transitionName) { if (transitionName != null) { // use transition name, if not taken already if (!parent.hasChild(transitionName)) return transitionName; // append numeric suffix to transition name StringBuffer tokenText = new StringBuffer(transitionName); String tokenName; int baseLength = transitionName.length(); int suffix = 2; do { tokenText.append(suffix++); tokenName = tokenText.toString(); tokenText.setLength(baseLength); } while (parent.hasChild(tokenName)); return tokenName; } // no transition name else { Map childTokens = parent.getChildren(); return childTokens != null ? Integer.toString(childTokens.size() + 1) : "1"; } }
protected String getTokenName(Token parent, String transitionName) { if (transitionName != null) { // use transition name, if not taken already if (!parent.hasChild(transitionName)) return transitionName; // append numeric suffix to transition name StringBuffer tokenText = new StringBuffer(transitionName); String tokenName; int baseLength = transitionName.length(); int suffix = 2; do { tokenText.append(suffix++); tokenName = tokenText.toString(); tokenText.setLength(baseLength); } while (parent.hasChild(tokenName)); return tokenName; } // no transition name else { Map childTokens = parent.getChildren(); return childTokens != null ? Integer.toString(childTokens.size() + 1) : "1"; } }