Skip to content

Commit

Permalink
Updated Python code generator
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinlano authored Feb 18, 2025
1 parent 925824e commit a7cea57
Show file tree
Hide file tree
Showing 49 changed files with 24,603 additions and 21,312 deletions.
Binary file modified uml2py3/AssertStatement.class
Binary file not shown.
Binary file modified uml2py3/AssignStatement.class
Binary file not shown.
Binary file modified uml2py3/Association.class
Binary file not shown.
Binary file modified uml2py3/BasicExpression.class
Binary file not shown.
Binary file modified uml2py3/BehaviouralFeature.class
Binary file not shown.
Binary file modified uml2py3/BinaryExpression.class
Binary file not shown.
Binary file modified uml2py3/BoundedLoopStatement.class
Binary file not shown.
Binary file modified uml2py3/BreakStatement.class
Binary file not shown.
Binary file modified uml2py3/CatchStatement.class
Binary file not shown.
Binary file modified uml2py3/Classifier.class
Binary file not shown.
Binary file modified uml2py3/CollectionExpression.class
Binary file not shown.
Binary file modified uml2py3/CollectionType.class
Binary file not shown.
Binary file modified uml2py3/ConditionalExpression.class
Binary file not shown.
Binary file modified uml2py3/ConditionalStatement.class
Binary file not shown.
Binary file modified uml2py3/ContinueStatement.class
Binary file not shown.
Binary file modified uml2py3/Controller.class
Binary file not shown.
39,180 changes: 19,755 additions & 19,425 deletions uml2py3/Controller.java

Large diffs are not rendered by default.

Binary file modified uml2py3/CreationStatement.class
Binary file not shown.
Binary file modified uml2py3/DataType.class
Binary file not shown.
Binary file modified uml2py3/Entity.class
Binary file not shown.
Binary file modified uml2py3/Enumeration.class
Binary file not shown.
Binary file modified uml2py3/EnumerationLiteral.class
Binary file not shown.
Binary file modified uml2py3/ErrorStatement.class
Binary file not shown.
Binary file modified uml2py3/Expression.class
Binary file not shown.
Binary file modified uml2py3/FinalStatement.class
Binary file not shown.
Binary file modified uml2py3/Generalization.class
Binary file not shown.
Binary file modified uml2py3/ImplicitCallStatement.class
Binary file not shown.
Binary file modified uml2py3/LoopStatement.class
Binary file not shown.
Binary file modified uml2py3/MutationTest.class
Binary file not shown.
3,901 changes: 2,055 additions & 1,846 deletions uml2py3/MutationTest.java

Large diffs are not rendered by default.

Binary file modified uml2py3/Operation.class
Binary file not shown.
Binary file modified uml2py3/OperationCallStatement.class
Binary file not shown.
Binary file modified uml2py3/PrimitiveType.class
Binary file not shown.
Binary file modified uml2py3/Printcode.class
Binary file not shown.
Binary file modified uml2py3/Property.class
Binary file not shown.
Binary file modified uml2py3/ReturnStatement.class
Binary file not shown.
Binary file modified uml2py3/SequenceStatement.class
Binary file not shown.
Binary file modified uml2py3/Statement.class
Binary file not shown.
Binary file modified uml2py3/SystemTypes$Set.class
Binary file not shown.
136 changes: 95 additions & 41 deletions uml2py3/SystemTypes.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public static List select_3(List _l,List oonames)
return _results_3;
}

public static Map select_3(Map _l,List oonames)
public static HashMap select_3(Map _l,List oonames)
{ // Implements: generalization.general.allOperations()->select(op | op.name /: oonames)
Map _results_3 = new java.util.HashMap();
HashMap _results_3 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Operation op = (Operation) _l.get(_i);
Expand All @@ -96,9 +96,9 @@ public static List select_7(List _l)
return _results_7;
}

public static Map select_7(Map _l)
public static HashMap select_7(Map _l)
{ // Implements: allProperties()->select(a | a.isStatic = false)
Map _results_7 = new java.util.HashMap();
HashMap _results_7 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Property a = (Property) _l.get(_i);
Expand All @@ -120,9 +120,9 @@ public static List select_10(List _l)
return _results_10;
}

public static Map select_10(Map _l)
public static HashMap select_10(Map _l)
{ // Implements: ownedOperation->select(x | x.isStatic & x.isCached & x.parameters.size = 1)
Map _results_10 = new java.util.HashMap();
HashMap _results_10 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Operation x = (Operation) _l.get(_i);
Expand All @@ -144,9 +144,9 @@ public static List select_12(List _l)
return _results_12;
}

public static Map select_12(Map _l)
public static HashMap select_12(Map _l)
{ // Implements: ownedOperation->select(x | x.isStatic = false & x.isCached & x.parameters.size = 1)
Map _results_12 = new java.util.HashMap();
HashMap _results_12 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Operation x = (Operation) _l.get(_i);
Expand All @@ -168,9 +168,9 @@ public static List select_14(List _l)
return _results_14;
}

public static Map select_14(Map _l)
public static HashMap select_14(Map _l)
{ // Implements: allProperties()->select(x | x.isStatic)
Map _results_14 = new java.util.HashMap();
HashMap _results_14 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Property x = (Property) _l.get(_i);
Expand All @@ -192,9 +192,9 @@ public static List select_17(List _l)
return _results_17;
}

public static Map select_17(Map _l)
public static HashMap select_17(Map _l)
{ // Implements: allProperties()->select(property_17_xx | isUnique)
Map _results_17 = new java.util.HashMap();
HashMap _results_17 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Property property_17_xx = (Property) _l.get(_i);
Expand Down Expand Up @@ -266,9 +266,9 @@ public static List collect_0(List _l,Enumeration enumerationx)
return _results_0;
}

public static Map collect_0(Map _l,Enumeration enumerationx)
public static HashMap collect_0(Map _l,Enumeration enumerationx)
{ // implements: ownedLiteral->collect( lt | " " + lt.name + " = " + ownedLiteral->indexOf(lt) + "\n" )
Map _results_0 = new HashMap();
HashMap _results_0 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ EnumerationLiteral lt = (EnumerationLiteral) _l.get(_i);
Expand All @@ -289,9 +289,9 @@ public static List collect_1(List _l)
return _results_1;
}

public static Map collect_1(Map _l)
public static HashMap collect_1(Map _l)
{ // implements: specialization->collect( generalization_1_xx | specific.allLeafSubclasses() )
Map _results_1 = new HashMap();
HashMap _results_1 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Generalization generalization_1_xx = (Generalization) _l.get(_i);
Expand All @@ -312,9 +312,9 @@ public static List collect_2(List _l)
return _results_2;
}

public static Map collect_2(Map _l)
public static HashMap collect_2(Map _l)
{ // implements: self.ownedOperation->collect( operation_2_xx | name )
Map _results_2 = new HashMap();
HashMap _results_2 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Operation operation_2_xx = (Operation) _l.get(_i);
Expand All @@ -335,9 +335,9 @@ public static List collect_8(List _l)
return _results_8;
}

public static Map collect_8(Map _l)
public static HashMap collect_8(Map _l)
{ // implements: allProperties()->select( a | a.isStatic = false )->collect( x | x.initialisation() )
Map _results_8 = new HashMap();
HashMap _results_8 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Property x = (Property) _l.get(_i);
Expand All @@ -358,9 +358,9 @@ public static List collect_11(List _l)
return _results_11;
}

public static Map collect_11(Map _l)
public static HashMap collect_11(Map _l)
{ // implements: ownedOperation->select( x | x.isStatic & x.isCached & x.parameters.size = 1 )->collect( y | " " + y.name + "_cache = dict({})" + "\n" )
Map _results_11 = new HashMap();
HashMap _results_11 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Operation y = (Operation) _l.get(_i);
Expand All @@ -381,9 +381,9 @@ public static List collect_13(List _l)
return _results_13;
}

public static Map collect_13(Map _l)
public static HashMap collect_13(Map _l)
{ // implements: ownedOperation->select( x | x.isStatic = false & x.isCached & x.parameters.size = 1 )->collect( y | " self." + y.name + "_cache = dict({})" + "\n" )
Map _results_13 = new HashMap();
HashMap _results_13 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Operation y = (Operation) _l.get(_i);
Expand All @@ -404,9 +404,9 @@ public static List collect_15(List _l)
return _results_15;
}

public static Map collect_15(Map _l)
public static HashMap collect_15(Map _l)
{ // implements: allProperties()->select( x | x.isStatic )->collect( y | " " + y.name + " = " + y.type.defaultInitialValue() + "\n" )
Map _results_15 = new HashMap();
HashMap _results_15 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Property y = (Property) _l.get(_i);
Expand All @@ -427,9 +427,9 @@ public static List collect_18(List _l)
return _results_18;
}

public static Map collect_18(Map _l)
public static HashMap collect_18(Map _l)
{ // implements: pars->tail()->collect( p | ", " + p )
Map _results_18 = new HashMap();
HashMap _results_18 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ String p = (String) _l.get(_i);
Expand All @@ -450,9 +450,9 @@ public static List collect_19(List _l)
return _results_19;
}

public static Map collect_19(Map _l)
public static HashMap collect_19(Map _l)
{ // implements: Enumeration->collect( enumeration_19_xx | name )
Map _results_19 = new HashMap();
HashMap _results_19 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Enumeration enumeration_19_xx = (Enumeration) _l.get(_i);
Expand All @@ -473,9 +473,9 @@ public static List collect_20(List _l)
return _results_20;
}

public static Map collect_20(Map _l)
public static HashMap collect_20(Map _l)
{ // implements: arrayIndex->collect( expr | expr.type.name )
Map _results_20 = new HashMap();
HashMap _results_20 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Expression expr = (Expression) _l.get(_i);
Expand All @@ -496,9 +496,9 @@ public static List collect_21(List _l)
return _results_21;
}

public static Map collect_21(Map _l)
public static HashMap collect_21(Map _l)
{ // implements: parameters->collect( p | ", " + p.name )
Map _results_21 = new HashMap();
HashMap _results_21 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Property p = (Property) _l.get(_i);
Expand All @@ -519,9 +519,9 @@ public static List collect_22(List _l,int indent)
return _results_22;
}

public static Map collect_22(Map _l,int indent)
public static HashMap collect_22(Map _l,int indent)
{ // implements: statements->collect( s | s.toPython(indent) )
Map _results_22 = new HashMap();
HashMap _results_22 = new HashMap();
java.util.Set _keys = _l.keySet();
for (Object _i : _keys)
{ Statement s = (Statement) _l.get(_i);
Expand Down Expand Up @@ -557,7 +557,7 @@ public Set add(boolean x)
{ elements.add(new Boolean(x));
return this; }

public List getElements() { return elements; }
public Vector getElements() { return elements; }


public static Vector copyCollection(Vector s)
Expand Down Expand Up @@ -847,6 +847,29 @@ public static List concatenate(List a, List b)
res.addAll(b);
return res;
}

public static Vector singleValueMatrix(Vector sh, Object x)
{ Vector result;
if ((sh).size() == 0)
{ return (new Vector()); }
int n = (int) sh.get(0);

if ((sh).size() == 1)
{ Vector _results_0 = new Vector();
for (int _i = 0; _i < n; _i++)
{ _results_0.add(x); }
return _results_0;
}

Vector tl = (Vector) Set.tail(sh);
Vector res = (new Vector());
Vector _results_1 = new Vector();
for (int _i = 0; _i < n; _i++)
{ _results_1.add(Set.singleValueMatrix(tl,x)); }
res = (Vector) Set.concatenate(res, _results_1);
return res;
}



public static List closurePropertyqualifier(List _r)
Expand Down Expand Up @@ -1502,6 +1525,26 @@ public static List insertInto(List l, int ind, List ob)
{ res.add(l.get(i)); }
return res;
}

public static List excludingSubrange(List l, int startIndex, int endIndex)
{ List res = new Vector();
for (int i = 0; i < startIndex-1 && i < l.size(); i++)
{ res.add(l.get(i)); }
for (int i = endIndex; i < l.size(); i++)
{ res.add(l.get(i)); }
return res;
}

public static String setSubrange(String ss, int startIndex, int endIndex, String v)
{ String res = ss;
if (ss.length() < endIndex)
{ for (int i = ss.length()-1; i < endIndex; i++)
{ res = res + " "; }
}
return res.substring(0,startIndex-1) + v +
res.substring(endIndex);
}

public static String insertInto(String l, int ind, Object ob)
{ String res = "";
for (int i = 0; i < ind-1 && i < l.length(); i++)
Expand All @@ -1511,6 +1554,15 @@ public static String insertInto(String l, int ind, Object ob)
{ res = res + l.charAt(i); }
return res;
}
public static String excludingSubrange(String l, int startIndex, int endIndex)
{ String res = "";
for (int i = 0; i < startIndex-1 && i < l.length(); i++)
{ res = res + l.charAt(i); }
for (int i = endIndex; i < l.length(); i++)
{ res = res + l.charAt(i); }
return res;
}



public static List removeAt(List l, int ind)
Expand Down Expand Up @@ -1911,13 +1963,15 @@ public static HashMap antirestrictMap(Map m1, Vector ks)

public static boolean includesKey(Map m, Object key)
{ Object val = m.get(key);
if (val == null) { return false; }
if (val == null)
{ return false; }
return true;
}

public static boolean excludesKey(Map m, Object key)
{ Object val = m.get(key);
if (val == null) { return true; }
if (val == null)
{ return true; }
return false;
}

Expand All @@ -1927,7 +1981,7 @@ public static boolean includesValue(Map m, Object val)
for (int x = 0; x < keys.size(); x++)
{ Object v = m.get(x);
if (v != null && v.equals(val))
{ return true; }
{ return true; }
}
return false;
}
Expand All @@ -1938,7 +1992,7 @@ public static boolean excludesValue(Map m, Object val)
for (int x = 0; x < keys.size(); x++)
{ Object v = m.get(x);
if (v != null && v.equals(val))
{ return false; }
{ return false; }
}
return true;
}
Expand Down
Binary file modified uml2py3/TestsGUI.class
Binary file not shown.
18 changes: 18 additions & 0 deletions uml2py3/TestsGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,15 @@ public void actionPerformed(ActionEvent e)
} catch (Throwable _thrw) { }
}
System.out.println();
int[] binaryexpressions_mapRefPlus_counts = new int[100];
int[] binaryexpressions_mapRefPlus_totals = new int[100];
for (int _i = 0; _i < _binaryexpressions_instances; _i++)
{ BinaryExpression _ex = (BinaryExpression) Controller.inst().binaryexpressions.get(_i);
try {
MutationTest.mapRefPlus_mutation_tests(_ex,binaryexpressions_mapRefPlus_counts, binaryexpressions_mapRefPlus_totals);
} catch (Throwable _thrw) { }
}
System.out.println();
int[] binaryexpressions_mapBooleanExpression_counts = new int[100];
int[] binaryexpressions_mapBooleanExpression_totals = new int[100];
for (int _i = 0; _i < _binaryexpressions_instances; _i++)
Expand Down Expand Up @@ -452,6 +461,15 @@ public void actionPerformed(ActionEvent e)
} catch (Throwable _thrw) { }
}
System.out.println();
int[] collectionexpressions_toLambdaList_counts = new int[100];
int[] collectionexpressions_toLambdaList_totals = new int[100];
for (int _i = 0; _i < _collectionexpressions_instances; _i++)
{ CollectionExpression _ex = (CollectionExpression) Controller.inst().collectionexpressions.get(_i);
try {
MutationTest.toLambdaList_mutation_tests(_ex,collectionexpressions_toLambdaList_counts, collectionexpressions_toLambdaList_totals);
} catch (Throwable _thrw) { }
}
System.out.println();
}

{ int _basicexpressions_instances = Math.min(MAXOBJECTS, Controller.inst().basicexpressions.size());
Expand Down
Binary file modified uml2py3/TryStatement.class
Binary file not shown.
Binary file modified uml2py3/Type.class
Binary file not shown.
Binary file modified uml2py3/UnaryExpression.class
Binary file not shown.
Binary file modified uml2py3/UnboundedLoopStatement.class
Binary file not shown.
Binary file modified uml2py3/UseCase.class
Binary file not shown.
Loading

0 comments on commit a7cea57

Please sign in to comment.