Skip to content

Commit ad6ea10

Browse files
authored
Updated web/Android app generators
1 parent 5818cb8 commit ad6ea10

17 files changed

+1213
-172
lines changed

AndroidAppGenerator.java

+535-83
Large diffs are not rendered by default.

Association.java

+13-2
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ public boolean isManyOne() // either way round
357357
public boolean isOneMany()
358358
{ return card1 == ONE && card2 == MANY; }
359359

360+
public boolean isZeroOneMany()
361+
{ return card1 == ZEROONE && card2 == MANY; }
362+
360363
public boolean isZeroOne()
361364
{ return card2 == ZEROONE; }
362365

@@ -9778,7 +9781,7 @@ public String ejbBeanGet()
97789781
String fl = role2.substring(0,1);
97799782
String rem = role2.substring(1,role2.length());
97809783
res = res + fl.toUpperCase() +
9781-
rem + "();\n";
9784+
rem + "();\n\n";
97829785
return res;
97839786
}
97849787

@@ -9792,7 +9795,15 @@ public String ejbBeanSet()
97929795
{ res = res + "Collection"; }
97939796
else
97949797
{ res = res + entity2.getName(); }
9795-
res = res + " x);\n";
9798+
res = res + " x);\n\n";
9799+
9800+
if (card2 == MANY)
9801+
{ res = res + " public abstract void add" + role2 +
9802+
"(" + entity2.getName() + " x);\n\n";
9803+
res = res + " public abstract void remove" + role2 +
9804+
"(" + entity2.getName() + " x);\n\n";
9805+
}
9806+
97969807
return res;
97979808
}
97989809

Attribute.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -7997,8 +7997,8 @@ else if (isCollection())
79977997
{ res2 = " <EditText\n\r" +
79987998
" android:id=\"@+id/" + attfield + "\"\n" +
79997999
" android:inputType=\"text|textMultiLine\"\n" +
8000-
" android:minLines=\"5\"\n" +
8001-
" android:gravity=\"top\"\n" +
8000+
" android:minLines=\"5\"\n" +
8001+
" android:gravity=\"top\"\n" +
80028002
" android:layout_span=\"4\" />\n\r"; }
80038003
else
80048004
{ res2 = " <EditText\n\r" +

BasicExpression.java

+5
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,11 @@ public Expression invert()
15901590
public void findClones(java.util.Map clones, String rule, String op)
15911591
{ return; }
15921592

1593+
public void findClones(java.util.Map clones,
1594+
java.util.Map cloneDefs,
1595+
String rule, String op)
1596+
{ return; }
1597+
15931598
public void findMagicNumbers(java.util.Map mgns, String rule, String op)
15941599
{ if (umlkind == VALUE)
15951600
{ if ("0".equals(data) || "1".equals(data) ||

BehaviouralFeature.java

+18
Original file line numberDiff line numberDiff line change
@@ -3698,6 +3698,24 @@ else if (useCase != null)
36983698
{ activity.findClones(clones, null, nme); }
36993699
}
37003700

3701+
public void findClones(java.util.Map clones,
3702+
java.util.Map cloneDefinitions)
3703+
{ String nme = getName();
3704+
if (entity != null)
3705+
{ nme = entity.getName() + "::" + nme; }
3706+
else if (useCase != null)
3707+
{ nme = useCase.getName() + "::" + nme; }
3708+
3709+
if (pre != null)
3710+
{ pre.findClones(clones, cloneDefinitions, null, nme); }
3711+
if (post != null)
3712+
{ post.findClones(clones, cloneDefinitions, null, nme); }
3713+
if (activity != null)
3714+
{ activity.findClones(clones, cloneDefinitions,
3715+
null, nme);
3716+
}
3717+
}
3718+
37013719
public void findMagicNumbers(java.util.Map mgns)
37023720
{ String nme = getName();
37033721
if (entity != null)

BinaryExpression.java

+30-1
Original file line numberDiff line numberDiff line change
@@ -2926,7 +2926,12 @@ public Vector allValuesUsedIn()
29262926
} // ->iterate, add accumulator expression
29272927

29282928
public void findClones(java.util.Map clones, String rule, String op)
2929-
{ if (this.syntacticComplexity() < UCDArea.CLONE_LIMIT)
2929+
{ /* System.out.println(">>> complexity of " + this + " = " +
2930+
this.syntacticComplexity());
2931+
System.out.println(">>> Clone limit = " +
2932+
UCDArea.CLONE_LIMIT); */
2933+
2934+
if (this.syntacticComplexity() < UCDArea.CLONE_LIMIT)
29302935
{ return; }
29312936
String val = this + "";
29322937
Vector used = (Vector) clones.get(val);
@@ -2941,6 +2946,30 @@ else if (op != null)
29412946
right.findClones(clones,rule,op);
29422947
}
29432948

2949+
public void findClones(java.util.Map clones,
2950+
java.util.Map cloneDefs,
2951+
String rule, String op)
2952+
{ /* System.out.println(">>> complexity of " + this + " = " +
2953+
this.syntacticComplexity());
2954+
System.out.println(">>> Clone limit = " +
2955+
UCDArea.CLONE_LIMIT); */
2956+
2957+
if (this.syntacticComplexity() < UCDArea.CLONE_LIMIT)
2958+
{ return; }
2959+
String val = this + "";
2960+
Vector used = (Vector) clones.get(val);
2961+
if (used == null)
2962+
{ used = new Vector(); }
2963+
if (rule != null)
2964+
{ used.add(rule); }
2965+
else if (op != null)
2966+
{ used.add(op); }
2967+
clones.put(val,used);
2968+
cloneDefs.put(val, this);
2969+
left.findClones(clones,cloneDefs,rule,op);
2970+
right.findClones(clones,cloneDefs,rule,op);
2971+
}
2972+
29442973
public void findMagicNumbers(java.util.Map mgns, String rule, String op)
29452974
{ left.findMagicNumbers(mgns,rule,op);
29462975
right.findMagicNumbers(mgns,rule,op);

Compiler2.java

+14-2
Original file line numberDiff line numberDiff line change
@@ -5389,6 +5389,16 @@ public static String isKeywordOrPart(String st, String[] mess)
53895389
return "arg->prd()";
53905390
}
53915391

5392+
if ("->pow".startsWith(st))
5393+
{ mess[0] = "Power operator on numbers";
5394+
return "arg->pow(exponent)";
5395+
}
5396+
5397+
if ("->gcd".startsWith(st))
5398+
{ mess[0] = "GCD operator on integers";
5399+
return "arg->gcd(arg2)";
5400+
}
5401+
53925402
if ("->display".startsWith(st))
53935403
{ mess[0] = "Display operator on strings";
53945404
return "arg->display()";
@@ -5571,7 +5581,8 @@ public static String isKeywordOrPart(String st, String[] mess)
55715581
"OclRandom".startsWith(st) ||
55725582
"OclFile".startsWith(st) ||
55735583
"OclException".startsWith(st) ||
5574-
"OclIterator".startsWith(st))
5584+
"OclIterator".startsWith(st) ||
5585+
"OclDatasource".startsWith(st))
55755586
{ mess[0] = "OclAny -- universal type.\n" +
55765587
"OclType -- metatype of types. Requires ocltype.km3 library\n" +
55775588
"OclAttribute -- metatype of fields. Requires ocltype.km3 library\n" +
@@ -5580,7 +5591,8 @@ public static String isKeywordOrPart(String st, String[] mess)
55805591
"OclRandom -- random number generator. Needs oclrandom.km3\n" +
55815592
"OclFile -- type of files. Needs oclfile.km3\n" +
55825593
"OclIterator -- type of iterators. Needs ocliterator.km3\n" +
5583-
"OclException -- type of exceptions. Needs oclexception.km3\n";
5594+
"OclException -- type of exceptions. Needs oclexception.km3\n" +
5595+
"OclDatasource -- type of relational databases and remote datasources.\n Needs ocldatasource.km3, oclfile.km3, ocliterator.km3, ocldate.km3\n";
55845596
return "Ocl library type";
55855597
}
55865598
}

ConditionalExpression.java

+20
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,26 @@ else if (op != null)
168168
elseExp.findClones(clones,rule,op);
169169
}
170170

171+
public void findClones(java.util.Map clones,
172+
java.util.Map cloneDefs,
173+
String rule, String op)
174+
{ if (this.syntacticComplexity() < UCDArea.CLONE_LIMIT)
175+
{ return; }
176+
String val = this + "";
177+
Vector used = (Vector) clones.get(val);
178+
if (used == null)
179+
{ used = new Vector(); }
180+
if (rule != null)
181+
{ used.add(rule); }
182+
else if (op != null)
183+
{ used.add(op); }
184+
clones.put(val,used);
185+
cloneDefs.put(val, this);
186+
test.findClones(clones,cloneDefs, rule,op);
187+
ifExp.findClones(clones,cloneDefs, rule,op);
188+
elseExp.findClones(clones,cloneDefs, rule,op);
189+
}
190+
171191
public void findMagicNumbers(java.util.Map mgns, String rule, String op)
172192
{ test.findMagicNumbers(mgns,rule,op);
173193
ifExp.findMagicNumbers(mgns,rule,op);

0 commit comments

Comments
 (0)