Skip to content

Commit 51d491c

Browse files
authored
Update agileuml1.9.9
Update of executable and source files.
1 parent 62c8ab1 commit 51d491c

13 files changed

+875
-230
lines changed

AndroidAppGenerator.java

Lines changed: 210 additions & 31 deletions
Large diffs are not rendered by default.

BasicExpression.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11941,7 +11941,8 @@ else if (parameters != null)
1194111941
textrules = new Vector();
1194211942
CGRule r = cgs.matchedBasicExpressionRule(this,etext,textrules);
1194311943

11944-
// System.out.println(">>> Found basic expression rule: " + r + " for " + this);
11944+
System.out.println(">>> Found basic expression rule: " + r + " for " + this + " args= " + args +
11945+
" eargs= " + eargs);
1194511946

1194611947
if (r != null)
1194711948
{ if (textrules.size() > 0)
@@ -11967,7 +11968,7 @@ else if (parameters != null)
1196711968
}
1196811969
else if (tr.variables.size() == 1 &&
1196911970
tr.lhs.endsWith("_1()")) // it is text_1()
11970-
{ BasicExpression rootexp = (BasicExpression) clone();
11971+
{ BasicExpression rootexp = (BasicExpression) clone();
1197111972
rootexp.parameters = null;
1197211973
String rootstring = rootexp + "";
1197311974
String prefix = ModelElement.longestCommonPrefix(rootstring,tr.lhs);
@@ -11976,20 +11977,20 @@ else if (tr.variables.size() == 1 &&
1197611977
textargs.add(remstring);
1197711978
return tr.applyRule(textargs);
1197811979
}
11979-
else if (tr.variables.size() == 1 &&
11980-
tr.lhs.endsWith("(_1)")) // it is text(_1)
11981-
{ Vector textargs = new Vector();
11982-
String parstring = "";
11983-
for (int i = 0; i < parameters.size(); i++)
11984-
{ Expression par = (Expression) parameters.get(i);
11985-
parstring = parstring + par.cg(cgs);
11986-
if (i < parameters.size() - 1)
11987-
{ parstring = parstring + ", "; }
11988-
}
11989-
textargs.add(parstring);
11990-
return tr.applyRule(textargs);
11991-
}
11992-
}
11980+
else if (tr.variables.size() == 1 &&
11981+
tr.lhs.endsWith("(_1)")) // it is text(_1)
11982+
{ Vector textargs = new Vector();
11983+
String parstring = "";
11984+
for (int i = 0; i < parameters.size(); i++)
11985+
{ Expression par = (Expression) parameters.get(i);
11986+
parstring = parstring + par.cg(cgs);
11987+
if (i < parameters.size() - 1)
11988+
{ parstring = parstring + ", "; }
11989+
}
11990+
textargs.add(parstring);
11991+
return tr.applyRule(textargs);
11992+
}
11993+
}
1199311994
String res = r.applyRule(args,eargs,cgs);
1199411995
if (needsBracket)
1199511996
{ return "(" + res + ")"; }
@@ -12001,7 +12002,7 @@ else if (tr.variables.size() == 1 &&
1200112002
if (r != null)
1200212003
{ System.out.println(">>> Found basic expression text rule: " + r + " for " + this);
1200312004
return r.applyTextRule(etext);
12004-
}
12005+
}
1200512006
}
1200612007
return etext;
1200712008
}

BehaviouralFeature.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ public void setActivity(Statement st)
9898

9999
public void setResultType(Type t)
100100
{ resultType = t; }
101+
102+
public boolean hasReturnVariable()
103+
{ if (resultType == null)
104+
{ return false; }
105+
if ("void".equals(resultType + ""))
106+
{ return false; }
107+
return true;
108+
}
101109

102110
public String cg(CGSpec cgs)
103111
{ String etext = this + "";
@@ -1212,7 +1220,7 @@ public String genQueryCode(Entity ent, Vector cons)
12121220
if (isClassScope() || isStatic())
12131221
{ res = res + "static "; }
12141222

1215-
if (resultType == null)
1223+
if (resultType == null || "void".equals(resultType + ""))
12161224
{ JOptionPane.showMessageDialog(null, "ERROR: null result type for: " + this,
12171225
"Type error", JOptionPane.ERROR_MESSAGE);
12181226
return "";
@@ -1257,7 +1265,7 @@ public String genQueryCodeJava6(Entity ent, Vector cons)
12571265
if (isClassScope() || isStatic())
12581266
{ res = res + "static "; }
12591267

1260-
if (resultType == null)
1268+
if (resultType == null || "void".equals(resultType + ""))
12611269
{ JOptionPane.showMessageDialog(null, "ERROR: null result type for: " + this,
12621270
"Type error", JOptionPane.ERROR_MESSAGE);
12631271
return "";
@@ -1303,7 +1311,7 @@ public String genQueryCodeJava7(Entity ent, Vector cons)
13031311
if (isClassScope() || isStatic())
13041312
{ res = res + "static "; }
13051313

1306-
if (resultType == null)
1314+
if (resultType == null || "void".equals(resultType + ""))
13071315
{ JOptionPane.showMessageDialog(null, "ERROR: null result type for: " + this,
13081316
"Type error", JOptionPane.ERROR_MESSAGE);
13091317
return "";
@@ -1349,7 +1357,7 @@ public String genQueryCodeCSharp(Entity ent, Vector cons)
13491357
if (isClassScope() || isStatic())
13501358
{ res = res + "static "; }
13511359

1352-
if (resultType == null)
1360+
if (resultType == null || "void".equals(resultType + ""))
13531361
{ JOptionPane.showMessageDialog(null, "ERROR: null result type for: " + this,
13541362
"Type error", JOptionPane.ERROR_MESSAGE);
13551363
return "";
@@ -1395,7 +1403,7 @@ public String genQueryCodeCPP(Entity ent, Vector cons)
13951403
// if (isClassScope() || isStatic())
13961404
// { res = res + "static "; }
13971405

1398-
if (resultType == null)
1406+
if (resultType == null || "void".equals(resultType + ""))
13991407
{ JOptionPane.showMessageDialog(null, "ERROR: null result type for: " + this,
14001408
"Type error", JOptionPane.ERROR_MESSAGE);
14011409
return "";
@@ -2134,7 +2142,7 @@ public String getOperationCode(Entity ent, Vector entities, Vector types)
21342142
if (ent.isInterface())
21352143
{ return " public " + ts + " " + name + "(" + pars + ");\n"; }
21362144

2137-
if (tp != null)
2145+
if (tp != null && !"void".equals(ts))
21382146
{ res = res + ts + " result;\n"; }
21392147
localatts.addAll(parameters);
21402148
cde.typeCheck(types,entities,context,localatts);
@@ -2173,7 +2181,7 @@ else if (activity != null)
21732181

21742182
res = " public " + header + ts + " " + name + "(" + pars + ")\n { ";
21752183

2176-
if (tp != null)
2184+
if (tp != null && !"void".equals(ts))
21772185
{ res = res + ts + " result;\n"; }
21782186
localatts.addAll(parameters);
21792187

@@ -2309,7 +2317,7 @@ public String getOperationCodeJava6(Entity ent, Vector entities, Vector types)
23092317
if (ent != null && ent.isInterface())
23102318
{ return " public " + ts + " " + name + "(" + pars + ");\n"; }
23112319

2312-
if (tp != null)
2320+
if (tp != null && !"void".equals(ts))
23132321
{ res = res + ts + " result;\n"; }
23142322
localatts.addAll(parameters);
23152323
cde.typeCheck(types,entities,context,localatts);
@@ -2348,8 +2356,9 @@ else if (activity != null)
23482356

23492357
res = " public " + header + ts + " " + name + "(" + pars + ")\n { ";
23502358

2351-
if (tp != null)
2359+
if (tp != null && !("void".equals(ts)))
23522360
{ res = res + ts + " result;\n"; }
2361+
23532362
localatts.addAll(parameters);
23542363
Vector preterms = activity.allPreTerms();
23552364
if (preterms.size() > 0)
@@ -2955,7 +2964,7 @@ public String getOperationCodeCPP(Entity ent, Vector entities, Vector types, Vec
29552964
public String buildQueryOp(Entity ent, String opname,
29562965
Type t, String resT,
29572966
Vector entities, Vector types)
2958-
{ if (resultType == null)
2967+
{ if (resultType == null || "void".equals(resT))
29592968
{ System.err.println("ERROR: No result type for " + opname);
29602969
return "";
29612970
}
@@ -3130,7 +3139,7 @@ public String buildQueryOp(Entity ent, String opname,
31303139
public String buildQueryOpJava6(Entity ent, String opname,
31313140
Type t, String resT,
31323141
Vector entities, Vector types)
3133-
{ if (resultType == null)
3142+
{ if (resultType == null || "void".equals(resT))
31343143
{ System.err.println("ERROR: No result type for " + opname);
31353144
return "";
31363145
}
@@ -3242,7 +3251,7 @@ public String buildQueryOpJava7(Entity ent, String opname,
32423251
Type t, String resT,
32433252
Vector entities, Vector types)
32443253
{
3245-
if (resultType == null)
3254+
if (resultType == null || "void".equals(resultType + ""))
32463255
{ System.err.println("ERROR: No result type for " + opname);
32473256
return "";
32483257
}
@@ -3348,7 +3357,7 @@ public String buildQueryOpJava7(Entity ent, String opname,
33483357
public String buildQueryOpCSharp(Entity ent, String opname,
33493358
Type t, String resT,
33503359
Vector entities, Vector types)
3351-
{ if (resultType == null)
3360+
{ if (resultType == null || "void".equals(resultType + ""))
33523361
{ System.err.println("ERROR: No result type for " + opname);
33533362
return "";
33543363
}
@@ -3460,7 +3469,7 @@ public String buildQueryOpCSharp(Entity ent, String opname,
34603469
public String buildQueryOpCPP(Entity ent, String opname,
34613470
Type t, String resT,
34623471
Vector entities, Vector types, Vector decs)
3463-
{ if (resultType == null)
3472+
{ if (resultType == null || "void".equals(resultType + ""))
34643473
{ System.err.println("ERROR: No result type for " + opname);
34653474
return "";
34663475
}
@@ -4384,6 +4393,8 @@ public String buildUpdateOp(Entity ent, String opname,
43844393
{ String preheader = "";
43854394
String javaPars = getJavaParameterDec();
43864395

4396+
System.out.println(">>> Building update op for " + opname + " : " + t + " >> " + resT);
4397+
43874398
String header = " public ";
43884399
if (isAbstract())
43894400
{ header = header + "abstract "; }

CGCondition.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ else if ("variable".equals(stereotype))
210210
else
211211
{ return e.umlkind != Expression.VARIABLE; }
212212
}
213+
else if ("attribute".equals(stereotype))
214+
{ if (positive)
215+
{ return e.umlkind == Expression.ATTRIBUTE; }
216+
else
217+
{ return e.umlkind != Expression.ATTRIBUTE; }
218+
}
219+
else if ("role".equals(stereotype))
220+
{ if (positive)
221+
{ return e.umlkind == Expression.ROLE; }
222+
else
223+
{ return e.umlkind != Expression.ROLE; }
224+
}
213225
return false;
214226
}
215227

Compiler2.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,18 +4275,23 @@ else if ("precondition".equals(jx))
42754275

42764276
public UseCase parseKM3UseCase(int st, int en, Vector entities, Vector types,
42774277
Vector gens, Vector pasts)
4278-
{ // usecase name { parameters postconditions activity }
4279-
String nme = lexicals.get(st+1) + "";
4280-
4278+
{ // usecase name : type { parameters postconditions activity }
4279+
String nme = lexicals.get(st+1) + "";
4280+
String typ = lexicals.get(st+3) + "";
4281+
Type uctyp = parseType(st+3,st+3,entities,types);
4282+
42814283
UseCase uc = new UseCase(nme);
4282-
int startpostconditions = st + 2;
4284+
uc.setResultType(uctyp);
4285+
System.out.println(">>> use case " + nme + " has return type " + uctyp);
4286+
4287+
int startpostconditions = st + 4;
42834288
int endpostconditions = en;
42844289
int startactivity = en;
42854290
boolean foundpostconditions = false;
42864291
boolean foundactivity = false;
42874292

42884293

4289-
for (int i = st + 2; i < en; i++)
4294+
for (int i = st + 4; i < en; i++)
42904295
{ String lx = lexicals.get(i) + "";
42914296
if ("activity".equals(lx) && ":".equals(lexicals.get(i+1) + ""))
42924297
{ foundactivity = true;
@@ -4295,7 +4300,7 @@ public UseCase parseKM3UseCase(int st, int en, Vector entities, Vector types,
42954300
}
42964301
}
42974302

4298-
for (int i = st + 2; i < en && i < endpostconditions; i++)
4303+
for (int i = st + 4; i < en && i < endpostconditions; i++)
42994304
{ String lx = lexicals.get(i) + "";
43004305
if (":".equals(lx) && ":".equals(lexicals.get(i+1) + ""))
43014306
{ String scope = lexicals.get(i-1) + ""; // must be present, can be void
@@ -4381,7 +4386,7 @@ else if (ff != null)
43814386
}
43824387

43834388
if (foundpostconditions == false && foundactivity == true)
4384-
{ parseUseCaseParameters(uc,st+2,startactivity-2,entities,types);
4389+
{ parseUseCaseParameters(uc,st+4,startactivity-2,entities,types);
43854390
int actualend = en-1;
43864391
if (";".equals(lexicals.get(actualend) + ""))
43874392
{ actualend = en-2; }

0 commit comments

Comments
 (0)