*/\r
public String getDeclaration() {\r
\r
- StringBuilder parameters = new StringBuilder();\r
StringBuilder redeclarations = new StringBuilder();\r
- \r
- \r
if(!getRedeclarations().isEmpty()) {\r
redeclarations.append("(");\r
Iterator<Redeclaration> i = getRedeclarations().iterator();\r
while(i.hasNext()) {\r
Redeclaration rd = i.next();\r
redeclarations.append(rd.getRedeclaration());\r
- parameters.append(rd.getParameters());\r
if(i.hasNext())\r
redeclarations.append(",");\r
}\r
\r
\r
StringBuilder sb = new StringBuilder();\r
- sb.append(parameters);\r
sb.append(" ");\r
sb.append(getType().getName());\r
sb.append(" ");\r
if(replacedEnumeration == null || replacingEnumeration == null) {\r
return "";\r
}\r
- String separator = getSeparator();\r
StringBuilder sb = new StringBuilder();\r
sb.append(replacedEnumeration.getName());\r
sb.append(".size = ");\r
sb.append(replacingEnumeration.getName());\r
- sb.append(separator + "size, ");\r
+ sb.append("_size, ");\r
sb.append(replacedEnumeration.getName());\r
sb.append(".elements = ");\r
sb.append(replacingEnumeration.getName());\r
- sb.append(separator + "elements");\r
+ sb.append("_elements");\r
\r
return sb.toString();\r
}\r
- \r
- /**\r
- * Change the name of the re-declaration parameters to enable the use of \r
- * enumerations with same names.\r
- * \r
- * @return\r
- */\r
- public String getParameters() {\r
- String separator = getSeparator();\r
- StringBuilder sb = new StringBuilder();\r
- sb.append(" parameter Integer " + replacingEnumeration.getName() + separator + "size = " + replacingEnumeration.getName() + ".size;\n");\r
- sb.append(" parameter Integer " + replacingEnumeration.getName() + separator + "elements[:] = " + replacingEnumeration.getName() + ".elements;\n");\r
- return sb.toString();\r
- }\r
- \r
- private String getSeparator() {\r
- return getSeparator(this, "_");\r
- }\r
-\r
- /**\r
- * Add enough separation marks that name conflicts would not exist.\r
- * \r
- * @param redeclaration\r
- * @param separator\r
- * @return\r
- */\r
- private String getSeparator(Redeclaration redeclaration, String separator) {\r
- if(redeclaration == null || redeclaration.replacedEnumeration == null ||\r
- redeclaration.replacedEnumeration.getParentConfiguration() == null)\r
- return separator = "_";\r
- for(IElement e : redeclaration.replacedEnumeration.getParentConfiguration().getElements()) {\r
- if(e instanceof Module) {\r
- for(Redeclaration rd : ((Module)e).getRedeclarations()) {\r
- if(rd.replacedEnumeration.name.equals(redeclaration.replacedEnumeration.name) &&\r
- rd.replacingEnumeration.equals(redeclaration.replacedEnumeration)) {\r
- String separatorTmp = getSeparator(rd, separator);\r
- if(separatorTmp.length() > separator.length())\r
- separator = separatorTmp;\r
- }\r
- }\r
- }\r
- }\r
- return separator + "_";\r
- }\r
\r
public Enumeration getReplacedEnumeration() {\r
return replacedEnumeration;\r