1
0

Compare commits

...

88 Commits

Author SHA1 Message Date
c68d773486 modified: ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java
modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Threadsteuerung veranendert, so dass möglichst veile Threads gleichzeitig laufen.
Müsste noch verbessert werden können.
2019-11-18 14:37:59 +01:00
00bbd5279f modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
log-File-Ausgabe etwas ergaenzt

	modified:   src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java
Fehler korrigiert, dass alle Fieldinitializer bei mehreren Klassen additiv hinzugefuegt werden

	modified:   src/main/java/de/dhbwstuttgart/syntaxtree/statement/This.java
toString veranedert

	modified:   src/test/resources/bytecode/javFiles/mathStruc.jav
leichte Korrektur

	new file:   src/test/java/bytecode/mathStrucIntegerTest.java
	new file:   src/test/resources/bytecode/javFiles/mathStrucInteger.jav
mathStruc auf Integer angewandt

	new file:   src/test/resources/bytecode/javFiles/mathStrucMatrixOP.jav
mathStruc auf MatrixOP angewandt, laeuft noch nicht durch, des halb Test noch nicht eingecheckt
2019-10-24 17:47:51 +02:00
6c783a18c7 new file: ../../../../../PlugInBau.txt
modified:   ../../bytecode/javFiles/Faculty.jav
	modified:   ../../bytecode/javFiles/OL.jav
	modified:   ../../bytecode/javFiles/Y.jav
	modified:   ../../bytecode/javFiles/mathStruc.jav
2019-10-22 16:44:38 +02:00
8c195601d5 Fixed signature problem for FunN 2019-10-12 11:32:56 +02:00
37f8f2e1e0 modified: ../../bytecode/javFiles/Y.jav
Anwendung von Y eingefuegt.
2019-09-19 13:57:49 +02:00
0903efda0d Fixed bug 115 2019-09-19 13:00:35 +02:00
c2030123d5 Fixed bugs 163 and 169 2019-09-17 09:33:18 +02:00
d1637b8eb9 Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-08-29 11:50:23 +02:00
9abda637a1 Generic generator algorithm - fixed bug 2019-08-29 10:49:18 +02:00
82c0837d1f mathStruc.jav hinzugefügt 2019-08-23 15:06:54 +02:00
a41e9804a0 Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-07-31 13:18:07 +02:00
25c685c705 Merged with simplifyRes and cleaned up code 2019-07-31 13:16:14 +02:00
3ecb202a90 Generic generator algorithm v1 2019-07-31 11:55:24 +02:00
efdb58e67c Added throw Exception to method getSimplifyResultsByName 2019-07-31 10:33:43 +02:00
eed8f32cb7 Merge branch 'simplifyRes' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into simplifyRes 2019-07-31 10:27:43 +02:00
87d0a46ba5 Generic generator algorithm v0.1 2019-07-31 10:24:58 +02:00
5b75250fcf Merge branch 'bigRefactoring' into simplifyRes
# Conflicts:
#	src/main/java/de/dhbwstuttgart/bytecode/utilities/SimplifyResult.java
#	src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
2019-07-29 16:21:25 +02:00
7f29b39195 Generic Method inserts. 2019-07-26 10:12:53 +02:00
7a4bc32974 Generic generator algorithm v0.1 2019-07-25 22:24:06 +02:00
dfddc44f29 Separated the algorithm into two parts. Part 1 is the simplification of
the constraints and part 2 is generation of generics.
2019-07-12 19:50:46 +02:00
347d86a379 Genericsgenerator step 2 and 3 2019-07-11 15:52:38 +02:00
d77f2176f2 Generics generator step 1 2019-07-10 15:26:16 +02:00
4f39eccecb Removed an old getter method 2019-07-05 13:45:24 +02:00
669e7f111f Separated the generation of bytecode and the calculation of simplify
results from each other
2019-07-05 13:29:34 +02:00
32d12677bf Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-06-28 11:41:47 +02:00
92b2f5c9cc modified: src/test/resources/bytecode/javFiles/Faculty.jav
} eingefuegt
2019-06-28 11:41:19 +02:00
c1e6526b43 Removed unnecessary tests 2019-06-26 12:18:49 +02:00
0194e30206 Fixed Bug 150. 2019-06-26 12:16:47 +02:00
3c36c61077 Fixed Bugs 159, 162 and 163 2019-06-13 14:01:32 +02:00
857d63322e Fixed Bug 152 Faculty Probleme 2019-06-07 10:28:48 +02:00
b801e144c3 Merged with bigRefactoring. Added method to generate signature to
FunN-Interfaces. Adapted jav-Files.
2019-06-06 12:15:51 +02:00
f6669f8c13 new file: ../../../java/bytecode/VectorAddTest.java 2019-06-05 10:28:51 +02:00
2b7aef5e87 modified: ../../../../main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Pfad fuer logFile nach JavaCompilerCore/logFiles verlegt.

	modified:   ../../bytecode/javFiles/OL.jav
	modified:   ../../bytecode/javFiles/VectorAdd.jav
2019-06-05 10:21:25 +02:00
0233426979 Merge remote-tracking branch 'origin/bigRefactoring' into bigRefactoring 2019-05-14 21:54:41 +02:00
3d0d11adb7 Code aufgeräumt. 2019-05-14 21:43:32 +02:00
212144db86 renamed: test/java/bytecode/FunOLTest.java -> test/java/bytecode/OLFunTest.java
new file:   test/resources/bytecode/javFiles/OLFun.jav
2019-05-14 20:30:32 +02:00
bd0517ae29 modified: src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
log-File in anderen Pfad

	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/model/UnifyPair.java
substitutions gekapselt
2019-05-14 19:54:51 +02:00
f210dd3c25 modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
try der Nullpointer-Exception erweitert.
2019-05-13 11:11:47 +02:00
4602e95f09 modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java 2019-05-12 20:00:03 +02:00
1ef228a045 modified: ../../../main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
public volatile UnifyTaskModel usedTasks = new UnifyTaskModel();
auf publich gesetzt
2019-05-12 19:54:30 +02:00
c3c0a11572 Debugabfrage entfernt, die Exception ausgeloest hat
modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyTaskModel.java
Methoden synchronized gemacht
2019-05-12 19:15:26 +02:00
d14406e474 modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
modified:   ../../resources/bytecode/javFiles/MatrixOP.jav
2019-05-10 21:23:28 +02:00
a149b0c391 modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java
modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
	modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/UnifyTaskModel.java

Eigenen Cancel-Mechanismus implementiert
2019-05-10 21:02:24 +02:00
bfbce81409 Abbruch aller Threads eingebaut
modified:   src/main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnify2Task.java
	modified:   src/main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
	new file:   src/main/java/de/dhbwstuttgart/typeinference/unify/UnifyTaskModel.java
2019-05-10 16:30:55 +02:00
985704c0b0 modified: src/main/java/de/dhbwstuttgart/typeinference/typeAlgo/TYPEStmt.java
Wen kein Import für die Addition vorhanden ist, wird Fehler ausgegeben
2019-05-08 08:58:19 +02:00
1f20fecfee ResultPair durchgeschleift. 2019-05-07 10:38:25 +02:00
4b8b0ec362 ConcurrentModificationException umgangen. 2019-05-05 22:33:16 +02:00
e48f2b2fd5 Merge remote-tracking branch 'origin/bigRefactoring' into bigRefactoring
# Conflicts:
#	src/main/java/de/dhbwstuttgart/bytecode/BytecodeGen.java
2019-04-27 16:33:20 +02:00
11bee80969 Bytecode-Generierung generiert jetzt wieder Bytecode für alle möglichen Typen. 2019-04-27 16:29:38 +02:00
448c489a49 modified: src/main/java/de/dhbwstuttgart/typeinference/result/ResultSet.java
modified:   src/test/resources/bytecode/javFiles/Lambda.jav
	modified:   src/test/resources/bytecode/javFiles/MatrixOP.jav
	modified:   src/test/resources/bytecode/javFiles/OL.jav
2019-04-27 15:44:21 +02:00
1e1eb2a2f2 geändert: src/main/java/de/dhbwstuttgart/typeinference/result/ResultSet.java 2019-04-27 14:51:25 +02:00
4a7c124fd6 Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bigRefactoring 2019-04-27 09:51:22 +02:00
7d01c866a9 modified: ../src/test/resources/bytecode/javFiles/Id.jav
modified:   ../src/test/resources/bytecode/javFiles/Matrix.jav
	modified:   ../src/test/resources/bytecode/javFiles/MatrixOP.jav
	modified:   ../src/test/resources/bytecode/javFiles/OL.jav
2019-04-26 14:12:46 +02:00
73f412d22d Klassendatei fuer FunN beim Methodaufruf wird erzeugt, wenn der Receiver
den Typ FunN besitzt.
Die Loesung vom Duplicate Field Problem wird angepasst.
2019-04-26 11:56:58 +02:00
9ffc74467b Wenn ein Attribut mehrere Loesungen bekommt, wird die Bytecodeerzeugung
abgebrochen und ensprechende Exception geworfen.
2019-04-26 10:27:15 +02:00
5950fcc0a9 Neue Klasse MethodCallHelper und Exceptions definiert, die fuer die
Uebersetzung von MethodCalls verwendet werden
2019-04-24 15:43:00 +02:00
d2fb17ad4e Merge branch 'bcGenerics' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bcGenerics 2019-04-21 22:32:20 +02:00
d9f084cd0f modified: ../../bytecode/javFiles/Faculty.jav
neue Imports hinzugefuegt
2019-04-21 22:31:55 +02:00
481986e8ab Kein Compileraufruf bei Type-Insert
- ResultPairMap wird wieder geleeert.
2019-04-20 17:22:10 +02:00
23c37a8cc2 Richtiges Einsetzen ohne Speichern. 2019-04-19 20:49:28 +02:00
6a519ff6dc Ein Feld wird nur einmal in Bytecode uebersetzt. genIns in ResultSet
wird angepasst.
2019-04-18 13:17:50 +02:00
5b527ec8ab Merge branch 'bcGenerics' of ssh://abualia@gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bcGenerics 2019-04-18 10:50:02 +02:00
709041f024 Adapted TypedID jav-file 2019-04-18 10:48:59 +02:00
905d9e25a2 [PLUGIN]: Filter type insert points after insertion. 2019-04-18 09:48:56 +02:00
e086ff187e modified: ../../../../main/java/de/dhbwstuttgart/typeinference/result/ResolvedType.java
Attribut additionalGenerics auskommentiert.
2019-04-12 10:41:42 +02:00
588212389a Die Bestimmung der Constraints aus dem ResolvedType herausgenommen und im ResultSet integriert.
Damit kommen immer die gleichen Constraints raus. Diese werden ohnehin in der Bytecodegenerierung
nochmals ausgewertet.

	modified:   ../../../../main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java
Zugriff auf Constraints ueber ResultSet eingefuehrt

	modified:   ../../../../main/java/de/dhbwstuttgart/bytecode/signature/Signature.java
Zugriff auf Constraints ueber ResultSet eingefuehrt

	modified:   ../../../../main/java/de/dhbwstuttgart/core/JavaTXCompiler.java
	modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/result/GenericInsertPair.java
	modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/result/PairTPHequalRefTypeOrWildcardType.java
	modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/result/PairTPHsmallerTPH.java
toString veraendert

	modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/result/ResultSet.java
Attribut genIns eingefuehrt, indem alle GenericInsertPairs gespeichert werden, die Form (TPH a <. TPH b)
im Attribut results haben

	modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
	modified:   ../../bytecode/javFiles/Id.jav
	modified:   ../../bytecode/javFiles/MatrixOP.jav
2019-04-12 10:28:39 +02:00
1454281628 Merge branch 'bigRefactoring' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bcGenerics 2019-04-11 11:57:30 +02:00
602216d9e2 Generics beruecksichtigt 2019-04-11 11:26:54 +02:00
e53c29f582 modified: ../../../main/java/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Typeinference-Exception eingefuegt, wenn kein korrekter Typ inferierbar ist.

	modified:   ../../resources/bytecode/javFiles/Id.jav
2019-04-06 00:53:35 +02:00
656c77d16b Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bigRefactoring 2019-04-05 12:52:28 +02:00
9d16855ce2 Bug in Matrix gefixt 2019-04-05 12:38:29 +02:00
9d2fdf9692 Merge branch 'bytecode2' of ssh://abualia@gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-04-05 12:06:22 +02:00
5c5b1ea2b1 IdTest funktioniert 2019-04-05 12:05:07 +02:00
2e2227b701 Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-04-05 12:00:30 +02:00
16baa5eaa8 modified: ../../../../main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java
modified:   ../../../../main/java/de/dhbwstuttgart/typeinference/unify/model/ReferenceType.java

Konstruktur fuer ReferenceType mit zwei Argumenten versehen, um Generice unterscheiden zu können.
2019-04-05 11:59:34 +02:00
588b9ef83a Merge branch 'bytecode2' of ssh://abualia@gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-04-05 10:44:52 +02:00
ee932892c6 subString durch contains ersetzt 2019-04-05 10:43:09 +02:00
547ad9601a Merge branch 'bytecode2' of ssh://gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-04-04 14:08:31 +02:00
6c94404f27 [MINOR]: Optimized imports. 2019-03-31 11:45:49 +02:00
2b5b677682 Für Eclipse-Plugin: Vorläufige Lösung zum Einsetzen von Generics nur an Klassen ausgeschaltet. 2019-03-31 11:39:57 +02:00
1edc023ed9 modified: ../../../main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java
modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/model/ReferenceType.java
Generische Typvariablen im Unify durch Tag im ReferenceType eingefuehrt
2019-03-28 17:44:42 +01:00
df0f26c021 :w:wq 2019-03-28 16:55:48 +01:00
53d1f20a40 Merge remote-tracking branch 'origin/bytecode2' into bytecode2 2019-03-28 14:56:47 +01:00
ec4defd087 Getter and setter for token. 2019-03-28 14:56:36 +01:00
6a2a8313e6 Generics werden in Signature richtig dargestellt und die passende
Deskriptoren werden richtig erzeugt
2019-03-28 14:07:04 +01:00
d4a59517d3 Wenn die Klasse keine Generics besitzt und Methoden besitzen Generics
wird eine new SimplifyResult Instanz erzeugt, da sonst eine
NullException aufgelöst wird
2019-03-21 12:23:50 +01:00
f4b5124fd3 Merge branch 'bytecode2' of ssh://abualia@gohorb.ba-horb.de/bahome/projekt/git/JavaCompilerCore into bytecode2 2019-03-21 12:06:01 +01:00
c921330b55 Methode getSimplifyList definiert, die eine Liste von Ergebnisse des
Simplify-Alg zurueckliefert
2019-03-21 12:03:13 +01:00
141 changed files with 26494 additions and 24021 deletions
PlugInBau.txt
doc/OldStuff
pom.xml
src
main
java
de
dhbwstuttgart
bytecode
core
parser
SyntaxTreeGenerator
syntaxtree
typedeployment
typeinference
test

22
PlugInBau.txt Normal file

@ -0,0 +1,22 @@
Repositories: Branches: JavaCompilerCore: simplyRes
JavaCompilerPlugin: copy_libs
JavaCompilerCore > mvn install -Dskip.test=true
[INFO] Installing /Users/pl/workspace_oxygen/JavaCompilerCore/target/JavaTXcompiler-0.2.jar to /Users/pl/.m2/repository/de/dhbwstuttgart/JavaTXcompiler/0.2/JavaTXcompiler-0.2.jar
[INFO] Installing /Users/pl/workspace_oxygen/JavaCompilerCore/pom.xml to /Users/pl/.m2/repository/de/dhbwstuttgart/JavaTXcompiler/0.2/JavaTXcompiler-0.2.pom
[INFO] Installing /Users/pl/workspace_oxygen/JavaCompilerCore/target/JavaTXcompiler-0.2-jar-with-dependencies.jar to /Users/pl/.m2/repository/de/dhbwstuttgart/JavaTXcompiler/0.2/JavaTXcompiler-0.2-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 23.279 s
[INFO] Finished at: 2019-09-17T09:31:30+02:00
[INFO] -------------------------------------
JavaCompilerCore > cd target
JavaCompilerCore/target > cp JavaTXcompiler-0.2.jar ../../Plugin_JCC/JavaCompilerPlugin/bundles/JavaCompilerPlugin.Plugin/lib/JavaTXcompiler.jar
Im Eclipse: Plugin_JCC/JavaCompilerPlugin> mvn install
Plugin_JCC/JavaCompilerPlugin/releng/JavaCompilerPlugin.Update/target > cp JavaCompilerPlugin.Update-0.1.0-SNAPSHOT.zip ~/webdav/public_html/javatx/javatx_XXXXXX.zip

File diff suppressed because one or more lines are too long

@ -1,29 +1,29 @@
/* Javadoc style sheet */
/* Define colors, fonts and other style attributes here to override the defaults */
/* Page background color */
body { background-color: #FFFFFF }
/* Table colors */
.TableHeadingColor { background: #CCCCFF } /* Dark mauve */
.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */
.TableRowColor { background: #FFFFFF } /* White */
/* Font used in left-hand frame lists */
.FrameTitleFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
.FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
.FrameItemFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
/* Example of smaller, sans-serif font in frames */
/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
/* Navigation bar fonts and colors */
.NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */
.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */
.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
/* Javadoc style sheet */
/* Define colors, fonts and other style attributes here to override the defaults */
/* Page background color */
body { background-color: #FFFFFF }
/* Table colors */
.TableHeadingColor { background: #CCCCFF } /* Dark mauve */
.TableSubHeadingColor { background: #EEEEFF } /* Light mauve */
.TableRowColor { background: #FFFFFF } /* White */
/* Font used in left-hand frame lists */
.FrameTitleFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
.FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
.FrameItemFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
/* Example of smaller, sans-serif font in frames */
/* .FrameItemFont { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
/* Navigation bar fonts and colors */
.NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */
.NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */
.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;}
.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}

@ -1,220 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<editmodel:ClassDiagramEditModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:editmodel="editmodel.xmi" id="kirschmshsCompiler0" metadata="nsuml-1.4" initialized="true" showWireOptions="1">
<children xsi:type="editmodel:ClassEditModel" location="448,178" size="371,67" targetConnections="//@children.11/@sourceConnections.0" id="kirschmshsCompiler761" runTimeClassModel="kirschmshsCompiler860">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="348,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler860"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.14/@sourceConnections.0 //@children.15/@sourceConnections.0 //@children.9/@sourceConnections.0" id="kirschmshsCompiler762" connectionRouterKind="GeneralizationManhattan" source="//@children.0" target="//@children.16" targetEnd="//@children.0/@sourceConnections.0/@children.1" sourceEnd="//@children.0/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="185,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="201,67" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="914,555" size="403,85" id="kirschmshsCompiler873" runTimeClassModel="kirschmshsCompiler881;kirschmshsCompiler874">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler874"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler881"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.1" target="//@children.11/@sourceConnections.0" targetEnd="//@children.1/@sourceConnections.0/@children.1" sourceEnd="//@children.1/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="484,554" size="403,85" id="kirschmshsCompiler985" runTimeClassModel="kirschmshsCompiler993;kirschmshsCompiler986">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler986"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler993"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.2" target="//@children.11/@sourceConnections.0" targetEnd="//@children.2/@sourceConnections.0/@children.1" sourceEnd="//@children.2/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1345,559" size="403,85" id="kirschmshsCompiler1012" runTimeClassModel="kirschmshsCompiler1013;kirschmshsCompiler1020">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler1013"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler1020"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.3" target="//@children.11/@sourceConnections.0" targetEnd="//@children.3/@sourceConnections.0/@children.1" sourceEnd="//@children.3/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="3194,502" size="403,67" id="kirschmshsCompiler670" runTimeClassModel="kirschmshsCompiler671">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler671"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.4" target="//@children.13/@sourceConnections.0" targetEnd="//@children.4/@sourceConnections.0/@children.1" sourceEnd="//@children.4/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1365,425" size="76,29" id="kirschmshsCompiler765" runTimeClassModel="">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" id="kirschmshsCompiler766" connectionRouterKind="Manual" source="//@children.5" target="//@children.6/@sourceConnections.0" targetEnd="//@children.5/@sourceConnections.0/@children.1" sourceEnd="//@children.5/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="38,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="963,417" size="86,29" id="kirschmshsCompiler783" runTimeClassModel="">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.5/@sourceConnections.0" id="kirschmshsCompiler784" connectionRouterKind="GeneralizationManhattan" source="//@children.6" target="//@children.15" targetEnd="//@children.6/@sourceConnections.0/@children.1" sourceEnd="//@children.6/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="43,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="272,139" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2069,372" size="403,67" id="kirschmshsCompiler841" runTimeClassModel="kirschmshsCompiler842">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler842"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.7" target="//@children.12/@sourceConnections.0" targetEnd="//@children.7/@sourceConnections.0/@children.1" sourceEnd="//@children.7/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2227,562" size="403,85" id="kirschmshsCompiler904" runTimeClassModel="kirschmshsCompiler905;kirschmshsCompiler912">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler905"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler912"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.8" target="//@children.11/@sourceConnections.0" targetEnd="//@children.8/@sourceConnections.0/@children.1" sourceEnd="//@children.8/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2965,229" size="403,67" targetConnections="//@children.13/@sourceConnections.0" id="kirschmshsCompiler653" runTimeClassModel="kirschmshsCompiler654">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler654"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.9" target="//@children.0/@sourceConnections.0" targetEnd="//@children.9/@sourceConnections.0/@children.1" sourceEnd="//@children.9/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2502,372" size="403,67" id="kirschmshsCompiler822" runTimeClassModel="kirschmshsCompiler823">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler823"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.10" target="//@children.12/@sourceConnections.0" targetEnd="//@children.10/@sourceConnections.0/@children.1" sourceEnd="//@children.10/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="45,553" size="403,85" id="kirschmshsCompiler931" runTimeClassModel="kirschmshsCompiler939;kirschmshsCompiler932">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler932"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler939"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.2/@sourceConnections.0 //@children.1/@sourceConnections.0 //@children.3/@sourceConnections.0 //@children.17/@sourceConnections.0 //@children.8/@sourceConnections.0" connectionRouterKind="GeneralizationManhattan" source="//@children.11" target="//@children.0" targetEnd="//@children.11/@sourceConnections.0/@children.1" sourceEnd="//@children.11/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="185,67" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1636,372" size="403,67" id="kirschmshsCompiler803" runTimeClassModel="kirschmshsCompiler804">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler804"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.7/@sourceConnections.0 //@children.10/@sourceConnections.0" connectionRouterKind="GeneralizationManhattan" source="//@children.12" target="//@children.14" targetEnd="//@children.12/@sourceConnections.0/@children.1" sourceEnd="//@children.12/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="42,29" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2715,508" size="403,67" id="kirschmshsCompiler692" runTimeClassModel="kirschmshsCompiler693">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler693"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.4/@sourceConnections.0" connectionRouterKind="GeneralizationManhattan" source="//@children.13" target="//@children.9" targetEnd="//@children.13/@sourceConnections.0/@children.1" sourceEnd="//@children.13/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="201,67" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2223,234" size="84,29" targetConnections="//@children.12/@sourceConnections.0" id="kirschmshsCompiler801" runTimeClassModel="">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.14" target="//@children.0/@sourceConnections.0" targetEnd="//@children.14/@sourceConnections.0/@children.1" sourceEnd="//@children.14/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="42,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="940,191" size="545,139" targetConnections="//@children.6/@sourceConnections.0" id="kirschmshsCompiler711" runTimeClassModel="kirschmshsCompiler719;kirschmshsCompiler729;kirschmshsCompiler737;kirschmshsCompiler747;kirschmshsCompiler712">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="522,90">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler712"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler719"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler729"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler747"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler737"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.15" target="//@children.0/@sourceConnections.0" targetEnd="//@children.15/@sourceConnections.0/@children.1" sourceEnd="//@children.15/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="272,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1023,50" size="403,67" targetConnections="//@children.0/@sourceConnections.0" id="kirschmshsCompiler635" runTimeClassModel="kirschmshsCompiler636">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler636"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1791,561" size="403,85" id="kirschmshsCompiler958" runTimeClassModel="kirschmshsCompiler959;kirschmshsCompiler966">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler959"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler966"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.17" target="//@children.11/@sourceConnections.0" targetEnd="//@children.17/@sourceConnections.0/@children.1" sourceEnd="//@children.17/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<classDiagramPreferences xsi:type="editmodel:UMLClassDiagramPreference" attributeSorter="Natural" methodSorter="Natural" innerClassSorter="Natural" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true" showInterfaceStereotype="true" showClassStereotype="true" showPackageStereotype="true"/>
</editmodel:ClassDiagramEditModel>
<?xml version="1.0" encoding="UTF-8"?>
<editmodel:ClassDiagramEditModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:editmodel="editmodel.xmi" id="kirschmshsCompiler0" metadata="nsuml-1.4" initialized="true" showWireOptions="1">
<children xsi:type="editmodel:ClassEditModel" location="448,178" size="371,67" targetConnections="//@children.11/@sourceConnections.0" id="kirschmshsCompiler761" runTimeClassModel="kirschmshsCompiler860">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="348,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler860"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.14/@sourceConnections.0 //@children.15/@sourceConnections.0 //@children.9/@sourceConnections.0" id="kirschmshsCompiler762" connectionRouterKind="GeneralizationManhattan" source="//@children.0" target="//@children.16" targetEnd="//@children.0/@sourceConnections.0/@children.1" sourceEnd="//@children.0/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="185,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="201,67" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="914,555" size="403,85" id="kirschmshsCompiler873" runTimeClassModel="kirschmshsCompiler881;kirschmshsCompiler874">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler874"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler881"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.1" target="//@children.11/@sourceConnections.0" targetEnd="//@children.1/@sourceConnections.0/@children.1" sourceEnd="//@children.1/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="484,554" size="403,85" id="kirschmshsCompiler985" runTimeClassModel="kirschmshsCompiler993;kirschmshsCompiler986">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler986"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler993"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.2" target="//@children.11/@sourceConnections.0" targetEnd="//@children.2/@sourceConnections.0/@children.1" sourceEnd="//@children.2/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1345,559" size="403,85" id="kirschmshsCompiler1012" runTimeClassModel="kirschmshsCompiler1013;kirschmshsCompiler1020">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler1013"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler1020"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.3" target="//@children.11/@sourceConnections.0" targetEnd="//@children.3/@sourceConnections.0/@children.1" sourceEnd="//@children.3/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="3194,502" size="403,67" id="kirschmshsCompiler670" runTimeClassModel="kirschmshsCompiler671">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler671"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.4" target="//@children.13/@sourceConnections.0" targetEnd="//@children.4/@sourceConnections.0/@children.1" sourceEnd="//@children.4/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1365,425" size="76,29" id="kirschmshsCompiler765" runTimeClassModel="">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" id="kirschmshsCompiler766" connectionRouterKind="Manual" source="//@children.5" target="//@children.6/@sourceConnections.0" targetEnd="//@children.5/@sourceConnections.0/@children.1" sourceEnd="//@children.5/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="38,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="963,417" size="86,29" id="kirschmshsCompiler783" runTimeClassModel="">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.5/@sourceConnections.0" id="kirschmshsCompiler784" connectionRouterKind="GeneralizationManhattan" source="//@children.6" target="//@children.15" targetEnd="//@children.6/@sourceConnections.0/@children.1" sourceEnd="//@children.6/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="43,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="272,139" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2069,372" size="403,67" id="kirschmshsCompiler841" runTimeClassModel="kirschmshsCompiler842">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler842"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.7" target="//@children.12/@sourceConnections.0" targetEnd="//@children.7/@sourceConnections.0/@children.1" sourceEnd="//@children.7/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2227,562" size="403,85" id="kirschmshsCompiler904" runTimeClassModel="kirschmshsCompiler905;kirschmshsCompiler912">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler905"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler912"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.8" target="//@children.11/@sourceConnections.0" targetEnd="//@children.8/@sourceConnections.0/@children.1" sourceEnd="//@children.8/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2965,229" size="403,67" targetConnections="//@children.13/@sourceConnections.0" id="kirschmshsCompiler653" runTimeClassModel="kirschmshsCompiler654">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler654"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.9" target="//@children.0/@sourceConnections.0" targetEnd="//@children.9/@sourceConnections.0/@children.1" sourceEnd="//@children.9/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2502,372" size="403,67" id="kirschmshsCompiler822" runTimeClassModel="kirschmshsCompiler823">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler823"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.10" target="//@children.12/@sourceConnections.0" targetEnd="//@children.10/@sourceConnections.0/@children.1" sourceEnd="//@children.10/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="45,553" size="403,85" id="kirschmshsCompiler931" runTimeClassModel="kirschmshsCompiler939;kirschmshsCompiler932">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler932"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler939"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.2/@sourceConnections.0 //@children.1/@sourceConnections.0 //@children.3/@sourceConnections.0 //@children.17/@sourceConnections.0 //@children.8/@sourceConnections.0" connectionRouterKind="GeneralizationManhattan" source="//@children.11" target="//@children.0" targetEnd="//@children.11/@sourceConnections.0/@children.1" sourceEnd="//@children.11/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="185,67" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1636,372" size="403,67" id="kirschmshsCompiler803" runTimeClassModel="kirschmshsCompiler804">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler804"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.7/@sourceConnections.0 //@children.10/@sourceConnections.0" connectionRouterKind="GeneralizationManhattan" source="//@children.12" target="//@children.14" targetEnd="//@children.12/@sourceConnections.0/@children.1" sourceEnd="//@children.12/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="42,29" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2715,508" size="403,67" id="kirschmshsCompiler692" runTimeClassModel="kirschmshsCompiler693">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler693"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" targetConnections="//@children.4/@sourceConnections.0" connectionRouterKind="GeneralizationManhattan" source="//@children.13" target="//@children.9" targetEnd="//@children.13/@sourceConnections.0/@children.1" sourceEnd="//@children.13/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel" location="201,67" anchorKind="FixedAtEdge"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="2223,234" size="84,29" targetConnections="//@children.12/@sourceConnections.0" id="kirschmshsCompiler801" runTimeClassModel="">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.14" target="//@children.0/@sourceConnections.0" targetEnd="//@children.14/@sourceConnections.0/@children.1" sourceEnd="//@children.14/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="42,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="940,191" size="545,139" targetConnections="//@children.6/@sourceConnections.0" id="kirschmshsCompiler711" runTimeClassModel="kirschmshsCompiler719;kirschmshsCompiler729;kirschmshsCompiler737;kirschmshsCompiler747;kirschmshsCompiler712">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="522,90">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler712"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler719"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler729"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler747"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler737"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.15" target="//@children.0/@sourceConnections.0" targetEnd="//@children.15/@sourceConnections.0/@children.1" sourceEnd="//@children.15/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="272,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1023,50" size="403,67" targetConnections="//@children.0/@sourceConnections.0" id="kirschmshsCompiler635" runTimeClassModel="kirschmshsCompiler636">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,18">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler636"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<children xsi:type="editmodel:ClassEditModel" location="1791,561" size="403,85" id="kirschmshsCompiler958" runTimeClassModel="kirschmshsCompiler959;kirschmshsCompiler966">
<children xsi:type="editmodel:CompartmentEditModel"/>
<children xsi:type="editmodel:CompartmentEditModel" size="380,36">
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler959"/>
<children xsi:type="editmodel:MethodEditModel" id="kirschmshsCompiler966"/>
</children>
<children xsi:type="editmodel:CompartmentEditModel"/>
<sourceConnections xsi:type="editmodel:GeneralizationEditModel" connectionRouterKind="Manual" source="//@children.17" target="//@children.11/@sourceConnections.0" targetEnd="//@children.17/@sourceConnections.0/@children.1" sourceEnd="//@children.17/@sourceConnections.0/@children.0">
<children xsi:type="editmodel:AssociationEndEditModel" location="201,0" anchorKind="FixedAtEdge" attachSource="true"/>
<children xsi:type="editmodel:AssociationEndEditModel"/>
</sourceConnections>
<classifierPreferences xsi:type="editmodel:UMLClassDiagramClassifierPreference" showStereotype="true" showMethodsParameterTypes="true" showMethodsReturnType="true" attributeSorter="Visibility" methodSorter="Visibility" innerClassSorter="Visibility" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true"/>
</children>
<classDiagramPreferences xsi:type="editmodel:UMLClassDiagramPreference" attributeSorter="Natural" methodSorter="Natural" innerClassSorter="Natural" showPublicAttributes="true" showPackageAttributes="true" showPublicMethods="true" showPackageMethods="true" showPublicInnerClasses="true" showPackageInnerClasses="true" showInterfaceStereotype="true" showClassStereotype="true" showPackageStereotype="true"/>
</editmodel:ClassDiagramEditModel>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Before

(image error) Size: 669 KiB

After

(image error) Size: 663 KiB

@ -1,458 +1,458 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; text-rendering:auto; stroke:black; stroke-linecap:square; stroke-miterlimit:10; shape-rendering:auto; stroke-opacity:1; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:&apos;sansserif&apos;; font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">
<!--Generated by the Batik Graphics2D SVG Generator-->
<defs id="genericDefs" />
<g>
<g style="fill:white; font-family:&apos;Arial&apos;; font-weight:bold; stroke:white;">
<rect x="-45" y="-50" width="3602" style="stroke:none;" height="652" />
<rect x="406" y="131" width="368" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="405" y="130" width="368" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="404" y="129" width="368" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="403" y="128" width="368" style="stroke:none;" height="64" />
<rect x="403" y="128" width="367" style="fill:none; stroke:black;" height="63" />
<line x1="403" x2="770" y1="154" style="fill:none; stroke:black;" y2="154" />
<line x1="403" x2="770" y1="164" style="fill:none; stroke:black;" y2="164" />
<rect x="413" y="169" width="348" style="stroke:none; font-weight:normal;" height="16" />
<image x="413" y="169" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAiklEQVR42rVRgQ2A
IAwDwiF+4k7hE/WTnbJP3CdYoyEoqJjoQsiAdrSbjTGap7CTjcMOcy3ofu6xtxIQ
wpLyJkIerkUPBUqqfAmikXYlo+R66gSgA3XpiMKn3OZtPaEDcfm/vzHAElSNiP7W
JZR/IKAtzArcttabo56KBzzDeHXGl6ZL0ItJf0BYALD3PkMWvNRAAAAAAElFTkSu
QmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="432" y="182" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="557" y="133" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="576" y="145" style="fill:black; stroke:none;" xml:space="preserve">RelOp</text>
<rect x="872" y="508" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="871" y="507" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="870" y="506" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="869" y="505" width="400" style="stroke:none;" height="82" />
<rect x="869" y="505" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="869" x2="1268" y1="531" style="fill:none; stroke:black;" y2="531" />
<line x1="869" x2="1268" y1="541" style="fill:none; stroke:black;" y2="541" />
<rect x="879" y="546" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="879" y="546" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="898" y="559" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="879" y="564" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="879" y="564" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="898" y="577" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="1032" y="510" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1051" y="522" style="fill:black; stroke:none;" xml:space="preserve">EqualOp</text>
<rect x="442" y="507" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="441" y="506" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="440" y="505" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="439" y="504" width="400" style="stroke:none;" height="82" />
<rect x="439" y="504" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="439" x2="838" y1="530" style="fill:none; stroke:black;" y2="530" />
<line x1="439" x2="838" y1="540" style="fill:none; stroke:black;" y2="540" />
<rect x="449" y="545" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="449" y="545" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="468" y="558" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="449" y="563" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="449" y="563" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="468" y="576" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="606" y="509" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="625" y="521" style="fill:black; stroke:none;" xml:space="preserve">LessOp</text>
<rect x="1303" y="512" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="1302" y="511" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="1301" y="510" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="1300" y="509" width="400" style="stroke:none;" height="82" />
<rect x="1300" y="509" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="1300" x2="1699" y1="535" style="fill:none; stroke:black;" y2="535" />
<line x1="1300" x2="1699" y1="545" style="fill:none; stroke:black;" y2="545" />
<rect x="1310" y="550" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1310" y="550" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1329" y="563" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="1310" y="568" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1310" y="568" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1329" y="581" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="1452" y="514" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1471" y="526" style="fill:black; stroke:none;" xml:space="preserve">NotEqualOp</text>
<rect x="3152" y="455" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="3151" y="454" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="3150" y="453" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="3149" y="452" width="400" style="stroke:none;" height="64" />
<rect x="3149" y="452" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="3149" x2="3548" y1="478" style="fill:none; stroke:black;" y2="478" />
<line x1="3149" x2="3548" y1="488" style="fill:none; stroke:black;" y2="488" />
<rect x="3159" y="493" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="3159" y="493" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="3178" y="506" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="3311" y="457" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="3330" y="469" style="fill:black; stroke:none;" xml:space="preserve">MinusOp</text>
<rect x="1323" y="378" width="73" style="fill:rgb(191,191,191); stroke:none;" height="26" />
<rect x="1322" y="377" width="73" style="fill:rgb(127,127,127); stroke:none;" height="26" />
<rect x="1321" y="376" width="73" style="fill:rgb(63,63,63); stroke:none;" height="26" />
<rect x="1320" y="375" width="73" style="stroke:none;" height="26" />
<rect x="1320" y="375" width="72" style="fill:none; stroke:black;" height="25" />
<image x="1330" y="380" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1349" y="392" style="fill:black; stroke:none;" xml:space="preserve">OrOp</text>
<rect x="921" y="370" width="83" style="fill:rgb(191,191,191); stroke:none;" height="26" />
<rect x="920" y="369" width="83" style="fill:rgb(127,127,127); stroke:none;" height="26" />
<rect x="919" y="368" width="83" style="fill:rgb(63,63,63); stroke:none;" height="26" />
<rect x="918" y="367" width="83" style="stroke:none;" height="26" />
<rect x="918" y="367" width="82" style="fill:none; stroke:black;" height="25" />
<image x="928" y="372" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="947" y="384" style="fill:black; stroke:none;" xml:space="preserve">AndOp</text>
<rect x="2027" y="325" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2026" y="324" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2025" y="323" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2024" y="322" width="400" style="stroke:none;" height="64" />
<rect x="2024" y="322" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2024" x2="2423" y1="348" style="fill:none; stroke:black;" y2="348" />
<line x1="2024" x2="2423" y1="358" style="fill:none; stroke:black;" y2="358" />
<rect x="2034" y="363" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2034" y="363" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2053" y="376" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="2186" y="327" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2205" y="339" style="fill:black; stroke:none;" xml:space="preserve">TimesOp</text>
<rect x="2185" y="515" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="2184" y="514" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="2183" y="513" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="2182" y="512" width="400" style="stroke:none;" height="82" />
<rect x="2182" y="512" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="2182" x2="2581" y1="538" style="fill:none; stroke:black;" y2="538" />
<line x1="2182" x2="2581" y1="548" style="fill:none; stroke:black;" y2="548" />
<rect x="2192" y="553" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2192" y="553" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2211" y="566" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="2192" y="571" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2192" y="571" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2211" y="584" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="2327" y="517" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2346" y="529" style="fill:black; stroke:none;" xml:space="preserve">GreaterEquOp</text>
<rect x="2923" y="182" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2922" y="181" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2921" y="180" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2920" y="179" width="400" style="stroke:none;" height="64" />
<rect x="2920" y="179" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2920" x2="3319" y1="205" style="fill:none; stroke:black;" y2="205" />
<line x1="2920" x2="3319" y1="215" style="fill:none; stroke:black;" y2="215" />
<rect x="2930" y="220" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2930" y="220" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAiklEQVR42rVRgQ2A
IAwDwiF+4k7hE/WTnbJP3CdYoyEoqJjoQsiAdrSbjTGap7CTjcMOcy3ofu6xtxIQ
wpLyJkIerkUPBUqqfAmikXYlo+R66gSgA3XpiMKn3OZtPaEDcfm/vzHAElSNiP7W
JZR/IKAtzArcttabo56KBzzDeHXGl6ZL0ItJf0BYALD3PkMWvNRAAAAAAElFTkSu
QmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2949" y="233" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="3088" y="184" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="3107" y="196" style="fill:black; stroke:none;" xml:space="preserve">AddOp</text>
<rect x="2460" y="325" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2459" y="324" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2458" y="323" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2457" y="322" width="400" style="stroke:none;" height="64" />
<rect x="2457" y="322" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2457" x2="2856" y1="348" style="fill:none; stroke:black;" y2="348" />
<line x1="2457" x2="2856" y1="358" style="fill:none; stroke:black;" y2="358" />
<rect x="2467" y="363" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2467" y="363" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2486" y="376" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="2614" y="327" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2633" y="339" style="fill:black; stroke:none;" xml:space="preserve">ModuloOp</text>
<rect x="3" y="506" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="2" y="505" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="1" y="504" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="0" y="503" width="400" style="stroke:none;" height="82" />
<rect x="0" y="503" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="0" x2="399" y1="529" style="fill:none; stroke:black;" y2="529" />
<line x1="0" x2="399" y1="539" style="fill:none; stroke:black;" y2="539" />
<rect x="10" y="544" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="10" y="544" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="29" y="557" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="10" y="562" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="10" y="562" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="29" y="575" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="157" y="508" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="176" y="520" style="fill:black; stroke:none;" xml:space="preserve">GreaterOp</text>
<rect x="1594" y="325" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="1593" y="324" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="1592" y="323" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="1591" y="322" width="400" style="stroke:none;" height="64" />
<rect x="1591" y="322" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="1591" x2="1990" y1="348" style="fill:none; stroke:black;" y2="348" />
<line x1="1591" x2="1990" y1="358" style="fill:none; stroke:black;" y2="358" />
<rect x="1601" y="363" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1601" y="363" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1620" y="376" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="1752" y="327" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1771" y="339" style="fill:black; stroke:none;" xml:space="preserve">DivideOp</text>
<rect x="2673" y="461" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2672" y="460" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2671" y="459" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2670" y="458" width="400" style="stroke:none;" height="64" />
<rect x="2670" y="458" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2670" x2="3069" y1="484" style="fill:none; stroke:black;" y2="484" />
<line x1="2670" x2="3069" y1="494" style="fill:none; stroke:black;" y2="494" />
<rect x="2680" y="499" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2680" y="499" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2699" y="512" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="2837" y="463" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2856" y="475" style="fill:black; stroke:none;" xml:space="preserve">PlusOp</text>
<rect x="2181" y="187" width="81" style="fill:rgb(191,191,191); stroke:none;" height="26" />
<rect x="2180" y="186" width="81" style="fill:rgb(127,127,127); stroke:none;" height="26" />
<rect x="2179" y="185" width="81" style="fill:rgb(63,63,63); stroke:none;" height="26" />
<rect x="2178" y="184" width="81" style="stroke:none;" height="26" />
<rect x="2178" y="184" width="80" style="fill:none; stroke:black;" height="25" />
<image x="2188" y="189" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2207" y="201" style="fill:black; stroke:none;" xml:space="preserve">MulOp</text>
<rect x="898" y="144" width="542" style="fill:rgb(191,191,191); stroke:none;" height="136" />
<rect x="897" y="143" width="542" style="fill:rgb(127,127,127); stroke:none;" height="136" />
<rect x="896" y="142" width="542" style="fill:rgb(63,63,63); stroke:none;" height="136" />
<rect x="895" y="141" width="542" style="stroke:none;" height="136" />
<rect x="895" y="141" width="541" style="fill:none; stroke:black;" height="135" />
<line x1="895" x2="1436" y1="167" style="fill:none; stroke:black;" y2="167" />
<line x1="895" x2="1436" y1="177" style="fill:none; stroke:black;" y2="177" />
<rect x="905" y="182" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="182" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="195" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="905" y="200" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="200" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="213" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in boolean, in Expr, in Statement, in Statement, in Menge): void</text>
<rect x="905" y="218" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="218" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="231" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> loop_codegen(in ClassFile, in CodeAttribute, in Expr, in int, in boolean, in Menge): void</text>
<rect x="905" y="236" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="236" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAjUlEQVR42rWR2w2A
IAxFrXEQN5FNZJPiJozSUdikXiEhRNDGD5sSoJybPiBVnd6N6Mg7Y6nOk2WgWRVe
ZLagGudaFptDEqJaki0AxKU2Ih5mcMHVswS5uGYwS097tz6WdBP0dIhe9k2i1MiH
Kf0gSMkSYCYxJnDFr4iktoHBlPCMxtvrDRj8Qw/91vTQThWRPIE1rC5kAAAAAElF
TkSuQmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="249" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> replace_index(in CodeAttribute, in Menge, in int, in int): void</text>
<rect x="905" y="254" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="254" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAjUlEQVR42rWR2w2A
IAxFrXEQN5FNZJPiJozSUdikXiEhRNDGD5sSoJybPiBVnd6N6Mg7Y6nOk2WgWRVe
ZLagGudaFptDEqJaki0AxKU2Ih5mcMHVswS5uGYwS097tz6WdBP0dIhe9k2i1MiH
Kf0gSMkSYCYxJnDFr4iktoHBlPCMxtvrDRj8Qw/91vTQThWRPIE1rC5kAAAAAElF
TkSuQmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="267" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> build(in ClassFile, in CodeAttribute, in Expr, in Menge, in boolean, in boolean, in boolean, in Menge): void</text>
<image x="1135" y="146" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1154" y="158" style="fill:black; stroke:none;" xml:space="preserve">LogOp</text>
<rect x="981" y="3" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="980" y="2" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="979" y="1" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="978" y="0" width="400" style="stroke:none;" height="64" />
<rect x="978" y="0" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="978" x2="1377" y1="26" style="fill:none; stroke:black;" y2="26" />
<line x1="978" x2="1377" y1="36" style="fill:none; stroke:black;" y2="36" />
<rect x="988" y="41" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="988" y="41" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAiklEQVR42rVRgQ2A
IAwDwiF+4k7hE/WTnbJP3CdYoyEoqJjoQsiAdrSbjTGap7CTjcMOcy3ofu6xtxIQ
wpLyJkIerkUPBUqqfAmikXYlo+R66gSgA3XpiMKn3OZtPaEDcfm/vzHAElSNiP7W
JZR/IKAtzArcttabo56KBzzDeHXGl6ZL0ItJf0BYALD3PkMWvNRAAAAAAElFTkSu
QmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1007" y="54" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="1140" y="5" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1159" y="17" style="fill:black; stroke:none;" xml:space="preserve">Operator</text>
<rect x="1749" y="514" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="1748" y="513" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="1747" y="512" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="1746" y="511" width="400" style="stroke:none;" height="82" />
<rect x="1746" y="511" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="1746" x2="2145" y1="537" style="fill:none; stroke:black;" y2="537" />
<line x1="1746" x2="2145" y1="547" style="fill:none; stroke:black;" y2="547" />
<rect x="1756" y="552" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1756" y="552" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1775" y="565" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="1756" y="570" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1756" y="570" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1775" y="583" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="1901" y="516" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1920" y="528" style="fill:black; stroke:none;" xml:space="preserve">LessEquOp</text>
<path d="M588 128 L588 108 L1179 108 L1179 67" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 1179 67 1185 91 1173 91" />
<polygon style="fill:none; stroke:black;" points=" 1179 67 1185 91 1173 91" />
<path d="M2220 184 L2220 108 L1179 108" style="fill:none; stroke:black;" />
<path d="M1167 141 L1167 108 L1179 108" style="fill:none; stroke:black;" />
<path d="M3121 179 L3121 108 L1179 108" style="fill:none; stroke:black;" />
<path d="M201 503 L201 483 L588 483 L588 195" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 588 195 594 219 582 219" />
<polygon style="fill:none; stroke:black;" points=" 588 195 594 219 582 219" />
<path d="M640 504 L640 483 L588 483" style="fill:none; stroke:black;" />
<path d="M1070 505 L1070 483 L588 483" style="fill:none; stroke:black;" />
<path d="M1501 509 L1501 483 L588 483" style="fill:none; stroke:black;" />
<path d="M1947 511 L1947 483 L588 483" style="fill:none; stroke:black;" />
<path d="M2383 512 L2383 483 L588 483" style="fill:none; stroke:black;" />
<path d="M3350 452 L3350 438 L3121 438" style="fill:none; stroke:black;" />
<path d="M1358 375 L1358 347 L1167 347" style="fill:none; stroke:black;" />
<path d="M961 367 L961 347 L1167 347 L1167 280" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 1167 280 1173 304 1161 304" />
<polygon style="fill:none; stroke:black;" points=" 1167 280 1173 304 1161 304" />
<path d="M2225 322 L2225 302 L2220 302" style="fill:none; stroke:black;" />
<path d="M2871 458 L2871 438 L3121 438 L3121 246" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 3121 246 3127 270 3115 270" />
<polygon style="fill:none; stroke:black;" points=" 3121 246 3127 270 3115 270" />
<path d="M2658 322 L2658 302 L2220 302" style="fill:none; stroke:black;" />
<path d="M1792 322 L1792 302 L2220 302 L2220 213" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 2220 213 2226 237 2214 237" />
<polygon style="fill:none; stroke:black;" points=" 2220 213 2226 237 2214 237" />
</g>
</g>
</svg>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.0//EN' 'http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd'>
<svg xmlns:xlink="http://www.w3.org/1999/xlink" style="fill-opacity:1; color-rendering:auto; color-interpolation:auto; text-rendering:auto; stroke:black; stroke-linecap:square; stroke-miterlimit:10; shape-rendering:auto; stroke-opacity:1; fill:black; stroke-dasharray:none; font-weight:normal; stroke-width:1; font-family:&apos;sansserif&apos;; font-style:normal; stroke-linejoin:miter; font-size:12; stroke-dashoffset:0; image-rendering:auto;" xmlns="http://www.w3.org/2000/svg">
<!--Generated by the Batik Graphics2D SVG Generator-->
<defs id="genericDefs" />
<g>
<g style="fill:white; font-family:&apos;Arial&apos;; font-weight:bold; stroke:white;">
<rect x="-45" y="-50" width="3602" style="stroke:none;" height="652" />
<rect x="406" y="131" width="368" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="405" y="130" width="368" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="404" y="129" width="368" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="403" y="128" width="368" style="stroke:none;" height="64" />
<rect x="403" y="128" width="367" style="fill:none; stroke:black;" height="63" />
<line x1="403" x2="770" y1="154" style="fill:none; stroke:black;" y2="154" />
<line x1="403" x2="770" y1="164" style="fill:none; stroke:black;" y2="164" />
<rect x="413" y="169" width="348" style="stroke:none; font-weight:normal;" height="16" />
<image x="413" y="169" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAiklEQVR42rVRgQ2A
IAwDwiF+4k7hE/WTnbJP3CdYoyEoqJjoQsiAdrSbjTGap7CTjcMOcy3ofu6xtxIQ
wpLyJkIerkUPBUqqfAmikXYlo+R66gSgA3XpiMKn3OZtPaEDcfm/vzHAElSNiP7W
JZR/IKAtzArcttabo56KBzzDeHXGl6ZL0ItJf0BYALD3PkMWvNRAAAAAAElFTkSu
QmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="432" y="182" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="557" y="133" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="576" y="145" style="fill:black; stroke:none;" xml:space="preserve">RelOp</text>
<rect x="872" y="508" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="871" y="507" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="870" y="506" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="869" y="505" width="400" style="stroke:none;" height="82" />
<rect x="869" y="505" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="869" x2="1268" y1="531" style="fill:none; stroke:black;" y2="531" />
<line x1="869" x2="1268" y1="541" style="fill:none; stroke:black;" y2="541" />
<rect x="879" y="546" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="879" y="546" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="898" y="559" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="879" y="564" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="879" y="564" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="898" y="577" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="1032" y="510" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1051" y="522" style="fill:black; stroke:none;" xml:space="preserve">EqualOp</text>
<rect x="442" y="507" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="441" y="506" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="440" y="505" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="439" y="504" width="400" style="stroke:none;" height="82" />
<rect x="439" y="504" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="439" x2="838" y1="530" style="fill:none; stroke:black;" y2="530" />
<line x1="439" x2="838" y1="540" style="fill:none; stroke:black;" y2="540" />
<rect x="449" y="545" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="449" y="545" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="468" y="558" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="449" y="563" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="449" y="563" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="468" y="576" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="606" y="509" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="625" y="521" style="fill:black; stroke:none;" xml:space="preserve">LessOp</text>
<rect x="1303" y="512" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="1302" y="511" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="1301" y="510" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="1300" y="509" width="400" style="stroke:none;" height="82" />
<rect x="1300" y="509" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="1300" x2="1699" y1="535" style="fill:none; stroke:black;" y2="535" />
<line x1="1300" x2="1699" y1="545" style="fill:none; stroke:black;" y2="545" />
<rect x="1310" y="550" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1310" y="550" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1329" y="563" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="1310" y="568" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1310" y="568" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1329" y="581" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="1452" y="514" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1471" y="526" style="fill:black; stroke:none;" xml:space="preserve">NotEqualOp</text>
<rect x="3152" y="455" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="3151" y="454" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="3150" y="453" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="3149" y="452" width="400" style="stroke:none;" height="64" />
<rect x="3149" y="452" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="3149" x2="3548" y1="478" style="fill:none; stroke:black;" y2="478" />
<line x1="3149" x2="3548" y1="488" style="fill:none; stroke:black;" y2="488" />
<rect x="3159" y="493" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="3159" y="493" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="3178" y="506" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="3311" y="457" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="3330" y="469" style="fill:black; stroke:none;" xml:space="preserve">MinusOp</text>
<rect x="1323" y="378" width="73" style="fill:rgb(191,191,191); stroke:none;" height="26" />
<rect x="1322" y="377" width="73" style="fill:rgb(127,127,127); stroke:none;" height="26" />
<rect x="1321" y="376" width="73" style="fill:rgb(63,63,63); stroke:none;" height="26" />
<rect x="1320" y="375" width="73" style="stroke:none;" height="26" />
<rect x="1320" y="375" width="72" style="fill:none; stroke:black;" height="25" />
<image x="1330" y="380" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1349" y="392" style="fill:black; stroke:none;" xml:space="preserve">OrOp</text>
<rect x="921" y="370" width="83" style="fill:rgb(191,191,191); stroke:none;" height="26" />
<rect x="920" y="369" width="83" style="fill:rgb(127,127,127); stroke:none;" height="26" />
<rect x="919" y="368" width="83" style="fill:rgb(63,63,63); stroke:none;" height="26" />
<rect x="918" y="367" width="83" style="stroke:none;" height="26" />
<rect x="918" y="367" width="82" style="fill:none; stroke:black;" height="25" />
<image x="928" y="372" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="947" y="384" style="fill:black; stroke:none;" xml:space="preserve">AndOp</text>
<rect x="2027" y="325" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2026" y="324" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2025" y="323" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2024" y="322" width="400" style="stroke:none;" height="64" />
<rect x="2024" y="322" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2024" x2="2423" y1="348" style="fill:none; stroke:black;" y2="348" />
<line x1="2024" x2="2423" y1="358" style="fill:none; stroke:black;" y2="358" />
<rect x="2034" y="363" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2034" y="363" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2053" y="376" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="2186" y="327" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2205" y="339" style="fill:black; stroke:none;" xml:space="preserve">TimesOp</text>
<rect x="2185" y="515" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="2184" y="514" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="2183" y="513" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="2182" y="512" width="400" style="stroke:none;" height="82" />
<rect x="2182" y="512" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="2182" x2="2581" y1="538" style="fill:none; stroke:black;" y2="538" />
<line x1="2182" x2="2581" y1="548" style="fill:none; stroke:black;" y2="548" />
<rect x="2192" y="553" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2192" y="553" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2211" y="566" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="2192" y="571" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2192" y="571" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2211" y="584" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="2327" y="517" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2346" y="529" style="fill:black; stroke:none;" xml:space="preserve">GreaterEquOp</text>
<rect x="2923" y="182" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2922" y="181" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2921" y="180" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2920" y="179" width="400" style="stroke:none;" height="64" />
<rect x="2920" y="179" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2920" x2="3319" y1="205" style="fill:none; stroke:black;" y2="205" />
<line x1="2920" x2="3319" y1="215" style="fill:none; stroke:black;" y2="215" />
<rect x="2930" y="220" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2930" y="220" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAiklEQVR42rVRgQ2A
IAwDwiF+4k7hE/WTnbJP3CdYoyEoqJjoQsiAdrSbjTGap7CTjcMOcy3ofu6xtxIQ
wpLyJkIerkUPBUqqfAmikXYlo+R66gSgA3XpiMKn3OZtPaEDcfm/vzHAElSNiP7W
JZR/IKAtzArcttabo56KBzzDeHXGl6ZL0ItJf0BYALD3PkMWvNRAAAAAAElFTkSu
QmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2949" y="233" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="3088" y="184" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="3107" y="196" style="fill:black; stroke:none;" xml:space="preserve">AddOp</text>
<rect x="2460" y="325" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2459" y="324" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2458" y="323" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2457" y="322" width="400" style="stroke:none;" height="64" />
<rect x="2457" y="322" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2457" x2="2856" y1="348" style="fill:none; stroke:black;" y2="348" />
<line x1="2457" x2="2856" y1="358" style="fill:none; stroke:black;" y2="358" />
<rect x="2467" y="363" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2467" y="363" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2486" y="376" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="2614" y="327" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2633" y="339" style="fill:black; stroke:none;" xml:space="preserve">ModuloOp</text>
<rect x="3" y="506" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="2" y="505" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="1" y="504" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="0" y="503" width="400" style="stroke:none;" height="82" />
<rect x="0" y="503" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="0" x2="399" y1="529" style="fill:none; stroke:black;" y2="529" />
<line x1="0" x2="399" y1="539" style="fill:none; stroke:black;" y2="539" />
<rect x="10" y="544" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="10" y="544" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="29" y="557" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="10" y="562" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="10" y="562" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="29" y="575" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="157" y="508" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="176" y="520" style="fill:black; stroke:none;" xml:space="preserve">GreaterOp</text>
<rect x="1594" y="325" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="1593" y="324" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="1592" y="323" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="1591" y="322" width="400" style="stroke:none;" height="64" />
<rect x="1591" y="322" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="1591" x2="1990" y1="348" style="fill:none; stroke:black;" y2="348" />
<line x1="1591" x2="1990" y1="358" style="fill:none; stroke:black;" y2="358" />
<rect x="1601" y="363" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1601" y="363" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1620" y="376" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="1752" y="327" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1771" y="339" style="fill:black; stroke:none;" xml:space="preserve">DivideOp</text>
<rect x="2673" y="461" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="2672" y="460" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="2671" y="459" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="2670" y="458" width="400" style="stroke:none;" height="64" />
<rect x="2670" y="458" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="2670" x2="3069" y1="484" style="fill:none; stroke:black;" y2="484" />
<line x1="2670" x2="3069" y1="494" style="fill:none; stroke:black;" y2="494" />
<rect x="2680" y="499" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="2680" y="499" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="2699" y="512" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="2837" y="463" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2856" y="475" style="fill:black; stroke:none;" xml:space="preserve">PlusOp</text>
<rect x="2181" y="187" width="81" style="fill:rgb(191,191,191); stroke:none;" height="26" />
<rect x="2180" y="186" width="81" style="fill:rgb(127,127,127); stroke:none;" height="26" />
<rect x="2179" y="185" width="81" style="fill:rgb(63,63,63); stroke:none;" height="26" />
<rect x="2178" y="184" width="81" style="stroke:none;" height="26" />
<rect x="2178" y="184" width="80" style="fill:none; stroke:black;" height="25" />
<image x="2188" y="189" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="2207" y="201" style="fill:black; stroke:none;" xml:space="preserve">MulOp</text>
<rect x="898" y="144" width="542" style="fill:rgb(191,191,191); stroke:none;" height="136" />
<rect x="897" y="143" width="542" style="fill:rgb(127,127,127); stroke:none;" height="136" />
<rect x="896" y="142" width="542" style="fill:rgb(63,63,63); stroke:none;" height="136" />
<rect x="895" y="141" width="542" style="stroke:none;" height="136" />
<rect x="895" y="141" width="541" style="fill:none; stroke:black;" height="135" />
<line x1="895" x2="1436" y1="167" style="fill:none; stroke:black;" y2="167" />
<line x1="895" x2="1436" y1="177" style="fill:none; stroke:black;" y2="177" />
<rect x="905" y="182" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="182" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="195" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="905" y="200" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="200" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="213" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in boolean, in Expr, in Statement, in Statement, in Menge): void</text>
<rect x="905" y="218" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="218" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="231" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> loop_codegen(in ClassFile, in CodeAttribute, in Expr, in int, in boolean, in Menge): void</text>
<rect x="905" y="236" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="236" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAjUlEQVR42rWR2w2A
IAxFrXEQN5FNZJPiJozSUdikXiEhRNDGD5sSoJybPiBVnd6N6Mg7Y6nOk2WgWRVe
ZLagGudaFptDEqJaki0AxKU2Ih5mcMHVswS5uGYwS097tz6WdBP0dIhe9k2i1MiH
Kf0gSMkSYCYxJnDFr4iktoHBlPCMxtvrDRj8Qw/91vTQThWRPIE1rC5kAAAAAElF
TkSuQmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="249" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> replace_index(in CodeAttribute, in Menge, in int, in int): void</text>
<rect x="905" y="254" width="522" style="stroke:none; font-weight:normal;" height="16" />
<image x="905" y="254" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAjUlEQVR42rWR2w2A
IAxFrXEQN5FNZJPiJozSUdikXiEhRNDGD5sSoJybPiBVnd6N6Mg7Y6nOk2WgWRVe
ZLagGudaFptDEqJaki0AxKU2Ih5mcMHVswS5uGYwS097tz6WdBP0dIhe9k2i1MiH
Kf0gSMkSYCYxJnDFr4iktoHBlPCMxtvrDRj8Qw/91vTQThWRPIE1rC5kAAAAAElF
TkSuQmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="924" y="267" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> build(in ClassFile, in CodeAttribute, in Expr, in Menge, in boolean, in boolean, in boolean, in Menge): void</text>
<image x="1135" y="146" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1154" y="158" style="fill:black; stroke:none;" xml:space="preserve">LogOp</text>
<rect x="981" y="3" width="400" style="fill:rgb(191,191,191); stroke:none;" height="64" />
<rect x="980" y="2" width="400" style="fill:rgb(127,127,127); stroke:none;" height="64" />
<rect x="979" y="1" width="400" style="fill:rgb(63,63,63); stroke:none;" height="64" />
<rect x="978" y="0" width="400" style="stroke:none;" height="64" />
<rect x="978" y="0" width="399" style="fill:none; stroke:black;" height="63" />
<line x1="978" x2="1377" y1="26" style="fill:none; stroke:black;" y2="26" />
<line x1="978" x2="1377" y1="36" style="fill:none; stroke:black;" y2="36" />
<rect x="988" y="41" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="988" y="41" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAiklEQVR42rVRgQ2A
IAwDwiF+4k7hE/WTnbJP3CdYoyEoqJjoQsiAdrSbjTGap7CTjcMOcy3ofu6xtxIQ
wpLyJkIerkUPBUqqfAmikXYlo+R66gSgA3XpiMKn3OZtPaEDcfm/vzHAElSNiP7W
JZR/IKAtzArcttabo56KBzzDeHXGl6ZL0ItJf0BYALD3PkMWvNRAAAAAAElFTkSu
QmCC" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1007" y="54" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<image x="1140" y="5" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABBElEQVR42q1SYZnD
IAylWwVUQiTgYJFQCZmDOVjOwSREwiREQqdgSMBBFwajcLu7/bl8+fpR8l7egzCs
6+peISqi6pogREIavob1XGC7WkOmhIbQZkYf7gf7dgRDF9BPobLJjtnJpgPAWH5Z
6Z28Z+aTXHLvjNagdKUQHSNnP3IViHC8HW1nbNkI9GycDGgwHWr95GPs3J9h7b+t
PxDa4+Z1Z8lsICAjmqtsDwVTIUCqspRDOxeXJbophmip5E/kCcHbLdlOIiyR5tmD
Lwo2nTpgDaF0rWHtIWG6wSU5KzylO6i6amabw+vZzMWbpU3FcprMyYW4bTL2T42q
9G/x4Vr/gfAAzgaEraDyPpwAAAAASUVORK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1159" y="17" style="fill:black; stroke:none;" xml:space="preserve">Operator</text>
<rect x="1749" y="514" width="400" style="fill:rgb(191,191,191); stroke:none;" height="82" />
<rect x="1748" y="513" width="400" style="fill:rgb(127,127,127); stroke:none;" height="82" />
<rect x="1747" y="512" width="400" style="fill:rgb(63,63,63); stroke:none;" height="82" />
<rect x="1746" y="511" width="400" style="stroke:none;" height="82" />
<rect x="1746" y="511" width="399" style="fill:none; stroke:black;" height="81" />
<line x1="1746" x2="2145" y1="537" style="fill:none; stroke:black;" y2="537" />
<line x1="1746" x2="2145" y1="547" style="fill:none; stroke:black;" y2="547" />
<rect x="1756" y="552" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1756" y="552" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1775" y="565" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> codegen(in ClassFile, in CodeAttribute, in Expr, in boolean, in Menge): void</text>
<rect x="1756" y="570" width="380" style="stroke:none; font-weight:normal;" height="16" />
<image x="1756" y="570" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAYUlEQVR42mP8//8/
AymAiYFEMAg1sGAKOTQ4wNkHGg4Q0ABUneCggOAmOBxYcACnk9BUg0QcFIBCgyeU
HjwgpAEYJgsWPACqgyCQyIEHaJ5GDyWgNLIv0VRjjwdMRfQNJQCIvyUFPaAxvQAA
AABJRU5ErkJggg==" style="fill:black; stroke:black; font-weight:normal;" height="16" preserveAspectRatio="none" />
<text x="1775" y="583" style="fill:black; stroke:none; font-weight:normal;" xml:space="preserve"> if_codegen(in ClassFile, in CodeAttribute, in String, in boolean): void</text>
<image x="1901" y="516" width="16" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAA7ElEQVR42q2SXXUE
IQyF09kVMBIiAQmRMBIioRIioRKQEgkjAQk4mF42wMzu6UN7ujl5APL3ceHjOA4a
lj1nd7qYiqjo9eQ+V2KPAJdrGPVwtzxPljMbqc/ZvZ5L7zUngOScw2zSt+bqpUza
YFtibvSObC8uWczzrER03u1+nS+sj8Yt5iVLPifTGLXQH+1/BcBoSCKBhzsPHibm
WN7MjKjue6W1lgp3TZ+aVDhBJZy0rL3qtiVO/dLQa4oAHSHRE0RrT/O9O1J7SwQK
v6b6iA4LpPg2W2eDQ0P4uoLkS+3nvxRsL1/t3bL+xr4BXAV0uUgPznkAAAAASUVO
RK5CYII=" style="fill:black; stroke:black;" height="16" preserveAspectRatio="none" />
<text x="1920" y="528" style="fill:black; stroke:none;" xml:space="preserve">LessEquOp</text>
<path d="M588 128 L588 108 L1179 108 L1179 67" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 1179 67 1185 91 1173 91" />
<polygon style="fill:none; stroke:black;" points=" 1179 67 1185 91 1173 91" />
<path d="M2220 184 L2220 108 L1179 108" style="fill:none; stroke:black;" />
<path d="M1167 141 L1167 108 L1179 108" style="fill:none; stroke:black;" />
<path d="M3121 179 L3121 108 L1179 108" style="fill:none; stroke:black;" />
<path d="M201 503 L201 483 L588 483 L588 195" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 588 195 594 219 582 219" />
<polygon style="fill:none; stroke:black;" points=" 588 195 594 219 582 219" />
<path d="M640 504 L640 483 L588 483" style="fill:none; stroke:black;" />
<path d="M1070 505 L1070 483 L588 483" style="fill:none; stroke:black;" />
<path d="M1501 509 L1501 483 L588 483" style="fill:none; stroke:black;" />
<path d="M1947 511 L1947 483 L588 483" style="fill:none; stroke:black;" />
<path d="M2383 512 L2383 483 L588 483" style="fill:none; stroke:black;" />
<path d="M3350 452 L3350 438 L3121 438" style="fill:none; stroke:black;" />
<path d="M1358 375 L1358 347 L1167 347" style="fill:none; stroke:black;" />
<path d="M961 367 L961 347 L1167 347 L1167 280" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 1167 280 1173 304 1161 304" />
<polygon style="fill:none; stroke:black;" points=" 1167 280 1173 304 1161 304" />
<path d="M2225 322 L2225 302 L2220 302" style="fill:none; stroke:black;" />
<path d="M2871 458 L2871 438 L3121 438 L3121 246" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 3121 246 3127 270 3115 270" />
<polygon style="fill:none; stroke:black;" points=" 3121 246 3127 270 3115 270" />
<path d="M2658 322 L2658 302 L2220 302" style="fill:none; stroke:black;" />
<path d="M1792 322 L1792 302 L2220 302 L2220 213" style="fill:none; stroke:black;" />
<polygon style="stroke:none;" points=" 2220 213 2226 237 2214 237" />
<polygon style="fill:none; stroke:black;" points=" 2220 213 2226 237 2214 237" />
</g>
</g>
</svg>

Before

(image error) Size: 42 KiB

After

(image error) Size: 42 KiB

File diff suppressed because it is too large Load Diff

Before

(image error) Size: 195 KiB

After

(image error) Size: 193 KiB

File diff suppressed because it is too large Load Diff

Before

(image error) Size: 187 KiB

After

(image error) Size: 185 KiB

File diff suppressed because it is too large Load Diff

@ -7,14 +7,14 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<artifactId>JavaTXcompiler</artifactId>
<packaging>jar</packaging>
<version>0.1</version>
<version>0.2</version>
<name>JavaTXcompiler</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
@ -127,7 +127,7 @@ http://maven.apache.org/maven-v4_0_0.xsd">
<!-- specify your depencies here -->
<!-- groupId:artifactId:version -->
<artifact>
<id>de.dhbwstuttgart:JavaTXcompiler:0.1</id>
<id>de.dhbwstuttgart:JavaTXcompiler:0.2</id>
</artifact>
<artifact>
<id>org.reflections:reflections:0.9.11</id>

@ -61,7 +61,7 @@ public class ArgumentVisitor implements StatementVisitor {
assign.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(assign.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(assign.getType()));
argListMethCall.remove(0);
}
@ -70,9 +70,9 @@ public class ArgumentVisitor implements StatementVisitor {
binary.accept(bytecodeGenMethod);
if(argListMethCall.get(0)) {
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(binary.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(binary.getType()));
} else {
bytecodeGenMethod.doBoxing(bytecodeGenMethod.getResolvedType(binary.getType()));
bytecodeGenMethod.doBoxing(bytecodeGenMethod.getResolver().getResolvedType(binary.getType()));
}
argListMethCall.remove(0);
}
@ -88,7 +88,7 @@ public class ArgumentVisitor implements StatementVisitor {
castExpr.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(castExpr.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(castExpr.getType()));
argListMethCall.remove(0);
}
@ -103,7 +103,7 @@ public class ArgumentVisitor implements StatementVisitor {
fieldVar.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(fieldVar.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(fieldVar.getType()));
argListMethCall.remove(0);
}
@ -124,7 +124,7 @@ public class ArgumentVisitor implements StatementVisitor {
instanceOf.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(instanceOf.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(instanceOf.getType()));
argListMethCall.remove(0);
}
@ -133,7 +133,7 @@ public class ArgumentVisitor implements StatementVisitor {
localVar.accept(bytecodeGenMethod);
if(!bytecodeGenMethod.isBinaryExp) {
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(localVar.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(localVar.getType()));
}
argListMethCall.remove(0);
}
@ -149,7 +149,7 @@ public class ArgumentVisitor implements StatementVisitor {
methodCall.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(methodCall.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(methodCall.getType()));
argListMethCall.remove(0);
}
@ -158,7 +158,7 @@ public class ArgumentVisitor implements StatementVisitor {
methodCall.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(methodCall.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(methodCall.getType()));
argListMethCall.remove(0);
}
@ -197,7 +197,7 @@ public class ArgumentVisitor implements StatementVisitor {
aThis.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(aThis.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(aThis.getType()));
argListMethCall.remove(0);
}
@ -242,7 +242,7 @@ public class ArgumentVisitor implements StatementVisitor {
unaryExpr.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(unaryExpr.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(unaryExpr.getType()));
argListMethCall.remove(0);
}
@ -251,7 +251,7 @@ public class ArgumentVisitor implements StatementVisitor {
literal.accept(bytecodeGenMethod);
if(argListMethCall.get(0))
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolvedType(literal.getType()));
bytecodeGenMethod.doUnboxing(bytecodeGenMethod.getResolver().getResolvedType(literal.getType()));
argListMethCall.remove(0);
}

@ -1,398 +1,368 @@
package de.dhbwstuttgart.bytecode;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Optional;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.statement.*;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
import de.dhbwstuttgart.bytecode.Exception.BytecodeGeneratorError;
import de.dhbwstuttgart.bytecode.descriptor.DescriptorToString;
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
import de.dhbwstuttgart.bytecode.signature.Signature;
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
import de.dhbwstuttgart.bytecode.signature.TypeToString;
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass;
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
import de.dhbwstuttgart.bytecode.utilities.Simplify;
import de.dhbwstuttgart.bytecode.utilities.Resolver;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
import de.dhbwstuttgart.syntaxtree.statement.Assign;
import de.dhbwstuttgart.syntaxtree.statement.AssignToField;
import de.dhbwstuttgart.syntaxtree.statement.BinaryExpr;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
import de.dhbwstuttgart.syntaxtree.statement.DoStmt;
import de.dhbwstuttgart.syntaxtree.statement.EmptyStmt;
import de.dhbwstuttgart.syntaxtree.statement.ExpressionReceiver;
import de.dhbwstuttgart.syntaxtree.statement.FieldVar;
import de.dhbwstuttgart.syntaxtree.statement.ForStmt;
import de.dhbwstuttgart.syntaxtree.statement.IfStmt;
import de.dhbwstuttgart.syntaxtree.statement.InstanceOf;
import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression;
import de.dhbwstuttgart.syntaxtree.statement.Literal;
import de.dhbwstuttgart.syntaxtree.statement.LocalVar;
import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl;
import de.dhbwstuttgart.syntaxtree.statement.MethodCall;
import de.dhbwstuttgart.syntaxtree.statement.NewArray;
import de.dhbwstuttgart.syntaxtree.statement.NewClass;
import de.dhbwstuttgart.syntaxtree.statement.Return;
import de.dhbwstuttgart.syntaxtree.statement.ReturnVoid;
import de.dhbwstuttgart.syntaxtree.statement.StaticClassName;
import de.dhbwstuttgart.syntaxtree.statement.Super;
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
import de.dhbwstuttgart.syntaxtree.statement.This;
import de.dhbwstuttgart.syntaxtree.statement.UnaryExpr;
import de.dhbwstuttgart.syntaxtree.statement.WhileStmt;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.result.GenericInsertPair;
import de.dhbwstuttgart.typeinference.result.ResolvedType;
import de.dhbwstuttgart.typeinference.result.ResultPair;
import de.dhbwstuttgart.typeinference.result.ResultSet;
public class BytecodeGen implements ASTVisitor {
ClassWriter cw =new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
String type;
public static RefTypeOrTPHOrWildcardOrGeneric THISTYPE = null;
String className;
private String className;
private String pkgName;
private boolean isInterface;
private List<ResultSet> listOfResultSets;
private Collection<ResultSet> listOfResultSets;
private ResultSet resultSet;
private SourceFile sf;
private String path;
private Optional<Constructor> fieldInitializations;
private int indexOfFirstParam = 0;
private String superClass;
private ArrayList<TypePlaceholder> tphsClass;
// stores parameter, local vars and the next index on the local variable table, which use for aload_i, astore_i,...
private List<String> tphsClass;
// stores parameter, local vars and the next index on the local variable table,
// which use for aload_i, astore_i,...
HashMap<String, Integer> paramsAndLocals = new HashMap<>();
// stores generics and their bounds of class
HashMap<String, String> genericsAndBounds = new HashMap<>();
private int constructorPos = 0;
private final TPHExtractor tphExtractor = new TPHExtractor();
private final ArrayList<GenericInsertPair> commonPairs = new ArrayList<>();
HashMap<String,RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes = new HashMap<>();
HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes = new HashMap<>();
byte[] bytecode;
HashMap<String,byte[]> classFiles;
ArrayList<String> methodNameAndParamsT = new ArrayList<>();
public BytecodeGen(HashMap<String,byte[]> classFiles, List<ResultSet> listOfResultSets,SourceFile sf ,String path) {
HashMap<String, byte[]> classFiles;
private final ArrayList<String> methodNameAndParamsT = new ArrayList<>();
private final ArrayList<String> fieldNameAndParamsT = new ArrayList<>();
private final ArrayList<String> fieldNameSignature = new ArrayList<>();
private List<GenericGenratorResultForSourceFile> simplifyResultsForAllSourceFiles;
private GenericsGeneratorResultForClass generatedGenerics;
private Resolver resolver;
public BytecodeGen(HashMap<String, byte[]> classFiles, Collection<ResultSet> listOfResultSets, List<GenericGenratorResultForSourceFile> simplifyResultsForAllSourceFiles, SourceFile sf,
String path) {
this.classFiles = classFiles;
this.listOfResultSets = listOfResultSets;
this.simplifyResultsForAllSourceFiles = simplifyResultsForAllSourceFiles;
this.sf = sf;
this.path = path;
this.pkgName = sf.getPkgName();
}
@Override
public void visit(SourceFile sourceFile) {
for(ClassOrInterface cl : sourceFile.getClasses()) {
for (ClassOrInterface cl : sourceFile.getClasses()) {
System.out.println("in Class: " + cl.getClassName().toString());
BytecodeGen classGen = new BytecodeGen(classFiles, listOfResultSets, sf, path);
BytecodeGen classGen = new BytecodeGen(classFiles, listOfResultSets, simplifyResultsForAllSourceFiles, sf, path);
cl.accept(classGen);
classGen.writeClass(cl.getClassName().toString());
}
}
/**
* Associates the bytecode of the class that was build with the classWriter {@link #cw}
* with the class name in the map {@link #classFiles}
* Associates the bytecode of the class that was build with the classWriter
* {@link #cw} with the class name in the map {@link #classFiles}
*
* @param name name of the class with which the the bytecode is to be associated
* @param name name of the class with which the bytecode is to be associated
*/
private void writeClass(String name) {
bytecode = cw.toByteArray();
classFiles.put(name, bytecode);
}
public HashMap<String,byte[]> getClassFiles() {
public HashMap<String, byte[]> getClassFiles() {
return classFiles;
}
@Override
public void visit(ClassOrInterface classOrInterface) {
className = classOrInterface.getClassName().toString();
cw.visitSource(className +".jav", null);
isInterface = (classOrInterface.getModifiers()&512)==512;
int acc = isInterface?classOrInterface.getModifiers()+Opcodes.ACC_ABSTRACT:classOrInterface.getModifiers()+Opcodes.ACC_SUPER;
cw.visitSource(className + ".jav", null);
isInterface = (classOrInterface.getModifiers() & 512) == 512;
int acc = isInterface ? classOrInterface.getModifiers() + Opcodes.ACC_ABSTRACT
: classOrInterface.getModifiers() + Opcodes.ACC_SUPER;
fieldInitializations = classOrInterface.getfieldInitializations();
// resultSet = listOfResultSets.get(0);
boolean isConsWithNoParamsVisited = false;
boolean isVisited = false;
for(ResultSet rs : listOfResultSets) {
superClass = classOrInterface.getSuperClass().acceptTV(new TypeToDescriptor());
resultSet = rs;
tphExtractor.setResultSet(resultSet);
// Nur einmal ausführen!!
if(!isVisited) {
classOrInterface.accept(tphExtractor);
getCommonTPHS(tphExtractor);
tphsClass = new ArrayList<>();
for(TypePlaceholder t : tphExtractor.allTPHS.keySet()) {
if(!tphExtractor.allTPHS.get(t))
tphsClass.add(t);
}
// resultSet = listOfResultSets.get(0);
boolean isVisited = false;
List<ResultSet> listOfResultSetsList = new ArrayList<>(listOfResultSets);
generatedGenerics = simplifyResultsForAllSourceFiles.stream().map(sr->sr.getSimplifyResultsByName(pkgName, className)).findFirst().get();
for (int i = 0; i < listOfResultSetsList.size(); i++) {
//for (ResultSet rs : listOfResultSets) {
superClass = classOrInterface.getSuperClass().acceptTV(new TypeToDescriptor());
resultSet = listOfResultSetsList.get(i);
resolver = new Resolver(resultSet);
// tphExtractor.setResultSet(resultSet);
// Nur einmal ausführen!!
if (!isVisited) {
String sig = null;
/* if class has generics then creates signature
* Signature looks like:
* <E:Ljava/...>Superclass
/*
* if class has generics then creates signature Signature looks like:
* <E:Ljava/...>Superclass
*/
if(classOrInterface.getGenerics().iterator().hasNext() || !commonPairs.isEmpty() ||
classOrInterface.getSuperClass().acceptTV(new TypeToSignature()).contains("<")
|| !tphsClass.isEmpty()) {
HashMap<TPHConstraint, HashSet<String>> constraints = Simplify.simplifyConstraintsClass(tphExtractor,tphsClass);
ArrayList<TPHConstraint> consClass = new ArrayList<>();
for(TPHConstraint cons : constraints.keySet()) {
TypePlaceholder right = null;
for(TypePlaceholder tph : tphsClass) {
if(cons.getLeft().equals(tph.getName())) {
consClass.add(cons);
right = getTPH(cons.getRight());
}
}
if(right != null) {
tphsClass.add(right);
removeFromMethod(right.getName());
right = null;
}
}
Signature signature = new Signature(classOrInterface, genericsAndBounds,commonPairs,tphsClass, consClass);
sig = signature.toString();
if (classOrInterface.getGenerics().iterator().hasNext() || classOrInterface.getSuperClass().acceptTV(new TypeToSignature()).contains("<")
|| !generatedGenerics.getClassConstraints().isEmpty()) {
List<GenericsGeneratorResult> consClass = generatedGenerics.getClassConstraints();
//
Signature signature = new Signature(classOrInterface, genericsAndBounds, consClass);
sig = signature.createSignatureForClassOrInterface();
System.out.println("Signature: => " + sig);
}
cw.visit(Opcodes.V1_8, acc, classOrInterface.getClassName().toString()
, sig, classOrInterface.getSuperClass().acceptTV(new TypeToDescriptor()), null);
cw.visit(Opcodes.V1_8, acc, classOrInterface.getClassName().toString(), sig,
classOrInterface.getSuperClass().acceptTV(new TypeToDescriptor()), null);
isVisited = true;
}
for(Field f : classOrInterface.getFieldDecl()) {
for (Field f : classOrInterface.getFieldDecl()) {
f.accept(this);
}
for(Constructor c : classOrInterface.getConstructors()) {
// if(!isConsWithNoParamsVisited) {
c.accept(this);
// }
// if(!c.getParameterList().iterator().hasNext())
// isConsWithNoParamsVisited = true;
for (Constructor c : classOrInterface.getConstructors()) {
c.accept(this);
}
for(Method m : classOrInterface.getMethods()) {
for (Method m : classOrInterface.getMethods()) {
m.accept(this);
}
}
}
private void removeFromMethod(String name) {
for(MethodAndTPH m : tphExtractor.ListOfMethodsAndTph) {
ArrayList<String> toRemove = new ArrayList<>();
for(String tph : m.getTphs()) {
if(tph.equals(name)) {
toRemove.add(tph);
}
}
if(!toRemove.isEmpty()) {
m.getTphs().removeAll(toRemove);
return;
}
}
}
private TypePlaceholder getTPH(String name) {
for(TypePlaceholder tph: tphExtractor.allTPHS.keySet()) {
if(tph.getName().equals(name))
return tph;
}
throw new NoSuchElementException("TPH "+name +" does not exist");
}
private void getCommonTPHS(TPHExtractor tphExtractor) {
// Gemeinsame TPHs
ArrayList<TypePlaceholder> cTPHs = new ArrayList<>();
// Alle TPHs der Felder speichern
for(TypePlaceholder tph : tphExtractor.allTPHS.keySet()) {
if(!tphExtractor.allTPHS.get(tph))
cTPHs.add(tph);
}
}
@Override
public void visit(Constructor field) {
System.out.println("ResultSet: ");
resultSet.results.forEach(a->{
System.out.println(a.getLeft().toString() + " = " + a.getRight().toString());
});
System.out.println("---------------");
// stores generics and their bounds of method
HashMap<String, String> genericsAndBoundsMethod = new HashMap<>();
field.getParameterList().accept(this);
String methParamTypes = field.name+"%%";
Iterator<FormalParameter> itr = field.getParameterList().iterator();
while(itr.hasNext()) {
FormalParameter fp = itr.next();
methParamTypes += resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+";";
// methParamTypes += resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToSignature())+";";
}
if(methodNameAndParamsT.contains(methParamTypes)) {
System.out.println("ignore - Method: "+field.name +" , paramsType: "+methParamTypes);
String id = MethodUtility.createID(resolver, field);
if (methodNameAndParamsT.contains(id)) {
return;
}
methodNameAndParamsT.add(methParamTypes);
System.out.println("Method: "+field.name +" , paramsType: "+methParamTypes);
methodNameAndParamsT.add(id);
System.out.println("Constructor: " + field.name + " , paramsType: " + id);
String desc = null;
boolean hasGen = false;
for(String paramName : methodParamsAndTypes.keySet()) {
for (String paramName : methodParamsAndTypes.keySet()) {
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToSignature());
System.out.println(typeOfParam);
if(genericsAndBounds.containsKey(typeOfParam) ||typeOfParam.contains("$")
|| typeOfParam.contains("<")) {
if (genericsAndBounds.containsKey(typeOfParam) || typeOfParam.contains("$") || typeOfParam.contains("<")) {
hasGen = true;
break;
}
}
String sig = null;
if(hasGen) {
HashMap<TPHConstraint, HashSet<String>> constraints = Simplify.simplifyConstraints(field.name, tphExtractor,tphsClass);
Signature signature = new Signature(field, genericsAndBounds,methodParamsAndTypes,resultSet,constraints);
sig = signature.toString();
if (hasGen) {
List<GenericsGeneratorResult> constraints = generatedGenerics.getClassConstraints();
Signature signature = new Signature(genericsAndBounds,
methodParamsAndTypes, resultSet, constraints);
sig = signature.createSignatureForConstructor(field);
}
if(field.getParameterList().iterator().hasNext())
if (field.getParameterList().iterator().hasNext())
System.out.println(field.getParameterList().iterator().next().getType().acceptTV(new TypeToDescriptor()));
NormalConstructor constructor = new NormalConstructor(field,genericsAndBounds,hasGen);
NormalConstructor constructor = new NormalConstructor(field, genericsAndBounds, hasGen);
desc = constructor.accept(new DescriptorToString(resultSet));
System.out.println("Constructor: " + field.getName() + " Sig: "+ sig + " Desc: " + desc);
System.out.println("Constructor: " + field.getName() + " Sig: " + sig + " Desc: " + desc);
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", desc, sig, null);
mv.visitCode();
mv.visitCode();
Block block = fieldInitializations.get().block;
constructorPos += 1;
BytecodeGenMethod gen = new BytecodeGenMethod(className,superClass,resultSet,field, mv,paramsAndLocals,cw,
genericsAndBoundsMethod,genericsAndBounds,isInterface,classFiles, sf,path, block, constructorPos);
if(!field.getParameterList().iterator().hasNext() && !(field.block.statements.get(field.block.statements.size()-1) instanceof ReturnVoid)) {
BytecodeGenMethod gen = new BytecodeGenMethod(className, superClass, resultSet, field, mv, paramsAndLocals, cw,
genericsAndBoundsMethod, genericsAndBounds, isInterface, classFiles, sf, path, block, constructorPos);
if (!field.getParameterList().iterator().hasNext()
&& !(field.block.statements.get(field.block.statements.size() - 1) instanceof ReturnVoid)) {
mv.visitInsn(Opcodes.RETURN);
}
mv.visitMaxs(0, 0);
mv.visitEnd();
}
@Override
public void visit(Method method) {
// TODO: check if the method is static => if static then the first param will be stored in pos 0
// TODO: check if the method is static => if static then the first param will be
// stored in pos 0
// else it will be stored in pos 1 and this will be stored in pos 0
String retType = resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
// String retType = resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature());
String methParamTypes = retType+method.name+"%%";
method.getParameterList().accept(this);
Iterator<FormalParameter> itr = method.getParameterList().iterator();
while(itr.hasNext()) {
FormalParameter fp = itr.next();
methParamTypes += resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+";";
// methParamTypes += resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToSignature())+";";
}
if(methodNameAndParamsT.contains(methParamTypes)) {
String id = MethodUtility.createID(resolver, method);
if (methodNameAndParamsT.contains(id)) {
return;
}
methodNameAndParamsT.add(methParamTypes);
System.out.println("Method: "+method.name +" , paramsType: "+methParamTypes);
methodNameAndParamsT.add(id);
System.out.println("Method: " + method.name + " , paramsType: " + id);
// stores generics and their bounds of method
HashMap<String, String> genericsAndBoundsMethod = new HashMap<>();
method.getParameterList().accept(this);
String methDesc = null;
// Method getModifiers() ?
int acc = isInterface?Opcodes.ACC_ABSTRACT:method.modifier;
int acc = isInterface ? Opcodes.ACC_ABSTRACT : method.modifier;
System.out.println(acc);
/*Prüfe, ob die Rückgabe-Type der Methode eine Type-Variable ist*/
boolean hasGenInParameterList = genericsAndBounds.containsKey(retType) || retType.subSequence(0, 4).equals("TPH ") ||
resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature()).contains("<");
/*Wenn die Rückgabe-Type eine Typ-variable ist, erzeuge direkt die Signature, wenn nicht,
* prüfe, ob einer der Parameter Typ-Variable als Typ hat*/
if(!hasGenInParameterList) {
for(String paramName : methodParamsAndTypes.keySet()) {
/* Prüfe, ob die Rückgabe-Type der Methode eine Type-Variable ist */
boolean hasGenInParameterList = genericsAndBounds.containsKey(retType) || retType.contains("TPH ")
|| resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature())
.contains("<");
/*
* Wenn die Rückgabe-Type eine Typ-variable ist, erzeuge direkt die Signature,
* wenn nicht, prüfe, ob einer der Parameter Typ-Variable als Typ hat
*/
if (!hasGenInParameterList) {
for (String paramName : methodParamsAndTypes.keySet()) {
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToDescriptor());
String sigOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToSignature());
if(genericsAndBounds.containsKey(typeOfParam)||typeOfParam.substring(0, 4).equals("TPH ")||sigOfParam.contains("<")) {
if (genericsAndBounds.containsKey(typeOfParam) || typeOfParam.contains("TPH ")
|| sigOfParam.contains("<")) {
hasGenInParameterList = true;
break;
}
}
}
//TODO: Test if the return-type or any of the parameter is a parameterized type. (VP)
//then create the descriptor with the new syntax.
// TODO: Test if the return-type or any of the parameter is a parameterized
// type. (VP)
// then create the descriptor with the new syntax.
String sig = null;
/* method.getGenerics: <....> RT method(..)
* */
/*
* method.getGenerics: <....> RT method(..)
*/
boolean hasGen = method.getGenerics().iterator().hasNext() || hasGenInParameterList;
/* if method has generics or return type is TPH, create signature */
// zwite operand muss weggelassen werden
if(hasGen||resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToString()).equals("TPH")) {
System.out.println("ALL CONST: " + tphExtractor.allCons.size());
tphExtractor.allCons.forEach(c->System.out.println(c.toString()));
System.out.println("----------------");
HashMap<TPHConstraint, HashSet<String>> constraints = Simplify.simplifyConstraints(method.name, tphExtractor, tphsClass);
// ArrayList<GenericInsertPair> pairs = simplifyPairs(method.name,tphExtractor.allPairs,tphExtractor.allCons);
Signature signature = new Signature(method, genericsAndBoundsMethod, genericsAndBounds,methodParamsAndTypes,resultSet,constraints);
sig = signature.toString();
if (hasGen || resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToString())
.equals("TPH")) {
List<GenericsGeneratorResult> constraints = generatedGenerics.getMethodConstraintsByID(id);
List<GenericsGeneratorResult> classConstraints = generatedGenerics.getClassConstraints();
Signature signature = new Signature(genericsAndBoundsMethod, genericsAndBounds,
methodParamsAndTypes, resultSet, constraints,classConstraints);
sig = signature.createSignatureForMethod(method);
}
System.out.println(method.getName()+" ==> "+sig);
NormalMethod meth = new NormalMethod(method,genericsAndBounds,genericsAndBoundsMethod,hasGen);
System.out.println(method.getName() + " ==> " + sig);
NormalMethod meth = new NormalMethod(method, genericsAndBounds, genericsAndBoundsMethod, hasGen);
methDesc = meth.accept(new DescriptorToString(resultSet));
// System.out.println(methDesc);
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC+acc, method.getName(), methDesc, sig, null);
mv.visitCode();
BytecodeGenMethod gen = new BytecodeGenMethod(className,superClass,resultSet,method, mv,paramsAndLocals,cw,
genericsAndBoundsMethod,genericsAndBounds,isInterface,classFiles, sf,path);
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC + acc, method.getName(), methDesc, sig, null);
mv.visitCode();
BytecodeGenMethod gen = new BytecodeGenMethod(className, superClass, resultSet, method, mv, paramsAndLocals, cw,
genericsAndBoundsMethod, genericsAndBounds, isInterface, classFiles, sf, path);
mv.visitMaxs(0, 0);
mv.visitEnd();
}
@Override
public void visit(ParameterList formalParameters) {
paramsAndLocals = new HashMap<>();
methodParamsAndTypes = new HashMap<>();
Iterator<FormalParameter> itr = formalParameters.iterator();
int i = 1;
while(itr.hasNext()) {
while (itr.hasNext()) {
FormalParameter fp = itr.next();
paramsAndLocals.put(fp.getName(), i);
methodParamsAndTypes.put(fp.getName(), resultSet.resolveType(fp.getType()).resolvedType);
@ -400,39 +370,39 @@ public class BytecodeGen implements ASTVisitor {
i++;
}
}
@Override
public void visit(FormalParameter formalParameter) {
formalParameter.getType().accept(this);
}
@Override
public void visit(RefType refType) {
type = "L"+refType.toString()+";";
type = "L" + refType.toString() + ";";
}
@Override
public void visit(SuperWildcardType superWildcardType) {
// TODO Auto-generated method stub
}
@Override
public void visit(TypePlaceholder typePlaceholder) {
// TODO Auto-generated method stub
}
@Override
public void visit(ExtendsWildcardType extendsWildcardType) {
// TODO Auto-generated method stub
}
@Override
public void visit(GenericRefType genericRefType) {
// TODO Auto-generated method stub
}
// ??
@ -440,41 +410,51 @@ public class BytecodeGen implements ASTVisitor {
public void visit(FieldVar fieldVar) {
System.out.println("In FieldVar ---");
// cw.newField(fieldVar.receiver.toString(), fieldVar.fieldVarName.toString(), fieldVar.getType().toString());
FieldVisitor fv = cw.visitField(Opcodes.ACC_PRIVATE, fieldVar.fieldVarName, "L"+fieldVar.getType()+";", null, null);
FieldVisitor fv = cw.visitField(Opcodes.ACC_PRIVATE, fieldVar.fieldVarName, "L" + fieldVar.getType() + ";",
null, null);
fv.visitEnd();
}
@Override
public void visit(Field field) {
System.out.println("In Field ---");
String des = "L";
if(resultSet.resolveType(field.getType()).resolvedType instanceof TypePlaceholder) {
if (resultSet.resolveType(field.getType()).resolvedType instanceof TypePlaceholder) {
des += Type.getInternalName(Object.class);
} else {
des += resultSet.resolveType(field.getType()).resolvedType.acceptTV(new TypeToDescriptor());
}
des +=";";
des += ";";
System.out.println(des);
String sig = resultSet.resolveType(field.getType()).resolvedType.acceptTV(new TypeToSignature());
String sig = resultSet.resolveType(field.getType()).resolvedType.acceptTV(new TypeToSignature(generatedGenerics.getClassConstraints()));
System.out.println(sig);
if(sig.charAt(sig.length()-1) != (";").charAt(0)) {
sig +=";";
if (sig.charAt(sig.length() - 1) != (";").charAt(0)) {
sig += ";";
}
cw.visitField(field.modifier, field.getName(),
des, sig,
null);
String nameAndDesc = field.getName() + "%%" + des;
String nameAndSig = field.getName() + "%%" + sig;
if (fieldNameAndParamsT.contains(nameAndDesc)) {
if (fieldNameSignature.contains(nameAndSig)) {
return;
}
throw new BytecodeGeneratorError("Bytecode generation aborted due to duplicate field name&signature");
}
fieldNameAndParamsT.add(nameAndDesc);
fieldNameSignature.add(nameAndSig);
cw.visitField(field.modifier, field.getName(), des, sig, null);
}
@Override
public void visit(LambdaExpression lambdaExpression) {
// TODO Auto-generated method stub
}
@Override
public void visit(Assign assign) {
// TODO Auto-generated method stub
}
@Override
@ -485,151 +465,151 @@ public class BytecodeGen implements ASTVisitor {
@Override
public void visit(Block block) {
// TODO Auto-generated method stub
}
@Override
public void visit(CastExpr castExpr) {
// TODO Auto-generated method stub
}
@Override
public void visit(EmptyStmt emptyStmt) {
// TODO Auto-generated method stub
}
@Override
public void visit(ForStmt forStmt) {
// TODO Auto-generated method stub
}
@Override
public void visit(IfStmt ifStmt) {
// TODO Auto-generated method stub
}
@Override
public void visit(InstanceOf instanceOf) {
// TODO Auto-generated method stub
}
@Override
public void visit(LocalVar localVar) {
// TODO Auto-generated method stub
}
@Override
public void visit(LocalVarDecl localVarDecl) {
// TODO Auto-generated method stub
}
@Override
public void visit(MethodCall methodCall) {
// TODO Auto-generated method stub
}
@Override
public void visit(NewClass methodCall) {
// TODO Auto-generated method stub
}
@Override
public void visit(NewArray newArray) {
// TODO Auto-generated method stub
}
@Override
public void visit(Return aReturn) {
// TODO Auto-generated method stub
}
@Override
public void visit(ReturnVoid aReturn) {
// TODO Auto-generated method stub
}
@Override
public void visit(StaticClassName staticClassName) {
// TODO Auto-generated method stub
}
@Override
public void visit(Super aSuper) {
// TODO Auto-generated method stub
}
@Override
public void visit(This aThis) {
// TODO Auto-generated method stub
}
@Override
public void visit(WhileStmt whileStmt) {
// TODO Auto-generated method stub
}
@Override
public void visit(DoStmt whileStmt) {
// TODO Auto-generated method stub
}
// ???
@Override
public void visit(Literal literal) {
// TODO Auto-generated method stub
}
@Override
public void visit(ArgumentList argumentList) {
// TODO Auto-generated method stub
}
@Override
public void visit(GenericTypeVar genericTypeVar) {
// TODO Auto-generated method stub
}
@Override
public void visit(GenericDeclarationList genericTypeVars) {
// TODO Auto-generated method stub
}
@Override
public void visit(AssignToField assignLeftSide) {
// TODO Auto-generated method stub
}
@Override
public void visit(AssignToLocal assignLeftSide) {
// TODO Auto-generated method stub
}
@Override
public void visit(SuperCall superCall) {
}
@Override
@ -642,6 +622,5 @@ public class BytecodeGen implements ASTVisitor {
public void visit(UnaryExpr unaryExpr) {
throw new NotImplementedException();
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,19 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.Exception;
/**
* @author fayez
*
*/
public class BytecodeGeneratorError extends RuntimeException {
/**
* @param message
*/
public BytecodeGeneratorError(String message) {
super(message);
}
}

@ -0,0 +1,25 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.Exception;
/**
* @author fayez
*
*/
public class NotFoundException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* @param message
*/
public NotFoundException(String message) {
super(message);
}
}

@ -0,0 +1,26 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.Exception;
/**
* @author fayez
*
*/
public class NotInCurrentPackageException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* @param message
*/
public NotInCurrentPackageException(String message) {
super(message);
}
}

@ -5,21 +5,33 @@ package de.dhbwstuttgart.bytecode;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
import de.dhbwstuttgart.bytecode.utilities.Resolver;
import de.dhbwstuttgart.syntaxtree.AbstractASTWalker;
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.statement.LocalVar;
import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.result.GenericInsertPair;
import de.dhbwstuttgart.typeinference.result.ResultPair;
import de.dhbwstuttgart.typeinference.result.ResultSet;
/**
@ -29,16 +41,18 @@ import de.dhbwstuttgart.typeinference.result.ResultSet;
public class TPHExtractor extends AbstractASTWalker {
// Alle TPHs der Felder werden iKopf der Klasse definiert
// alle TPHs der Klasse: (TPH, is in Method?)
final HashMap<TypePlaceholder, Boolean> allTPHS = new HashMap<>();
public final HashMap<String, Boolean> allTPHS = new HashMap<>();
public final List<String> tphsClass = new ArrayList<>();
MethodAndTPH methodAndTph;
Boolean inMethod = false;
boolean inLocalOrParam = false;
boolean inLocalOrParamOrReturn = false;
public final ArrayList<MethodAndTPH> ListOfMethodsAndTph = new ArrayList<>();
final ArrayList<GenericInsertPair> allPairs = new ArrayList<>();
final ArrayList<ResultPair<TypePlaceholder, TypePlaceholder>> allPairs = new ArrayList<>();
public final ArrayList<TPHConstraint> allCons = new ArrayList<>();
private ResultSet resultSet;
private Resolver resolver;
public TPHExtractor() {
@ -46,31 +60,108 @@ public class TPHExtractor extends AbstractASTWalker {
public void setResultSet(ResultSet resultSet) {
this.resultSet = resultSet;
this.resolver = new Resolver(resultSet);
}
public Resolver getResolver() {
return resolver;
}
// @Override
// public void visit(ClassOrInterface classOrInterface) {
// inMethod = false;
// classOrInterface.getfieldInitializations().ifPresent(c->c.block.accept(this));
// super.visit(classOrInterface);
// inMethod = true;
// }
@Override
public void visit(TypePlaceholder tph) {
if (resultSet.resolveType(tph).resolvedType instanceof TypePlaceholder) {
TypePlaceholder resolvedTPH = (TypePlaceholder) resultSet.resolveType(tph).resolvedType;
if (inMethod) {
methodAndTph.getTphs().add(resolvedTPH.getName());
if (inLocalOrParam)
if (inLocalOrParamOrReturn)
methodAndTph.getLocalTphs().add(resolvedTPH.getName());
}else {
tphsClass.add(resolvedTPH.getName());
}
allTPHS.put(resolvedTPH, inMethod);
resultSet.resolveType(tph).additionalGenerics.forEach(ag -> {
if (ag.contains(resolvedTPH) && ag.TA1.equals(resolvedTPH) && !contains(allPairs, ag)) {
allTPHS.put(resolvedTPH.getName(), inMethod);
// final List<TPHConstraint> cons = new ArrayList<>();
// resultSet.resolveType(tph).additionalGenerics.forEach(ag -> {
// TPHConstraint con = new ExtendsConstraint(ag.TA1.getName(), ag.TA2.getName(), Relation.EXTENDS);
// cons.add(con);
// });
//
// Map<TPHConstraint, Boolean> visitMap = new HashMap<>();
// for(TPHConstraint cc : cons) {
// visitMap.put(cc, false);
// }
//
// String left = resolvedTPH.getName();
// for (TPHConstraint cc : visitMap.keySet()) {
//
// if(visitMap.get(cc))
// continue;
//
// if (cc.getLeft().equals(left)) {
// allCons.add(cc);
// List<TPHConstraint> toVisit = getToVisitCons(cons,cc.getRight(), visitMap);
// }
// }
//resultSet.resolveType(tph).getAdditionalGenerics().forEach(ag -> {
resultSet.genIns.forEach(ag -> {
// if (ag.contains(resolvedTPH) /* && ag.TA1.equals(resolvedTPH) */ && !contains(allPairs, ag)) {
if (inMethod)
methodAndTph.getPairs().add(ag);
allPairs.add(ag);
TPHConstraint con = new ExtendsConstraint(ag.TA1.getName(), ag.TA2.getName(), Relation.EXTENDS);
allCons.add(con);
}
TPHConstraint con = new ExtendsConstraint(ag.getLeft().getName(), ag.getRight().getName());
if(!containsConstraint(allCons,con))
allCons.add(con);
// }
});
} else if (resultSet.resolveType(tph).resolvedType instanceof RefType) {
RefType rt = (RefType) resultSet.resolveType(tph).resolvedType;
rt.accept(this);
}
}
private static boolean containsConstraint(ArrayList<TPHConstraint> allCons, TPHConstraint c) {
for(TPHConstraint con:allCons) {
if(c.getLeft().equals(con.getLeft()) && c.getRight().equals(con.getRight())) {
return true;
}
}
return false;
}
private List<TPHConstraint> getToVisitCons(List<TPHConstraint> cons, String right, Map<TPHConstraint, Boolean> visitMap) {
List<TPHConstraint> res = new ArrayList<>();
for(TPHConstraint cc : cons) {
if(cc.getLeft().equals(right)) {
res.add(cc);
if(visitMap.get(cc))
visitMap.replace(cc, false);
}
}
return res;
}
@Override
public void visit(GenericRefType genericRefType) {
String name = genericRefType.getParsedName();
if (inMethod) {
methodAndTph.getTphs().add(name);
if (inLocalOrParamOrReturn)
methodAndTph.getLocalTphs().add(name);
}else {
tphsClass.add(name);
}
allTPHS.put(name, inMethod);
}
private boolean contains(ArrayList<GenericInsertPair> pairs, GenericInsertPair genPair) {
for (int i = 0; i < pairs.size(); ++i) {
GenericInsertPair p = pairs.get(i);
@ -83,8 +174,17 @@ public class TPHExtractor extends AbstractASTWalker {
@Override
public void visit(Method method) {
inMethod = true;
methodAndTph = new MethodAndTPH(method.name);
super.visit(method);
String id = MethodUtility.createID(resolver,method);
methodAndTph = new MethodAndTPH(id);
inLocalOrParamOrReturn = true;
method.getReturnType().accept(this);
method.getParameterList().accept(this);
inLocalOrParamOrReturn = false;
if(method.block != null)
method.block.accept(this);
inMethod = false;
ListOfMethodsAndTph.add(methodAndTph);
}
@ -92,29 +192,32 @@ public class TPHExtractor extends AbstractASTWalker {
@Override
public void visit(Constructor cons) {
inMethod = false;
super.visit(cons);
//super.visit(cons);
cons.getParameterList().accept(this);
if(cons.block != null)
cons.block.accept(this);
inMethod = true;
}
@Override
public void visit(LocalVarDecl localVarDecl) {
inLocalOrParam = true;
// inLocalOrParamOrReturn = inMethod;
super.visit(localVarDecl);
inLocalOrParam = false;
// inLocalOrParamOrReturn = false;
}
@Override
public void visit(LocalVar localVar) {
inLocalOrParam = true;
// inLocalOrParamOrReturn = inMethod;
super.visit(localVar);
inLocalOrParam = false;
// inLocalOrParamOrReturn = false;
}
@Override
public void visit(ParameterList formalParameters) {
inLocalOrParam = true;
inLocalOrParamOrReturn = inMethod;
super.visit(formalParameters);
inLocalOrParam = false;
inLocalOrParamOrReturn = false;
}
}

@ -2,8 +2,8 @@ package de.dhbwstuttgart.bytecode.constraint;
public class EqualConstraint extends TPHConstraint {
public EqualConstraint(String left, String right, Relation rel) {
super(left, right, rel);
public EqualConstraint(String left, String right) {
super(left, right, Relation.EQUAL);
}
}

@ -2,8 +2,8 @@ package de.dhbwstuttgart.bytecode.constraint;
public class ExtendsConstraint extends TPHConstraint {
public ExtendsConstraint(String left, String right, Relation rel) {
super(left, right, rel);
public ExtendsConstraint(String left, String right) {
super(left, right, Relation.EXTENDS);
}
}

@ -44,6 +44,10 @@ public class TPHConstraint {
return left.equals(tph)||right.equals(tph);
}
public boolean equalConstraint(TPHConstraint constraint) {
return rel == constraint.getRel() && left.equals(constraint.getLeft()) && right.equals(constraint.getRight());
}
@Override
public String toString() {
if(rel == Relation.EXTENDS) {

@ -1,30 +1,29 @@
package de.dhbwstuttgart.bytecode.descriptor;
import java.util.HashMap;
import java.util.Iterator;
import de.dhbwstuttgart.bytecode.utilities.*;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
import org.objectweb.asm.Type;
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
import de.dhbwstuttgart.bytecode.utilities.Lambda;
import de.dhbwstuttgart.bytecode.utilities.MethodFromMethodCall;
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
import de.dhbwstuttgart.bytecode.utilities.SamMethod;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.statement.Expression;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.typeinference.result.ResultSet;
public class DescriptorToString implements DescriptorVisitor{
public class DescriptorToString implements DescriptorVisitor, CONSTANTS {
ResultSet resultSet;
public DescriptorToString() {
}
public DescriptorToString(ResultSet resultSet) {
this.resultSet = resultSet;
}
private String addReturnType(String desc, RefTypeOrTPHOrWildcardOrGeneric returnType, ResultSet resultSet) {
if(resultSet.resolveType(returnType).resolvedType.toString().equals("void")){
if(resultSet.resolveType(returnType).resolvedType.toString().equals(CONSTANTS.VOID)){
desc = desc + ")V";
}else {
desc = desc + ")" + "L"+resultSet.resolveType(returnType).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
@ -44,30 +43,41 @@ public class DescriptorToString implements DescriptorVisitor{
if(method.hasGen()) {
String fpDesc = fp.getType().acceptTV(new TypeToDescriptor());
if(method.getGenericsAndBoundsMethod().containsKey(fpDesc)) {
desc += "L"+method.getGenericsAndBoundsMethod().get(fpDesc)+ ";";
String bound = getBound(fpDesc, method.getGenericsAndBoundsMethod());
desc += "L"+bound+ ";";
}else if(method.getGenericsAndBounds().containsKey(fpDesc)){
desc += "L"+method.getGenericsAndBounds().get(fpDesc)+ ";";
String bound = getBound(fpDesc, method.getGenericsAndBounds());
desc += "L"+bound+ ";";
}else {
// desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
String resType = resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor());
if(resType.subSequence(0, 4).equals("TPH ")) {
if(resType.contains(CONSTANTS.TPH)/*resType.subSequence(0, 4).equals("TPH ")*/) {
// Bound ist immer Object
desc += "L"+Type.getInternalName(Object.class)+ ";";
} else {
desc += "L"+resType+ ";";
// TODO::
if(method.getGenericsAndBounds().containsKey(resType)) {
String bound = getBound(resType, method.getGenericsAndBounds());
desc += "L"+bound+ ";";
}else if(method.getGenericsAndBoundsMethod().containsKey(resType)) {
String bound = getBound(resType, method.getGenericsAndBoundsMethod());
desc += "L"+bound+ ";";
} else {
desc += "L"+resType+ ";";
}
}
}
}
//TODO: generate a class java%% ... %%
else if(resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor()).contains("<")){
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "$$").replace("<", "$$$").replace(">", "$$$")+ ";";
else if(resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor()).contains(CONSTANTS.ANGLEBRACKET)){
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.toString().replace(".", "$$").replace(CONSTANTS.ANGLEBRACKET, "$$$").replace(">", "$$$")+ ";";
}
else {
desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
}
}
if(resultSet.resolveType(method.getReturnType()).resolvedType.toString().equals("void")) {
if(resultSet.resolveType(method.getReturnType()).resolvedType.toString().equals(CONSTANTS.VOID)) {
desc += ")V";
}else {
if(method.hasGen()) {
@ -78,11 +88,21 @@ public class DescriptorToString implements DescriptorVisitor{
desc += ")L"+method.getGenericsAndBounds().get(ret)+ ";";
}else {
String resType = resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
if(resType.subSequence(0, 4).equals("TPH ")) {
if(resType.contains(CONSTANTS.TPH)/*resType.subSequence(0, 4).equals("TPH ")*/) {
// desc += ")" + "L"+method.getGenericsAndBoundsMethod().get(resType.substring(4)+"$")+ ";";
desc += ")" + "L"+Type.getInternalName(Object.class)+ ";";
} else {
desc += ")" + "L"+resType+ ";";
// TODO::
if(method.getGenericsAndBounds().containsKey(resType)) {
String bound = getBound(resType, method.getGenericsAndBounds());
desc += ")L"+bound+ ";";
}else if(method.getGenericsAndBoundsMethod().containsKey(resType)) {
String bound = getBound(resType, method.getGenericsAndBoundsMethod());
desc += ")L"+bound+ ";";
} else {
desc += ")L"+resType+ ";";
}
// desc += ")" + "L"+resType+ ";";
}
}
}else {
@ -93,6 +113,15 @@ public class DescriptorToString implements DescriptorVisitor{
return desc;
}
private String getBound(String fpDesc, HashMap<String, String> genericsAndBounds) {
String start = genericsAndBounds.get(fpDesc);
while(genericsAndBounds.containsKey(start)) {
start = genericsAndBounds.get(start);
}
return start;
}
@Override
public String visit(NormalConstructor constructor) {
String desc = "(";
@ -108,7 +137,7 @@ public class DescriptorToString implements DescriptorVisitor{
}else {
// desc += "L"+resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor())+ ";";
String resType = resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor());
if(resType.subSequence(0, 4).equals("TPH ")) {
if(resType.subSequence(0, 4).equals(CONSTANTS.TPH)) {
// Bound ist immer Object
desc += "L"+Type.getInternalName(Object.class)+ ";";
} else {
@ -131,7 +160,7 @@ public class DescriptorToString implements DescriptorVisitor{
while(itr.hasNext()) {
FormalParameter fp = itr.next();
String d = resultSet.resolveType(fp.getType()).resolvedType.acceptTV(new TypeToDescriptor());
if(d.substring(0, 4).equals("TPH ") ||d.contains("<")) {
if(d.contains(CONSTANTS.TPH) ||d.contains(CONSTANTS.ANGLEBRACKET)) {
desc += "L"+Type.getInternalName(Object.class)+ ";";
}else {
desc = desc + "L"+ d + ";";
@ -140,7 +169,7 @@ public class DescriptorToString implements DescriptorVisitor{
String retType = resultSet.resolveType(lambdaExpression.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<")){
if(retType.contains(CONSTANTS.TPH)|| retType.contains(CONSTANTS.ANGLEBRACKET)){
desc += ")L"+Type.getInternalName(Object.class)+ ";";
}else {
desc = desc + ")"+"L"+retType+";";
@ -156,7 +185,7 @@ public class DescriptorToString implements DescriptorVisitor{
RefTypeOrTPHOrWildcardOrGeneric rt = itr.next();
String d = resultSet.resolveType(rt).resolvedType.acceptTV(new TypeToDescriptor());
if(d.substring(0, 4).equals("TPH ") ||d.contains("<")) {
if(d.contains(CONSTANTS.TPH) ||d.contains(CONSTANTS.ANGLEBRACKET)) {
desc += "L"+Type.getInternalName(Object.class)+ ";";
}else {
desc += "L"+ d + ";";
@ -165,7 +194,7 @@ public class DescriptorToString implements DescriptorVisitor{
}
String retType = resultSet.resolveType(samMethod.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<")){
if(retType.contains(CONSTANTS.TPH)|| retType.contains(CONSTANTS.ANGLEBRACKET)){
desc += ")L"+Type.getInternalName(Object.class)+ ";";
}else {
desc = desc + ")"+"L"+retType+";";
@ -179,7 +208,7 @@ public class DescriptorToString implements DescriptorVisitor{
for(Expression e : methodFromMethodCall.getArgList().getArguments()) {
String d = resultSet.resolveType(e.getType()).resolvedType.acceptTV(new TypeToDescriptor());
if(d.substring(0, 4).equals("TPH ") ||d.contains("<") || methodFromMethodCall.getReceiverName().contains("$$")) {
if(d.contains(CONSTANTS.TPH) ||d.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")) {
desc += "L"+Type.getInternalName(Object.class)+ ";";
}else {
if(methodFromMethodCall.getGenericsAndBoundsMethod().containsKey(d)) {
@ -194,9 +223,9 @@ public class DescriptorToString implements DescriptorVisitor{
}
String retType = resultSet.resolveType(methodFromMethodCall.getReturnType()).resolvedType.acceptTV(new TypeToDescriptor());
System.out.println("DescriptorToString retType = " + retType);
if(retType.equals("void")) {
if(retType.equals(CONSTANTS.VOID)) {
desc += ")V";
}else if(retType.substring(0, 4).equals("TPH ")|| retType.contains("<") || methodFromMethodCall.getReceiverName().contains("$$")){
}else if(retType.contains(CONSTANTS.TPH)|| retType.contains(CONSTANTS.ANGLEBRACKET) || methodFromMethodCall.getReceiverName().contains("$$")){
desc += ")L"+Type.getInternalName(Object.class)+ ";";
}else {
if(methodFromMethodCall.getGenericsAndBoundsMethod().containsKey(retType)) {
@ -210,5 +239,21 @@ public class DescriptorToString implements DescriptorVisitor{
// desc = addReturnType(desc, methodFromMethodCall.getReturnType(), resultSet);
return desc;
}
@Override
public String createDescForFunN(ArgumentList argumentList, String returnType) {
Iterator<Expression> itr1 = argumentList.getArguments().iterator();
String methDesc = "(";
while(itr1.hasNext()) {
methDesc += "L" + Type.getInternalName(Object.class) + ";";
itr1.next();
}
if (returnType.equals(CONSTANTS.VOID)){
methDesc += ")V";
} else {
methDesc += ")L" + Type.getInternalName(Object.class) + ";";
}
return methDesc;
}
}

@ -5,11 +5,13 @@ import de.dhbwstuttgart.bytecode.utilities.MethodFromMethodCall;
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
import de.dhbwstuttgart.bytecode.utilities.SamMethod;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
public interface DescriptorVisitor {
public String visit(NormalMethod method);
public String visit(NormalConstructor constructor);
public String visit(Lambda lambdaExpression);
public String visit(SamMethod samMethod);
public String visit(MethodFromMethodCall methodFromMethodCall);
String visit(NormalMethod method);
String visit(NormalConstructor constructor);
String visit(Lambda lambdaExpression);
String visit(SamMethod samMethod);
String visit(MethodFromMethodCall methodFromMethodCall);
String createDescForFunN(ArgumentList argumentList, String returnType);
}

@ -0,0 +1,53 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGenerator;
import java.util.List;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.NameReplacementResult;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
/**
* This class represents the result of the constraints simplifier.
*
* @author fayez
*
*/
public class ConstraintsSimplierResult {
private List<GenericsGeneratorResult> genericsGenResults;
private List<NameReplacementResult> nameReplacementResults;
/**
* @param genericsGenResults
*/
public ConstraintsSimplierResult(List<GenericsGeneratorResult> genericsGenResults,
List<NameReplacementResult> nameReplacementResults) {
this.genericsGenResults = genericsGenResults;
this.setNameReplacementResults(nameReplacementResults);
}
/**
* @return the genericsGenResults
*/
public List<GenericsGeneratorResult> getGenericsGenResults() {
return genericsGenResults;
}
/**
* @param genericsGenResults the genericsGenResults to set
*/
public void setGenericsGenResults(List<GenericsGeneratorResult> genericsGenResults) {
this.genericsGenResults = genericsGenResults;
}
/**
* @return the nameReplacementResults
*/
public List<NameReplacementResult> getNameReplacementResults() {
return nameReplacementResults;
}
/**
* @param nameReplacementResults the nameReplacementResults to set
*/
public void setNameReplacementResults(List<NameReplacementResult> nameReplacementResults) {
this.nameReplacementResults = nameReplacementResults;
}
}

@ -0,0 +1,137 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGenerator;
import java.util.*;
import de.dhbwstuttgart.bytecode.TPHExtractor;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.*;
/**
* @author fayez
*
*/
public class ConstraintsSimplifier {
public static ConstraintsSimplierResult simplifyConstraints(final TPHExtractor tphExtractor, final List<GenericsGeneratorResult> genericsGeneratorResults, final List<String> tphsClass) {
List<TPHConstraint> allCons = tphExtractor.allCons;
List<TPHConstraint> equalCons = new ArrayList<>();
/* Step 1 */
List<ConstraintsWithSameLeftSide> foundCons = GenericsGeneratorUtility.findConstraintsWithLeftSameLeftSide(allCons);
if(!foundCons.isEmpty()) {
List<TPHConstraint> equalCons2 = new ArrayList<>();
GenericsGeneratorUtility.simplifyConstraintsWithSameLeftSide(foundCons,tphExtractor,tphsClass,equalCons2);
equalCons.addAll(equalCons2);
}
// if(!simpleCycles.isEmpty()) {
// handleSimpleCycles(allCons, simpleCycles,tphExtractor);
// equalCons.addAll(GenericsGeneratorUtility.getEqualConstraints(allCons));
// }
//
List<Cycle> cycles = findCycles(allCons);
if(!cycles.isEmpty()) {
handleCycle(genericsGeneratorResults, allCons, cycles,tphExtractor);
}
/* The right hand side of equal constraint is the new name in name replacement result */
List<NameReplacementResult> nameReplacementResults = GenericsGeneratorUtility.createNameReplacementResultsFromEqualConstraints(equalCons);
getEqualsFromNameReplacementResults(genericsGeneratorResults,nameReplacementResults);
ConstraintsSimplierResult result = new ConstraintsSimplierResult(genericsGeneratorResults, nameReplacementResults);
return result;
}
private static void getEqualsFromNameReplacementResults(List<GenericsGeneratorResult> genericsGeneratorResults,
List<NameReplacementResult> nameReplacementResults) {
genericsGeneratorResults.forEach(g->{
String tph = g.getConstraint().getLeft();
if (!nameReplacementResults.isEmpty()) {
collectAllEquals(nameReplacementResults, g, tph);
}
if (!nameReplacementResults.isEmpty()) {
collectAllEquals(nameReplacementResults, g);
}
});
}
private static void collectAllEquals(List<NameReplacementResult> nameReplacementResults, GenericsGeneratorResult g) {
Set<String> equalsTPHs = g.getEqualsTPHs();
Set<String> tphsToAdd = getAllEqualTphs(equalsTPHs, nameReplacementResults);
while (!tphsToAdd.isEmpty()){
equalsTPHs.addAll(tphsToAdd);
tphsToAdd = getAllEqualTphs(equalsTPHs, nameReplacementResults);
}
}
private static Set<String> getAllEqualTphs(Set<String> equalsTPHs, List<NameReplacementResult> nameReplacementResults) {
Set<String> tphsToAdd = new HashSet<>();
equalsTPHs.forEach(e->{
collectAllEquals(nameReplacementResults, tphsToAdd,e);
});
return tphsToAdd;
}
public static void collectAllEquals(List<NameReplacementResult> nameReplacementResults, Set<String> tphsToAdd,
String tph) {
List<NameReplacementResult> toRemoveList = new ArrayList<>();
Optional<NameReplacementResult> nameReplacementResult = nameReplacementResults.stream().filter(n->n.getName().equals(tph)).findFirst();
nameReplacementResult.ifPresent(toRemove->{
tphsToAdd.addAll(toRemove.getOldNames());
toRemoveList.add(toRemove);
});
if(!toRemoveList.isEmpty()){
nameReplacementResults.remove(toRemoveList.get(0));
toRemoveList.clear();
}
}
/**
* @param nameReplacementResults
* @param g
* @param tph
*/
public static void collectAllEquals(List<NameReplacementResult> nameReplacementResults, GenericsGeneratorResult g,
String tph) {
List<NameReplacementResult> toRemoveList = new ArrayList<>();
Optional<NameReplacementResult> nameReplacementResult = nameReplacementResults.stream().filter(n->n.getName().equals(tph)).findFirst();
nameReplacementResult.ifPresent(toRemove->{
g.getEqualsTPHs().addAll(toRemove.getOldNames());
toRemoveList.add(toRemove);
});
if(!toRemoveList.isEmpty()){
nameReplacementResults.remove(toRemoveList.get(0));
toRemoveList.clear();
}
}
/**
* @param genericsGeneratorResults
* @param allCons
* @param cycles
* @param tphExtractor
*/
public static void handleCycle(List<GenericsGeneratorResult> genericsGeneratorResults,
List<TPHConstraint> allCons, List<Cycle> cycles, TPHExtractor tphExtractor) {
GenericsGeneratorUtility.modifyRelationForConstraintsInCycle(cycles);
List<NameReplacementResult> nameReplacementResults = GenericsGeneratorUtility.substituteTPHSFormCycle(allCons, cycles,tphExtractor);
GenericsGeneratorUtility.createResults(genericsGeneratorResults,nameReplacementResults);
GenericsGeneratorUtility.removeEqualConstraints(allCons);
}
/**
* @param allCons
* @return
*/
public static List<Cycle> findCycles(List<TPHConstraint> allCons) {
/* find all cycles */
CyclesFinder cyclesFinder = new CyclesFinder(allCons);
List<Cycle> cycles = cyclesFinder.findCycles();
return cycles;
}
}

@ -0,0 +1,106 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGenerator;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.Cycle;
/**
* @author fayez
*
*/
public class CyclesFinder {
private final List<TPHConstraint> allCons;
public CyclesFinder(List<TPHConstraint> allCons) {
this.allCons = allCons;
}
public List<Cycle> findCycles() {
List<TPHConstraint> vistedConstraints = new ArrayList<>(allCons.size());
List<Cycle> cycles = new ArrayList<>();
for (TPHConstraint constraint : allCons) {
if(constraint.getRel()==Relation.EQUAL)
continue;
if (!vistedConstraints.contains(constraint)) {
vistedConstraints.add(constraint);
checkConstraint(constraint, vistedConstraints, cycles);
}
}
return cycles;
}
private void checkConstraint(TPHConstraint constraint, List<TPHConstraint> vistedConstraints,
List<Cycle> cycles) {
List<String> tphsInRelation = new LinkedList<>();
List<TPHConstraint> maybeCycle = new ArrayList<>();
maybeCycle.add(constraint);
tphsInRelation.add(constraint.getLeft());
tphsInRelation.add(constraint.getRight());
Optional<TPHConstraint> nextConstraint = getConstraintInRelation(tphsInRelation, maybeCycle);
while (nextConstraint.isPresent()) {
if(containsInLongCycle(nextConstraint.get(), cycles)) {
break;
}
if (isCycle(tphsInRelation)) {
addAllToVisitedConstraints(vistedConstraints, maybeCycle);
Cycle cycle = new Cycle(maybeCycle);
cycles.add(cycle);
return;
}
nextConstraint = getConstraintInRelation(tphsInRelation, maybeCycle);
}
// addAllToVisitedConstraints(vistedConstraints, maybeCycle);
}
private boolean containsInLongCycle(TPHConstraint c, List<Cycle> cycles) {
for(Cycle cycle : cycles) {
if(cycle.containConstraint(c))
return true;
}
return false;
}
private void addAllToVisitedConstraints(List<TPHConstraint> vistedConstraints, List<TPHConstraint> maybeCycle) {
for (TPHConstraint con : maybeCycle) {
if (!vistedConstraints.contains(con))
vistedConstraints.add(con);
}
}
private Optional<TPHConstraint> getConstraintInRelation(List<String> tphsInRelation,
List<TPHConstraint> maybeCycle) {
TPHConstraint constraint = getConstraintByLeftSide(tphsInRelation.get(tphsInRelation.size()-1),maybeCycle);
Optional<TPHConstraint> nextConstraint = Optional.ofNullable(constraint);
if(nextConstraint.isPresent()) {
maybeCycle.add(constraint);
tphsInRelation.add(constraint.getRight());
}
return nextConstraint;
}
private TPHConstraint getConstraintByLeftSide(String left, List<TPHConstraint> maybeCycle) {
for(TPHConstraint constraint : allCons) {
if(constraint.getRel()==Relation.EQUAL)
continue;
if(maybeCycle.contains(constraint))
continue;
if(constraint.getLeft().equals(left))
return constraint;
}
return null;
}
private boolean isCycle(List<String> tphsInRelation) {
return tphsInRelation.get(0).equals(tphsInRelation.get(tphsInRelation.size() - 1));
}
}

@ -0,0 +1,674 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGenerator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import de.dhbwstuttgart.bytecode.TPHExtractor;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.MethodAndConstraints;
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
import de.dhbwstuttgart.bytecode.utilities.Resolver;
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.Field;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.GenericDeclarationList;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
import de.dhbwstuttgart.syntaxtree.SourceFile;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
import de.dhbwstuttgart.syntaxtree.statement.Assign;
import de.dhbwstuttgart.syntaxtree.statement.AssignToField;
import de.dhbwstuttgart.syntaxtree.statement.BinaryExpr;
import de.dhbwstuttgart.syntaxtree.statement.Block;
import de.dhbwstuttgart.syntaxtree.statement.CastExpr;
import de.dhbwstuttgart.syntaxtree.statement.DoStmt;
import de.dhbwstuttgart.syntaxtree.statement.EmptyStmt;
import de.dhbwstuttgart.syntaxtree.statement.ExpressionReceiver;
import de.dhbwstuttgart.syntaxtree.statement.FieldVar;
import de.dhbwstuttgart.syntaxtree.statement.ForStmt;
import de.dhbwstuttgart.syntaxtree.statement.IfStmt;
import de.dhbwstuttgart.syntaxtree.statement.InstanceOf;
import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression;
import de.dhbwstuttgart.syntaxtree.statement.Literal;
import de.dhbwstuttgart.syntaxtree.statement.LocalVar;
import de.dhbwstuttgart.syntaxtree.statement.LocalVarDecl;
import de.dhbwstuttgart.syntaxtree.statement.MethodCall;
import de.dhbwstuttgart.syntaxtree.statement.NewArray;
import de.dhbwstuttgart.syntaxtree.statement.NewClass;
import de.dhbwstuttgart.syntaxtree.statement.Return;
import de.dhbwstuttgart.syntaxtree.statement.ReturnVoid;
import de.dhbwstuttgart.syntaxtree.statement.StaticClassName;
import de.dhbwstuttgart.syntaxtree.statement.Super;
import de.dhbwstuttgart.syntaxtree.statement.SuperCall;
import de.dhbwstuttgart.syntaxtree.statement.This;
import de.dhbwstuttgart.syntaxtree.statement.UnaryExpr;
import de.dhbwstuttgart.syntaxtree.statement.WhileStmt;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.result.ResultSet;
/**
* @author fayez
*
*/
public class GeneratedGenericsFinder implements ASTVisitor {
private final TPHExtractor tphExtractor = new TPHExtractor();
private Collection<ResultSet> listOfResultSets;
private SourceFile sf;
private List<String> tphsClass;
private GenericGenratorResultForSourceFile generatedGenericsForSF;
private ResultSet resultSet;
private final List<String> methodNameAndParamsT = new ArrayList<>();
private String pkgName;
private String className;
private Resolver resolver;
/**
* @param sf
* @param listOfResultSets
*/
public GeneratedGenericsFinder(SourceFile sf, Collection<ResultSet> listOfResultSets) {
this.sf = sf;
this.listOfResultSets = listOfResultSets;
}
public GenericGenratorResultForSourceFile findGeneratedGenerics() {
sf.accept(this);
return generatedGenericsForSF;
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* SourceFile)
*/
@Override
public void visit(SourceFile sourceFile) {
pkgName = sf.getPkgName();
generatedGenericsForSF = new GenericGenratorResultForSourceFile(pkgName);
for (ClassOrInterface cl : sourceFile.getClasses()) {
cl.accept(this);
}
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* ClassOrInterface)
*/
@Override
public void visit(ClassOrInterface classOrInterface) {
className = classOrInterface.getClassName().toString();
List<ResultSet> listOfResultSetsList = new ArrayList<>(listOfResultSets);
boolean isVisited = false;
ConstraintsSimplierResult simplifiedConstraints = null;
GenericsGeneratorResultForClass ggResult = null;
for (int i = 0; i < listOfResultSetsList.size(); i++) {
resultSet = listOfResultSetsList.get(i);
tphExtractor.setResultSet(resultSet);
resolver = new Resolver(resultSet);
classOrInterface.accept(tphExtractor);
tphsClass = tphExtractor.tphsClass;
simplifiedConstraints = GenericsGenerator.simplifyConstraints(tphExtractor, tphsClass);
if(!isVisited) {
ggResult = GenericsGenerator.generateConstraints(className, tphExtractor, tphsClass,simplifiedConstraints);
isVisited = true;
}
for(Method m : classOrInterface.getMethods()) {
addMethodConstraints(simplifiedConstraints, ggResult, m);
}
if(ggResult != null)
generatedGenericsForSF.addGenericGeneratorResultClass(ggResult);
}
}
/**
* @param simplifiedConstraints
* @param ggResult
* @param m
*/
public void addMethodConstraints(ConstraintsSimplierResult simplifiedConstraints,
GenericsGeneratorResultForClass ggResult, Method m) {
String id = MethodUtility.createID(resolver, m);
boolean isInGGResult = (ggResult != null) && ggResult.contains(id);
if(methodNameAndParamsT.contains(id) || isInGGResult)
return;
methodNameAndParamsT.add(id);
Optional<MethodAndTPH> methodAndTPH = GenericsGeneratorUtility.getMethodAndTphs(tphExtractor.ListOfMethodsAndTph,id);
methodAndTPH.ifPresent(mt->{
MethodAndConstraints methodConstraints = GenericsGenerator.generateConstraintsForMethod(tphExtractor.allCons, mt , simplifiedConstraints, tphsClass);
ggResult.getMethodsAndTheirConstraints().getMethodsAndConstraints().add(methodConstraints);
});
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* Method)
*/
@Override
public void visit(Method method) {
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* ParameterList)
*/
@Override
public void visit(ParameterList formalParameters) {
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* Constructor)
*/
@Override
public void visit(Constructor field) {
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.ArgumentList)
*/
@Override
public void visit(ArgumentList argumentList) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.LambdaExpression)
*/
@Override
public void visit(LambdaExpression lambdaExpression) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.Assign)
*/
@Override
public void visit(Assign assign) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.BinaryExpr)
*/
@Override
public void visit(BinaryExpr binary) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.Block)
*/
@Override
public void visit(Block block) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.CastExpr)
*/
@Override
public void visit(CastExpr castExpr) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.EmptyStmt)
*/
@Override
public void visit(EmptyStmt emptyStmt) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.FieldVar)
*/
@Override
public void visit(FieldVar fieldVar) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.ForStmt)
*/
@Override
public void visit(ForStmt forStmt) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.IfStmt)
*/
@Override
public void visit(IfStmt ifStmt) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.InstanceOf)
*/
@Override
public void visit(InstanceOf instanceOf) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.LocalVar)
*/
@Override
public void visit(LocalVar localVar) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.LocalVarDecl)
*/
@Override
public void visit(LocalVarDecl localVarDecl) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.MethodCall)
*/
@Override
public void visit(MethodCall methodCall) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.NewClass)
*/
@Override
public void visit(NewClass methodCall) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.NewArray)
*/
@Override
public void visit(NewArray newArray) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.Return)
*/
@Override
public void visit(Return aReturn) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.ReturnVoid)
*/
@Override
public void visit(ReturnVoid aReturn) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.StaticClassName)
*/
@Override
public void visit(StaticClassName staticClassName) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.Super)
*/
@Override
public void visit(Super aSuper) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.This)
*/
@Override
public void visit(This aThis) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.WhileStmt)
*/
@Override
public void visit(WhileStmt whileStmt) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.DoStmt)
*/
@Override
public void visit(DoStmt whileStmt) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.AssignToField)
*/
@Override
public void visit(AssignToField assignLeftSide) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.parser.
* SyntaxTreeGenerator.AssignToLocal)
*/
@Override
public void visit(AssignToLocal assignLeftSide) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.SuperCall)
*/
@Override
public void visit(SuperCall superCall) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.ExpressionReceiver)
*/
@Override
public void visit(ExpressionReceiver expressionReceiver) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.UnaryExpr)
*/
@Override
public void visit(UnaryExpr unaryExpr) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see de.dhbwstuttgart.syntaxtree.StatementVisitor#visit(de.dhbwstuttgart.
* syntaxtree.statement.Literal)
*/
@Override
public void visit(Literal literal) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* GenericTypeVar)
*/
@Override
public void visit(GenericTypeVar genericTypeVar) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* FormalParameter)
*/
@Override
public void visit(FormalParameter formalParameter) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* GenericDeclarationList)
*/
@Override
public void visit(GenericDeclarationList genericTypeVars) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.
* Field)
*/
@Override
public void visit(Field field) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.type
* .RefType)
*/
@Override
public void visit(RefType refType) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.type
* .SuperWildcardType)
*/
@Override
public void visit(SuperWildcardType superWildcardType) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.type
* .TypePlaceholder)
*/
@Override
public void visit(TypePlaceholder typePlaceholder) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.type
* .ExtendsWildcardType)
*/
@Override
public void visit(ExtendsWildcardType extendsWildcardType) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* de.dhbwstuttgart.syntaxtree.ASTVisitor#visit(de.dhbwstuttgart.syntaxtree.type
* .GenericRefType)
*/
@Override
public void visit(GenericRefType genericRefType) {
// TODO Auto-generated method stub
}
}

@ -0,0 +1,255 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGenerator;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.*;
import org.objectweb.asm.Type;
import de.dhbwstuttgart.bytecode.TPHExtractor;
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
/**
* @author fayez
*
*/
public class GenericsGenerator {
/*TODO: When generating generics for a class if we have the following:
tphClass < tphMeth1 < tphMeth2
then we have to convert tphMeth1, tphMeth2 to tph class and generate the following
class constraints: tphClass < tphMeth1, tphMeth1 < tphMeth2, tphMeth2 < Object
*/
public static GenericsGeneratorResultForClass generateConstraints(final String className, final TPHExtractor tphExtractor,
final List<String> tphsClass, final ConstraintsSimplierResult simplifiedConstraints) {
List<GenericsGeneratorResult> classConstraints = generateConstraintsForClass(tphExtractor,
simplifiedConstraints, tphsClass);
// GenericGeneratorResultsForAllMethods methodsAndConstraints = generateConstraintsForAllMethods(tphExtractor,
// simplifiedConstraints, tphsClass);
GenericGeneratorResultsForAllMethods methodsAndConstraints = new GenericGeneratorResultsForAllMethods(new ArrayList<>());
return new GenericsGeneratorResultForClass(className, classConstraints, methodsAndConstraints);
}
/**
* @param tphExtractor
* @param tphsClass
* @return
*/
public static ConstraintsSimplierResult simplifyConstraints(final TPHExtractor tphExtractor,
final List<String> tphsClass) {
final List<GenericsGeneratorResult> genericsGeneratorResults = new ArrayList<>();
ConstraintsSimplierResult simplifiedConstraints = ConstraintsSimplifier.simplifyConstraints(tphExtractor,
genericsGeneratorResults, tphsClass);
return simplifiedConstraints;
}
private static List<GenericsGeneratorResult> generateConstraintsForClass(final TPHExtractor tphExtractor,
final ConstraintsSimplierResult simplifiedConstraints, final List<String> tphsClass) {
final List<GenericsGeneratorResult> constraints = new ArrayList<>();
if (tphsClass.isEmpty())
return constraints;
final List<TPHConstraint> allCons = tphExtractor.allCons;
final Set<String> visitedTPHs = new HashSet<>();
final List<String> methodTPHs = tphExtractor.ListOfMethodsAndTph.stream().map(m -> m.getLocalTphs())
.flatMap(l -> l.stream()).collect(Collectors.toList());
createConstraintsForClassTphs(simplifiedConstraints, tphsClass, constraints, allCons, visitedTPHs, methodTPHs);
GenericsGeneratorUtility.addTPHsToClassTPHs(constraints, tphsClass);
GenericsGeneratorUtility.removeClassTPHsFromMethodTPHs(tphsClass, tphExtractor);
generateGGConstraintsForTPH(tphsClass, constraints, simplifiedConstraints);
return constraints;
}
private static void createConstraintsForClassTphs(ConstraintsSimplierResult simplifiedConstraints, List<String> tphsClass, List<GenericsGeneratorResult> constraints, List<TPHConstraint> allCons, Set<String> visitedTPHs, List<String> methodTPHs) {
List<String> classAndMethodTphs = new ArrayList<>(tphsClass);
classAndMethodTphs.addAll(methodTPHs);
for (String tph : tphsClass) {
if (visitedTPHs.contains(tph))
continue;
final LinkedList<String> tphsInRel = GenericsGeneratorUtility
.createLinkedListForTPHsInRelationClass(allCons, tphsClass, methodTPHs, visitedTPHs, tph);
generateConstraintsForClassFromList(tphsInRel,simplifiedConstraints,classAndMethodTphs,constraints);
}
}
private static void generateConstraintsForClassFromList(LinkedList<String> tphsInRel, ConstraintsSimplierResult simplifiedConstraints, List<String> classAndMethodTphs, List<GenericsGeneratorResult> constraints) {
if(tphsInRel.isEmpty())
return;
List<GenericsGeneratorResult> resultConstraints = new ArrayList<>();
String subType = tphsInRel.getFirst();
String superType = GenericsGeneratorUtility.getNextClassTph(classAndMethodTphs, tphsInRel);
int idxOfSuper = tphsInRel.indexOf(superType);
int size = tphsInRel.size();
while (size > 2 && idxOfSuper < size-1){
GenericsGeneratorResult genericsGeneratorResult = getGenericsGeneratorResultForClass(simplifiedConstraints, subType, superType);
constraints.add(genericsGeneratorResult);
tphsInRel = new LinkedList<>(tphsInRel.subList(idxOfSuper, size));
subType = tphsInRel.getFirst();
superType = GenericsGeneratorUtility.getNextClassTph(classAndMethodTphs, tphsInRel);
idxOfSuper = tphsInRel.indexOf(superType);
size = tphsInRel.size();
}
GenericsGeneratorResult genericsGeneratorResult = getGenericsGeneratorResultForClass(simplifiedConstraints, subType, superType);
constraints.add(genericsGeneratorResult);
}
private static GenericsGeneratorResult getGenericsGeneratorResultForClass(ConstraintsSimplierResult simplifiedConstraints, String subType, String superType) {
TPHConstraint constraint = new ExtendsConstraint(subType, superType);
Set<String> equalSet = GenericsGeneratorUtility
.createEqualSet(simplifiedConstraints.getNameReplacementResults(), subType);
return new GenericsGeneratorResult(constraint, equalSet);
}
/* TODO Remove this methoda*/
private static GenericsGeneratorResult generateGGResultForClass(LinkedList<String> tphsInRel,
ConstraintsSimplierResult simplifiedConstraints, List<String> tphsClass) {
String subType = tphsInRel.getFirst();
String superType = GenericsGeneratorUtility.getNextClassTph(tphsClass, tphsInRel);
TPHConstraint constraint = new ExtendsConstraint(subType, superType);
Set<String> equalSet = GenericsGeneratorUtility
.createEqualSet(simplifiedConstraints.getNameReplacementResults(), subType);
return new GenericsGeneratorResult(constraint, equalSet);
}
private static GenericGeneratorResultsForAllMethods generateConstraintsForAllMethods(
final TPHExtractor tphExtractor, ConstraintsSimplierResult simplifiedConstraints, List<String> tphsClass) {
final List<MethodAndConstraints> methodsAndConstraints = new ArrayList<>();
final GenericGeneratorResultsForAllMethods results = new GenericGeneratorResultsForAllMethods(
methodsAndConstraints);
tphExtractor.ListOfMethodsAndTph.forEach(m -> {
MethodAndConstraints methAndCons = generateConstraintsForMethod(tphExtractor.allCons, m,
simplifiedConstraints, tphsClass);
methodsAndConstraints.add(methAndCons);
});
return results;
}
public static MethodAndConstraints generateConstraintsForMethod(final List<TPHConstraint> allCons,
final MethodAndTPH m, final ConstraintsSimplierResult simplifiedConstraints, List<String> tphsClass) {
final List<String> localTphs = m.getLocalTphs();
List<GenericsGeneratorResult> constraints = new ArrayList<>();
MethodAndConstraints result = new MethodAndConstraints(m.getId(), constraints);
if (localTphs.isEmpty())
return result;
if (localTphs.size() == 1 && tphsClass.isEmpty()) {
generateGGConstraintsForTPH(localTphs, constraints, simplifiedConstraints);
return result;
}
final Set<String> visitedTPHs = new HashSet<>();
for (String tph : localTphs) {
if (visitedTPHs.contains(tph))
continue;
final LinkedList<String> tphsInRel = GenericsGeneratorUtility.createLinkedListForTPHsInRelation(allCons,
localTphs, tphsClass, visitedTPHs, tph);
if (!tphsInRel.isEmpty()) {
GenericsGeneratorUtility.removeNotLocalTphs(tphsInRel, localTphs, tphsClass);
if (!GenericsGeneratorUtility.isInResult(tphsInRel.getFirst(), constraints)) {
GenericsGeneratorResult constraint = generateGGResult(tphsInRel, simplifiedConstraints);
constraints.add(constraint);
}
}
}
generateGGConstraintsForTPH(localTphs, constraints, simplifiedConstraints);
return result;
}
private static void generateGGConstraintsForTPH(List<String> localTphs,
final List<GenericsGeneratorResult> constraints, final ConstraintsSimplierResult simplifiedConstraints) {
localTphs.forEach(tph -> {
boolean isInSimplifiedConstraints = GenericsGeneratorUtility.isTPHInGenericGeneratorResult(simplifiedConstraints.getGenericsGenResults(), tph);
if (isInSimplifiedConstraints) {
GenericsGeneratorResult ggResult = GenericsGeneratorUtility.getGenericGeneratorResult(simplifiedConstraints.getGenericsGenResults(), tph).get();
// GenericsGeneratorUtility.removeGenericGeneratorResult(simplifiedConstraints.getGenericsGenResults(),ggResult);
constraints.add(ggResult);
} else {
boolean isInConstraints = GenericsGeneratorUtility.isTPHInGenericGeneratorResult(constraints, tph);
if (!isInConstraints) {
GenericsGeneratorResult ggResult = generateGGResult(tph, simplifiedConstraints.getNameReplacementResults());
constraints.add(ggResult);
}
}
});
}
private static GenericsGeneratorResult generateGGResult(String tph,
List<NameReplacementResult> nameReplacementResults) {
String superType = Type.getInternalName(Object.class);
TPHConstraint constraint = new ExtendsConstraint(tph, superType);
Set<String> equalSet = GenericsGeneratorUtility.createEqualSet(nameReplacementResults, tph);
return new GenericsGeneratorResult(constraint, equalSet);
}
private static GenericsGeneratorResult generateGGResult(final LinkedList<String> tphsInRel,
final ConstraintsSimplierResult simplifiedConstraints) {
String subType = tphsInRel.getFirst();
if (tphsInRel.size() == 1) {
Optional<GenericsGeneratorResult> constraintFromSimplifiedCon = simplifiedConstraints
.getGenericsGenResults().stream().filter(g -> g.getConstraint().getLeft().equals(subType))
.findFirst();
if (constraintFromSimplifiedCon.isPresent())
return constraintFromSimplifiedCon.get();
}
String superType = tphsInRel.size() > 1 ? tphsInRel.getLast() : Type.getInternalName(Object.class);
TPHConstraint constraint = new ExtendsConstraint(subType, superType);
Set<String> equalSet = GenericsGeneratorUtility
.createEqualSet(simplifiedConstraints.getNameReplacementResults(), subType);
return new GenericsGeneratorResult(constraint, equalSet);
}
}

@ -0,0 +1,571 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGenerator;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.*;
import org.objectweb.asm.Type;
import de.dhbwstuttgart.bytecode.TPHExtractor;
import de.dhbwstuttgart.bytecode.constraint.EqualConstraint;
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
import de.dhbwstuttgart.bytecode.utilities.ConstraintsFinder;
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
import de.dhbwstuttgart.bytecode.utilities.NameReplacer;
/**
* @author fayez
*
*/
public class GenericsGeneratorUtility {
/**
* Returns a list of type placeholders names of a specified method
*
* @param methodID The id of the method ReturnTypeMethodName(ParameterTypes)
* @param listOfMethodsAndTph List of all methods
* @return a list of type placehoders names
*/
public static List<String> getMethodTPHS(String methodID, ArrayList<MethodAndTPH> listOfMethodsAndTph) {
return listOfMethodsAndTph.stream().filter(mt->mt.getId().equals(methodID)).findAny().get().getTphs();
}
/**
* Returns a reverse constraint of a specified constraint which is given by its left and right
* side
*
* @param allCons List of all constraints
* @param left The left side of the given constraint
* @param right The right side of the given constraint
* @return An Optional object which contains the reverse constraint if it is exist
*/
public static Optional<TPHConstraint> getReverseConstraint(List<TPHConstraint> allCons, String left, String right) {
return allCons.stream().filter(c->{
return c.getRight().equals(left) && c.getLeft().equals(right);
}).findAny();
}
/**
* Substitutes the old name by the new name in all constraints
*
* @param allCons List of all constraints
* @param oldName The name to be replaced
* @param newName The new name
*/
public static void substituteTPH(List<TPHConstraint> allCons, String oldName, String newName) {
allCons.stream()
.filter(c->c.getRel()==Relation.EXTENDS)
.forEach(c->{
if(c.getLeft().equals(oldName))
c.setLeft(newName);
if(c.getRight().equals(oldName))
c.setRight(newName);
});
}
public static List<ConstraintsWithSameLeftSide> findConstraintsWithLeftSameLeftSide(List<TPHConstraint> allCons) {
// finder looks for constraints that have the same left hand side
// and put them in a list
ConstraintsFinder finder = new ConstraintsFinder(allCons);
List<ConstraintsWithSameLeftSide> foundCons = finder.findConstraints();
return foundCons;
}
public static void simplifyConstraintsWithSameLeftSide(List<ConstraintsWithSameLeftSide> consWithSameLeftSide,
List<TPHConstraint> allCons, List<String> methodTPHS) {
List<TPHConstraint> eqCons = new ArrayList<>();
for (ConstraintsWithSameLeftSide list : consWithSameLeftSide) {
NameReplacementResult replRes = modifyNames(allCons, methodTPHS, list);
createEqualConstraintsForNames(replRes.getName(), replRes.getOldNames(),eqCons);
for (TPHConstraint c : allCons) {
if (c.getRel() == Relation.EQUAL && replRes.getName().equals(c.getRight())) {
eqCons.add(c);
}
}
updateEqualCons(replRes, eqCons);
TPHConstraint c = list.getConstraints().get(0);
allCons.removeAll(list.getConstraints());
allCons.add(c);
}
}
public static void simplifyConstraintsWithSameLeftSide(List<ConstraintsWithSameLeftSide> consWithSameLeftSide,
TPHExtractor tphExtractor, List<String> tphsClass, List<TPHConstraint> equalCons) {
List<TPHConstraint> allCons = tphExtractor.allCons;
for (ConstraintsWithSameLeftSide list : consWithSameLeftSide) {
if(!stillWithSameLeftSide(list))
continue;
NameReplacementResult replRes = modifyNames(allCons, list, tphExtractor.ListOfMethodsAndTph,tphsClass);
createEqualConstraintsForNames(replRes.getName(), replRes.getOldNames(),equalCons);
for (TPHConstraint c : allCons) {
if (c.getRel() == Relation.EQUAL && replRes.getName().equals(c.getRight())) {
equalCons.add(c);
}
}
updateEqualCons(replRes, equalCons);
TPHConstraint c = list.getConstraints().get(0);
allCons.removeAll(list.getConstraints());
removeConstraintsWithSameLeftAndRightSide(allCons);
allCons.add(c);
removeDuplicate(allCons);
}
consWithSameLeftSide.clear();
consWithSameLeftSide = findConstraintsWithLeftSameLeftSide(allCons);
if(!consWithSameLeftSide.isEmpty())
simplifyConstraintsWithSameLeftSide(consWithSameLeftSide,tphExtractor,tphsClass,equalCons);
}
private static void removeDuplicate(List<TPHConstraint> allCons) {
List<TPHConstraint> visited = new ArrayList<>();
List<Integer> toRemove = new ArrayList<>();
checkForDuplicate(allCons, visited, toRemove);
removeConstraintsByIndex(allCons, toRemove);
}
private static void removeConstraintsByIndex(List<TPHConstraint> allCons, List<Integer> toRemove) {
for(int index : toRemove)
allCons.remove(index);
}
private static void checkForDuplicate(List<TPHConstraint> allCons, List<TPHConstraint> visited, List<Integer> toRemove) {
for(int i = 0;i<allCons.size();++i){
markConstraintIfDuplicate(allCons, visited, toRemove, i);
}
}
private static void markConstraintIfDuplicate(List<TPHConstraint> allCons, List<TPHConstraint> visited, List<Integer> toRemove, int i) {
TPHConstraint constraint = allCons.get(i);
if(containsInList(visited,constraint.getLeft(),constraint.getRight())){
toRemove.add(i);
} else {
visited.add(constraint);
}
}
private static boolean containsInList(List<TPHConstraint> allConstraints, String left, String right) {
for(TPHConstraint constraint : allConstraints)
if(constraint.getLeft().equals(left) && constraint.getRight().equals(right))
return true;
return false;
}
private static void addNewConstraintsWithSameLeftSide(ConstraintsWithSameLeftSide constraintsWithSameLeftSide, List<TPHConstraint> allCons) {
allCons.forEach(c->{
if (constraintsWithSameLeftSide.getConstraints().get(0).getLeft().equals(c.getLeft())){
if(!constraintsWithSameLeftSide.getConstraints().contains(c))
constraintsWithSameLeftSide.getConstraints().add(c);
}
});
}
private static void checkForNewConstraintsWithSameLeftSide(List<ConstraintsWithSameLeftSide> consWithSameLeftSide, List<TPHConstraint> allCons) {
allCons.forEach(c->{
Optional<ConstraintsWithSameLeftSide> constraintsWithSameLeftSide = getConstraintsWithSameLeftSide(consWithSameLeftSide, c.getLeft());
constraintsWithSameLeftSide.ifPresent(cls->{
if(!cls.getConstraints().contains(c))
cls.getConstraints().add(c);
});
});
}
private static Optional<ConstraintsWithSameLeftSide> getConstraintsWithSameLeftSide(List<ConstraintsWithSameLeftSide> consWithSameLeftSide, String left) {
return consWithSameLeftSide.stream().filter(csl->isContainedInConsWithLeftSide(csl,left)).findAny();
}
private static boolean isContainedInConsWithLeftSide(ConstraintsWithSameLeftSide csl, String left) {
return csl.getConstraints().get(0).getLeft().equals(left);
}
private static boolean stillWithSameLeftSide(ConstraintsWithSameLeftSide constraints) {
removeUnvalidConstraints(constraints);
return constraints.getConstraints().size()>1;
}
private static void removeUnvalidConstraints(ConstraintsWithSameLeftSide constraints) {
List<TPHConstraint> toRemove = new ArrayList<>();
constraints.getConstraints().forEach(c->{
if(c.getLeft().equals(c.getRight()))
toRemove.add(c);
});
if(!toRemove.isEmpty())
constraints.getConstraints().removeAll(toRemove);
}
private static void removeConstraintsWithSameLeftAndRightSide(List<TPHConstraint> allCons) {
List<TPHConstraint> toRemove = new ArrayList<>();
allCons.forEach(c->{
if(c.getLeft().equals(c.getRight()))
toRemove.add(c);
});
allCons.removeAll(toRemove);
}
private static void createEqualConstraintsForNames(String name, List<String> equalNames, List<TPHConstraint> eqCons) {
// create an equal constraint for each value in repres
for (String eName : equalNames) {
EqualConstraint ec = new EqualConstraint(eName, name);
eqCons.add(ec);
}
}
/**
* @param allCons
* @param methodTPHS
* @param list
* @return
*/
public static NameReplacementResult modifyNames(List<TPHConstraint> allCons, List<String> methodTPHS,
ConstraintsWithSameLeftSide list) {
// generate a new name and replace the right hand side for each constraint
// in list with the new name
NameReplacer replacer = new NameReplacer(list.getConstraints(), allCons, methodTPHS);
// new name -> [all old names]
NameReplacementResult replRes = replacer.replaceNames();
return replRes;
}
public static NameReplacementResult modifyNames(List<TPHConstraint> allCons, ConstraintsWithSameLeftSide list, List<MethodAndTPH> methodAndTPHs, List<String> tphsClass) {
// generate a new name and replace the right hand side for each constraint
// in list with the new name
NameReplacer replacer = new NameReplacer(list.getConstraints(), allCons, methodAndTPHs, tphsClass);
// new name -> [all old names]
NameReplacementResult replRes = replacer.replaceNames();
return replRes;
}
public static void updateEqualCons(NameReplacementResult nameReplacementResult, List<TPHConstraint> eqCons) {
List<String> oldNames = nameReplacementResult.getOldNames();
String newName = nameReplacementResult.getName();
for (TPHConstraint c : eqCons) {
// if(oldNames.contains(c.getLeft()))
// c.setLeft(newName);
if (oldNames.contains(c.getRight()))
c.setRight(newName);
}
}
public static void modifyRelationForConstraintsInCycle(List<Cycle> cycles) {
cycles.stream().map(lc->lc.getConstraints()).flatMap(e->e.stream()).forEach(c->c.setRel(Relation.EQUAL));
}
public static List<NameReplacementResult> substituteTPHSFormCycle(List<TPHConstraint> allCons, List<Cycle> cycles, TPHExtractor tphExtractor) {
List<NameReplacementResult> results = new ArrayList<>();
cycles.forEach(lc->{
Set<String> names = getNamesFromCycle(lc);
String newName = names.stream().findFirst().get();
List<String> equalNames = new ArrayList<>(names);
Stream<ArrayList<String>> tphsOfMethods = tphExtractor.ListOfMethodsAndTph.stream().map(m->m.getTphs());
Stream<ArrayList<String>> localTphsOfMethods = tphExtractor.ListOfMethodsAndTph.stream().map(m->m.getLocalTphs());
replaceOldNames(newName, equalNames, tphsOfMethods);
replaceOldNames(newName, equalNames, localTphsOfMethods);
NameReplacementResult res = new NameReplacementResult(newName, equalNames);
results.add(res);
substituteAll(allCons,names,newName);
});
return results;
}
/**
* @param newName
* @param names
* @param tphsOfMethods
*/
public static void replaceOldNames(final String newName, final List<String> names, Stream<ArrayList<String>> tphsOfMethods) {
tphsOfMethods.forEach(tphsMethod->{
if(tphsMethod.removeAll(names))
tphsMethod.add(newName);
});
}
public static void substituteAll(List<TPHConstraint> allCons, Set<String> names, String newName) {
allCons.stream()
.filter(c-> c.getRel()==Relation.EXTENDS)
.forEach(c->{
if(names.contains(c.getLeft())) {
c.setLeft(newName);
} else if(names.contains(c.getRight())) {
c.setRight(newName);
}
});
}
public static Set<String> getNamesFromCycle(Cycle lc) {
Set<String> names = new HashSet<>();
lc.getConstraints().forEach(c->names.add(c.getLeft()));
return names;
}
public static void createResults(List<GenericsGeneratorResult> genericsGeneratorResults,
List<NameReplacementResult> nameReplacementResults) {
nameReplacementResults.forEach(n->{
Set<String> equals = new HashSet<>(n.getOldNames());
TPHConstraint cons = new ExtendsConstraint(n.getName(), Type.getInternalName(Object.class));
GenericsGeneratorResult ggRes = new GenericsGeneratorResult(cons, equals);
genericsGeneratorResults.add(ggRes);
});
}
public static void removeEqualConstraints(List<TPHConstraint> allCons) {
List<TPHConstraint> equalConstraints = getEqualConstraints(allCons);
allCons.removeAll(equalConstraints);
}
public static List<TPHConstraint> getEqualConstraints(List<TPHConstraint> allCons) {
return allCons.stream().filter(c->c.getRel()==Relation.EQUAL).collect(Collectors.toList());
}
public static List<NameReplacementResult> createNameReplacementResultsFromEqualConstraints(
List<TPHConstraint> equalCons) {
List<NameReplacementResult> nameReplacementResults = new ArrayList<>();
equalCons.forEach(c->{
if(isInNameReplacementResults(nameReplacementResults,c.getRight())) {
getNameReplacementByName(nameReplacementResults,c.getRight()).getOldNames().add(c.getLeft());
} else {
List<String> oldNames = new ArrayList<>();
oldNames.add(c.getLeft());
NameReplacementResult nrRes = new NameReplacementResult(c.getRight(), oldNames);
nameReplacementResults.add(nrRes);
}
});
return nameReplacementResults;
}
private static NameReplacementResult getNameReplacementByName(List<NameReplacementResult> nameReplacementResults,
String name) {
return nameReplacementResults.stream().filter(n->n.getName().equals(name)).findFirst().get();
}
public static boolean isInNameReplacementResults(List<NameReplacementResult> nameReplacementResults,String name){
if(nameReplacementResults.isEmpty())
return false;
return nameReplacementResults.stream().map(r->r.getName()).filter(n->name.equals(n)).findFirst().isPresent();
}
public static Optional<TPHConstraint> getConstraintByLeftSide(List<TPHConstraint> allCons, String tph) {
return allCons.stream().filter(c->c.getLeft().equals(tph)).findFirst();
}
public static Optional<TPHConstraint> getConstraintByRightSide(List<TPHConstraint> allCons, String tph) {
return allCons.stream().filter(c->c.getRight().equals(tph)).findFirst();
}
public static boolean isTPHInGenericGeneratorResult(final List<GenericsGeneratorResult> constraints, final String tph) {
return constraints.stream().filter(g->g.getConstraint().getLeft().equals(tph)).findFirst().isPresent();
}
/**
* @param allCons
* @param tphsMethod
* @param tphsClass
* @param visitedTPHs
* @param tph
* @return
*/
public static LinkedList<String> createLinkedListForTPHsInRelation(final List<TPHConstraint> allCons,
List<String> tphsMethod, List<String> tphsClass, final Set<String> visitedTPHs, String tph) {
final LinkedList<String> tphsInRel = new LinkedList<>();
List<String> tphsList = new ArrayList<>(tphsMethod);
tphsList.addAll(tphsClass);
boolean isNextSuperTypeFound = findNextSuperTyp(allCons,tphsList ,visitedTPHs, tph, tphsInRel);
if(!isNextSuperTypeFound)
findNextSubType(allCons, tphsList,visitedTPHs, tph, tphsInRel);
return tphsInRel;
}
public static boolean findNextSubType(List<TPHConstraint> allCons, List<String> tphsList, Set<String> visitedTPHs, String tph,
LinkedList<String> tphsInRel) {
Optional<TPHConstraint> con = getConstraintByRightSide(allCons, tph);
while (con.isPresent()) {
String left = con.get().getLeft();
String right = con.get().getRight();
addTPHsToListFromLeft(tphsInRel, left, right);
markAsVisited(visitedTPHs, left);
if(tphsList.contains(left))
return true;
con = getConstraintByRightSide(allCons, left);
}
return false;
}
public static void addTPHsToListFromLeft(LinkedList<String> tphsInRel, String left, String right) {
if (tphsInRel.isEmpty())
tphsInRel.add(right);
tphsInRel.addFirst(left);
}
/**
* @param allCons
* @param tphsList
* @param visitedTPHs
* @param tph
* @param tphsInRel
* @return
*/
public static boolean findNextSuperTyp(final List<TPHConstraint> allCons, List<String> tphsList, final Set<String> visitedTPHs, String tph,
final LinkedList<String> tphsInRel) {
Optional<TPHConstraint> con = getConstraintByLeftSide(allCons, tph);
markAsVisited(visitedTPHs, tph);
while (con.isPresent()) {
String left = con.get().getLeft();
String right = con.get().getRight();
addTPHsToList(tphsInRel, left, right);
if(tphsList.contains(right))
return true;
markAsVisited(visitedTPHs, right);
con = getConstraintByLeftSide(allCons, right);
}
return false;
}
public static void markAsVisited(Set<String> visitedTPHs, String left) {
visitedTPHs.add(left);
}
/**
* @param visitedTPHs
* @param right
* @param left
*/
public static void markAsVisited(final Set<String> visitedTPHs, String left, String right) {
visitedTPHs.add(left);
visitedTPHs.add(right);
}
/**
* @param tphsInRel
* @param right
* @param left
*/
public static void addTPHsToList(final LinkedList<String> tphsInRel, String left, String right) {
if (tphsInRel.isEmpty())
tphsInRel.add(left);
tphsInRel.add(right);
}
public static void removeNotLocalTphs(final LinkedList<String> tphsInRel, final List<String> localTphs,
List<String> tphsClass) {
while (!localTphs.contains(tphsInRel.peek())) {
tphsInRel.removeFirst();
}
String last = tphsInRel.peekLast();
while (!localTphs.contains(last) && !tphsClass.contains(last)) {
tphsInRel.removeLast();
last = tphsInRel.peekLast();
}
}
/**
* @param nameReplacementResults
* @param subType
* @return
*/
public static Set<String> createEqualSet(final List<NameReplacementResult> nameReplacementResults, String subType) {
Optional<NameReplacementResult> equals = nameReplacementResults.stream()
.filter(n -> n.getName().equals(subType)).findFirst();
Set<String> equalSet = equals.isPresent() ? new HashSet<>(equals.get().getOldNames()) : new HashSet<>();
return equalSet;
}
public static String getNextClassTph(List<String> tphsClass, LinkedList<String> tphsInRel) {
for(int i = 1;i<tphsInRel.size();++i) {
String next = tphsInRel.get(i);
if(tphsClass.contains(next))
return next;
}
return tphsInRel.getLast();
}
public static void addTPHsToClassTPHs(final List<GenericsGeneratorResult> constraints, final List<String> tphsClass) {
List<String> lefts = constraints.stream().map(r->r.getConstraint()).map(c->c.getLeft()).collect(Collectors.toList());
List<String> rights = constraints.stream().map(r->r.getConstraint()).map(c->c.getRight()).collect(Collectors.toList());
List<String> leftsAndRights = new ArrayList<>(lefts);
leftsAndRights.addAll(rights);
List<String> shouldBeClassTphs = leftsAndRights.stream().distinct().collect(Collectors.toList());
for(String tph : shouldBeClassTphs) {
if(!tphsClass.contains(tph))
tphsClass.add(tph);
}
}
public static void removeClassTPHsFromMethodTPHs(List<String> tphsClass, TPHExtractor tphExtractor) {
tphExtractor.ListOfMethodsAndTph.stream().map(m->m.getTphs()).forEach(tphs->{
tphs.removeAll(tphsClass);
});
tphExtractor.ListOfMethodsAndTph.stream().map(m->m.getLocalTphs()).forEach(tphs->{
tphs.removeAll(tphsClass);
});
}
public static LinkedList<String> createLinkedListForTPHsInRelationClass(List<TPHConstraint> allCons,
List<String> tphsClass, List<String> methodTPHs, Set<String> visitedTPHs, String tph) {
final LinkedList<String> tphsInRel = new LinkedList<>();
boolean isNextSuperTypeFound = findNextSuperTyp(allCons,tphsClass ,visitedTPHs, tph, tphsInRel);
if(!tphsInRel.isEmpty() && !isNextSuperTypeFound && !methodTPHs.contains(tphsInRel.getLast()))
findNextSubType(allCons, tphsClass,visitedTPHs, tph, tphsInRel);
return tphsInRel;
}
public static boolean isInResult(String first, List<GenericsGeneratorResult> constraints) {
return constraints.stream().map(r->r.getConstraint()).filter(c->c.getLeft().equals(first)).findFirst().isPresent();
}
public static Optional<GenericsGeneratorResult> getGenericGeneratorResult(List<GenericsGeneratorResult> list,
String tph) {
return list.stream().filter(g->g.getConstraint().getLeft().equals(tph)).findFirst();
}
public static void removeGenericGeneratorResult(List<GenericsGeneratorResult> genericsGenResults,
GenericsGeneratorResult ggResult) {
genericsGenResults.remove(ggResult);
}
public static Optional<MethodAndTPH> getMethodAndTphs(ArrayList<MethodAndTPH> listOfMethodsAndTph, String id) {
return listOfMethodsAndTph.stream().filter(m->m.getId().equals(id)).findFirst();
}
}

@ -0,0 +1,35 @@
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.List;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
public class ConstraintsWithSameLeftSide {
private List<TPHConstraint> constraints;
/**
* @param constraints
*/
public ConstraintsWithSameLeftSide(List<TPHConstraint> constraints) {
this.constraints = constraints;
}
/**
* @return the constraints
*/
public List<TPHConstraint> getConstraints() {
return constraints;
}
/**
* @param constraints the constraints to set
*/
public void setConstraints(List<TPHConstraint> constraints) {
this.constraints = constraints;
}
@Override
public String toString() {
return "[" + constraints.toString() + "]";
}
}

@ -0,0 +1,46 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.List;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
/**
* @author fayez
*
*/
public class Cycle {
private final List<TPHConstraint> constraints;
/**
* @param constraints
*/
public Cycle(List<TPHConstraint> constraints) {
this.constraints = constraints;
}
/**
* @return the constraints
*/
public List<TPHConstraint> getConstraints() {
return constraints;
}
public boolean containConstraint(TPHConstraint constraint) {
for(TPHConstraint c : constraints) {
if(c.equalConstraint(constraint))
return true;
}
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
constraints.forEach(c->sb.append(c.getLeft()+" -> "));
sb.append(constraints.get(constraints.size()-1).getRight());
return sb.toString();
}
}

@ -0,0 +1,33 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.Collections;
import java.util.List;
/**
* @author fayez
*
*/
public class GenericGeneratorResultsForAllMethods {
private final List<MethodAndConstraints> methodsAndConstraints;
public GenericGeneratorResultsForAllMethods() {
this(Collections.emptyList());
}
/**
* @param methodsAndConstraints
*/
public GenericGeneratorResultsForAllMethods(List<MethodAndConstraints> methodsAndConstraints) {
this.methodsAndConstraints = methodsAndConstraints;
}
/**
* @return the methodsAndConstraints
*/
public List<MethodAndConstraints> getMethodsAndConstraints() {
return methodsAndConstraints;
}
}

@ -0,0 +1,51 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;
/**
* The simplify results of a source file (package)
*
* @author fayez
*
*/
public class GenericGenratorResultForSourceFile {
private String pkgName;
private final List<GenericsGeneratorResultForClass> genericGeneratorResultForAllClasses = new ArrayList<>();
/**
* @param pkgName
*/
public GenericGenratorResultForSourceFile(String pkgName) {
this.pkgName = pkgName;
}
public List<GenericsGeneratorResultForClass> getGenericGeneratorResultForAllClasses() {
return genericGeneratorResultForAllClasses;
}
/**
* Appends the simplify results of a class to simplifyResForSF
*
* @param sResClass simplify results of a class to added
*/
public void addGenericGeneratorResultClass(GenericsGeneratorResultForClass sResClass) {
genericGeneratorResultForAllClasses.add(sResClass);
}
public GenericsGeneratorResultForClass getSimplifyResultsByName(String pkgName, String name) {
if (this.pkgName.equals(pkgName)) {
return genericGeneratorResultForAllClasses.stream()
.filter(sr -> sr.getClassName().equals(name))
.findAny()
.orElseThrow(() -> new NoSuchElementException(
"Simplify results for the class " + pkgName + "." + name + " are not found"));
}
throw new NoSuchElementException("Simplify results for the class " + pkgName + "." + name + " are not found");
}
}

@ -0,0 +1,55 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.Set;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
/**
* @author fayez
*
*/
public class GenericsGeneratorResult {
private TPHConstraint constraint;
/**
* contains the names of all type placeholders which are equals to the left side of
* the constraint {@link #constraint}.
*/
private Set<String> equalsTPHs;
/**
* @param constraint
* @param equalsTPHs
*/
public GenericsGeneratorResult(TPHConstraint constraint, Set<String> equalsTPHs) {
this.constraint = constraint;
this.equalsTPHs = equalsTPHs;
}
/**
* @return the constraint
*/
public TPHConstraint getConstraint() {
return constraint;
}
/**
* @param constraint the constraint to set
*/
public void setConstraint(TPHConstraint constraint) {
this.constraint = constraint;
}
/**
* @return the equalsTPHs
*/
public Set<String> getEqualsTPHs() {
return equalsTPHs;
}
/**
* @param equalsTPHs the equalsTPHs to set
*/
public void setEqualsTPHs(Set<String> equalsTPHs) {
this.equalsTPHs = equalsTPHs;
}
}

@ -0,0 +1,67 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.Collections;
import java.util.List;
/**
* @author fayez
*
*/
public class GenericsGeneratorResultForClass {
private final String className;
private final List<GenericsGeneratorResult> classConstraints;
private final GenericGeneratorResultsForAllMethods methodsAndTheirConstraints;
public GenericsGeneratorResultForClass(String className) {
this(className, Collections.emptyList(), new GenericGeneratorResultsForAllMethods());
}
/**
* @param className
* @param classConstraints
* @param methodsAndTheirConstraints
*/
public GenericsGeneratorResultForClass(String className, List<GenericsGeneratorResult> classConstraints,
GenericGeneratorResultsForAllMethods methodsAndTheirConstraints) {
this.className = className;
this.classConstraints = classConstraints;
this.methodsAndTheirConstraints = methodsAndTheirConstraints;
}
/**
* @return the className
*/
public String getClassName() {
return className;
}
/**
* @return the classConstraints
*/
public List<GenericsGeneratorResult> getClassConstraints() {
return classConstraints;
}
/**
* @return the methodsAndTheirConstraints
*/
public GenericGeneratorResultsForAllMethods getMethodsAndTheirConstraints() {
return methodsAndTheirConstraints;
}
public boolean contains(String id) {
return methodsAndTheirConstraints.getMethodsAndConstraints().stream().map(mc -> mc.getMethodID())
.anyMatch(i -> i.equals(id));
}
public List<GenericsGeneratorResult> getMethodConstraintsByID(String id) {
return methodsAndTheirConstraints.getMethodsAndConstraints().stream().filter(mc -> mc.getMethodID().equals(id))
.findFirst().get().getConstraints();
}
}

@ -0,0 +1,36 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.List;
/**
* @author fayez
*
*/
public class MethodAndConstraints {
private final String methodID;
private final List<GenericsGeneratorResult> constraints;
/**
* @param methodID
* @param constraints
*/
public MethodAndConstraints(String methodID, List<GenericsGeneratorResult> constraints) {
this.methodID = methodID;
this.constraints = constraints;
}
/**
* @return the methodID
*/
public String getMethodID() {
return methodID;
}
/**
* @return the constraints
*/
public List<GenericsGeneratorResult> getConstraints() {
return constraints;
}
}

@ -0,0 +1,49 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
import java.util.List;
/**
* @author fayez
*
*/
public class NameReplacementResult {
private String name;
private List<String> oldNames;
/**
* @param name
* @param oldNames
*/
public NameReplacementResult(String name, List<String> oldNames) {
this.name = name;
this.oldNames = oldNames;
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the oldNames
*/
public List<String> getOldNames() {
return oldNames;
}
/**
* @param oldNames the oldNames to set
*/
public void setOldNames(List<String> oldNames) {
this.oldNames = oldNames;
};
}

@ -1,469 +1,379 @@
package de.dhbwstuttgart.bytecode.signature;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.*;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureVisitor;
import org.objectweb.asm.signature.SignatureWriter;
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
import de.dhbwstuttgart.bytecode.utilities.Simplify;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
import de.dhbwstuttgart.syntaxtree.Constructor;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
import de.dhbwstuttgart.typeinference.result.GenericInsertPair;
import de.dhbwstuttgart.typeinference.result.ResolvedType;
import de.dhbwstuttgart.typeinference.result.ResultSet;
public class Signature {
private static final char SUPER_CHAR = '-';
private static final char EXTENDS_CHAR = '+';
private static final String SPECIAL_CHAR_FOR_FUN = "$$";
private static final String SPECIAL_CHAR = "$";
private ClassOrInterface classOrInterface;
private HashMap<String, String> genericsAndBounds;
private HashMap<String, String> genericsAndBoundsMethod;
private SignatureWriter sw;
private final SignatureWriter sw = new SignatureWriter();;
private Constructor constructor;
private Method method;
private HashMap<String,RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes;
private HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes;
private ResultSet resultSet;
private ArrayList<GenericInsertPair> commonPairs;
private HashMap<TPHConstraint,HashSet<String>> methodConstraints;
private ArrayList<TypePlaceholder> tphsClass;
private ArrayList<TPHConstraint> consClass;
public Signature(ClassOrInterface classOrInterface, HashMap<String, String> genericsAndBounds,
ArrayList<GenericInsertPair> commonPairs, ArrayList<TypePlaceholder> tphsClass, ArrayList<TPHConstraint> consClass) {
this.classOrInterface = classOrInterface;
this.genericsAndBounds = genericsAndBounds;
this.commonPairs = commonPairs;
this.tphsClass = tphsClass;
this.consClass = consClass;
sw = new SignatureWriter();
createSignatureForClassOrInterface();
}
private Map<TPHConstraint, Set<String>> methodConstraints;
private List<GenericsGeneratorResult> consClass;
private List<GenericsGeneratorResult> constraints;
public Signature(Constructor constructor, HashMap<String, String> genericsAndBounds,
HashMap<String,RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes,ResultSet resultSet,
HashMap<TPHConstraint,HashSet<String>> methodConstraints) {
this.constructor = constructor;
// public Signature(ClassOrInterface classOrInterface, HashMap<String, String> genericsAndBounds,
// List<TPHConstraint> consClass) {
// this.classOrInterface = classOrInterface;
// this.genericsAndBounds = genericsAndBounds;
// this.consClass = consClass;
// sw = new SignatureWriter();
// createSignatureForClassOrInterface();
// }
public Signature(HashMap<String, String> genericsAndBounds,
HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes, ResultSet resultSet,
List<GenericsGeneratorResult> constraints) {
//this.constructor = constructor;
this.genericsAndBounds = genericsAndBounds;
this.methodParamsAndTypes = methodParamsAndTypes;
this.resultSet = resultSet;
this.methodConstraints = methodConstraints;
sw = new SignatureWriter();
createSignatureForConsOrMethod(this.constructor,true);
this.constraints = constraints;
}
public Signature(Method method, HashMap<String, String> genericsAndBoundsMethod,HashMap<String, String> genericsAndBounds,
HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes, ResultSet resultSet,
HashMap<TPHConstraint,HashSet<String>> methodConstraints) {
this.method = method;
public Signature(int numberOfParams) {
createSignatureForFunN(numberOfParams);
}
public Signature(int numberOfParams, String to, String[] paramTypes) {
createSignatureForFunN(numberOfParams, to, paramTypes);
}
public Signature(ClassOrInterface classOrInterface, HashMap<String, String> genericsAndBounds,
List<GenericsGeneratorResult> consClass) {
this.classOrInterface = classOrInterface;
this.genericsAndBounds = genericsAndBounds;
this.consClass = consClass;
}
public Signature(HashMap<String, String> genericsAndBoundsMethod,
HashMap<String, String> genericsAndBounds,
HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes, ResultSet resultSet,
List<GenericsGeneratorResult> constraints,List<GenericsGeneratorResult> consClass) {
this.genericsAndBoundsMethod = genericsAndBoundsMethod;
this.genericsAndBounds = genericsAndBounds;
this.methodParamsAndTypes = methodParamsAndTypes;
this.resultSet = resultSet;
this.methodConstraints = methodConstraints;
sw = new SignatureWriter();
createSignatureForConsOrMethod(this.method,false);
}
public Signature(LambdaExpression lambdaExpression,int numberOfParams) {
sw = new SignatureWriter();
createSignatureForFunN(lambdaExpression, numberOfParams);
this.constraints = constraints;
this.consClass = consClass;
}
private void createSignatureForFunN(LambdaExpression lambdaExpression, int numberOfParams) {
// sw.visitClassBound().visitEnd();
for(int i = 0;i<numberOfParams;i++) {
int j = i+1;
sw.visitFormalTypeParameter("T"+ j);
// getBounds von Params
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
sw.visitClassBound().visitEnd();
public String createSignatureForConstructor(Constructor constructor) {
visitParams();
sw.visitReturnType().visitBaseType('V');
return sw.toString();
}
public String createSignatureForMethod(Method method) {
defineGenerics(method);
String ret = resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature());
visitParams();
visitReturnType(method, ret);
return sw.toString();
}
/**
* @param method
* @param ret
*/
private void visitReturnType(Method method, String ret) {
if (ret.equals("V")) {
sw.visitReturnType().visitBaseType('V');
} else {
RefTypeOrTPHOrWildcardOrGeneric returnType = method.getReturnType();
SignatureVisitor sv = sw.visitReturnType();
doVisitParamsOrReturn(returnType, sv);
}
}
/**
*
*/
private void visitParams() {
for (String paramName : methodParamsAndTypes.keySet()) {
RefTypeOrTPHOrWildcardOrGeneric t = methodParamsAndTypes.get(paramName);
SignatureVisitor sv = sw.visitParameterType();
doVisitParamsOrReturn(t, sv);
}
}
/**
*
* @param method
*/
private void defineGenerics(Method method) {
method.getGenerics().forEach(g -> {
visitTypeVarsAndTheirBounds(g, genericsAndBoundsMethod);
});
defineGenericsFromConstraints(constraints,genericsAndBoundsMethod);
}
private void createSignatureForFunN(int numberOfParams, String to, String[] paramTypes) {
defineTypeVariablesForParametersOfFunN(numberOfParams);
sw.visitFormalTypeParameter("R");
visitClassBound(to);
// TODO: prüfe ob Return-Type = void,
sw.visitSuperclass().visitClassType(Type.getInternalName(Object.class));
sw.visitEnd();
}
private void createSignatureForFunN(int numberOfParams) {
defineTypeVariablesForParametersOfFunN(numberOfParams);
sw.visitFormalTypeParameter("R");
// getBounds vom Return-Type
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
sw.visitClassBound().visitEnd();
// TODO: prüfe ob Return-Type = void,
sw.visitSuperclass().visitClassType(Type.getInternalName(Object.class));;
sw.visitSuperclass().visitClassType(Type.getInternalName(Object.class));
sw.visitEnd();
}
/**
* Creates signature for a method or constructor with @see {@link SignatureWriter}
* Signature looks like:
* <typevaliables (K:Ljava/lang/Object "Bounds")>(params L.. OR T.. Or basistape)ReturnType
*
* @param method method or constructor
* @param isConstructor true if constructor
*/
private void createSignatureForConsOrMethod(Method method, boolean isConstructor) {
Iterator<? extends GenericTypeVar> itr = method.getGenerics().iterator();
// visits all formal type parameter and visits their bounds <T:...;B:...;...>
while(itr.hasNext()) {
System.out.println("HAS GENERICS!!");
GenericTypeVar g = itr.next();
getBoundsOfTypeVar(g,genericsAndBoundsMethod);
private void defineTypeVariablesForParametersOfFunN(int numberOfParams) {
for (int i = 0; i < numberOfParams; i++) {
int j = i + 1;
sw.visitFormalTypeParameter("T" + j);
// getBounds von Params
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
sw.visitClassBound().visitEnd();
}
// Wenn die RückgabeType eine TPH ist, wird als generic behandelt
// z.B: Type = TPH K => wird eine Formal Type Parameter K$ erzeugt und Bound = Object
if(!isConstructor) {
String ret = resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature());
ArrayList<TPHConstraint> allConsBeforeSimplify = new ArrayList<>();
HashMap<TPHConstraint,HashSet<String>> allConstraints = new HashMap<>();
if(ret.contains("<")) {
allConsBeforeSimplify = getAllConstraints((RefType) resultSet.resolveType(method.getReturnType()).resolvedType);
}
for(String paramName : methodParamsAndTypes.keySet()) {
RefTypeOrTPHOrWildcardOrGeneric t = methodParamsAndTypes.get(paramName);
String pT = t.acceptTV(new TypeToSignature());
if(pT.contains("<"))
allConsBeforeSimplify = getAllConstraints((RefType) t);
}
boolean doSimplify = false;
if(!allConsBeforeSimplify.isEmpty()) {
addConstraintsToMap(allConstraints,allConsBeforeSimplify);
doSimplify = true;
}
createTypeVars(allConstraints, doSimplify);
if(!ret.equals("V")) {
if(ret.contains("$") && !ret.contains("$$") && !ret.contains("<")) {
if(genericsAndBounds.containsKey(ret)) {
genericsAndBoundsMethod.put(ret.substring(1), genericsAndBounds.get(ret.substring(1)));
}
}
}
}
// visit each method-parameter to create the signature
for(String paramName : methodParamsAndTypes.keySet()) {
RefTypeOrTPHOrWildcardOrGeneric t = methodParamsAndTypes.get(paramName);
// parameter type deswegen ist true
doVisitParamsOrReturn(t,true);
}
if(isConstructor ||
resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature()).equals("V")) {
sw.visitReturnType().visitBaseType('V');
}else {
RefTypeOrTPHOrWildcardOrGeneric returnType = method.getReturnType();
// return type deswegen ist false
doVisitParamsOrReturn(returnType, false);
}
// sw.visitEnd();
}
private void addConstraintsToMap(HashMap<TPHConstraint, HashSet<String>> allConstraints,
ArrayList<TPHConstraint> allConsBeforeSimplify) {
for(TPHConstraint tphCons : allConsBeforeSimplify) {
allConstraints.put(tphCons, null);
}
}
private String getEqualTPH(HashMap<TPHConstraint, HashSet<String>> methodConstraints, String tph) {
for(TPHConstraint cons : methodConstraints.keySet()) {
if(methodConstraints.get(cons) != null) {
if(methodConstraints.get(cons).contains(tph)) {
return cons.getLeft();
}
}
}
return tph;
}
private void createTypeVars(HashMap<TPHConstraint, HashSet<String>> allConstraints, boolean doSimplify) {
allConstraints.putAll(methodConstraints);
HashMap<TPHConstraint, HashSet<String>> simplifiedConstraints;
if(doSimplify) {
simplifiedConstraints = Simplify.simplifyContraints(allConstraints);
}else {
simplifiedConstraints = allConstraints;
}
for(TPHConstraint cons : simplifiedConstraints.keySet()) {
// need subst.
String sub = cons.getLeft()+"$";
if(!genericsAndBoundsMethod.containsKey(sub) && !genericsAndBounds.containsKey(sub)) {
sw.visitFormalTypeParameter(sub);
String bound = cons.getRight();
if(bound.equals(Type.getInternalName(Object.class))) {
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
sw.visitClassBound().visitEnd();
genericsAndBoundsMethod.put(sub, bound);
} else {
String boundName = bound+"$";
sw.visitClassBound().visitTypeVariable(boundName);
genericsAndBoundsMethod.put(sub, boundName);
}
}
}
}
private ArrayList<TPHConstraint> getAllConstraints(RefType ref) {
final ArrayList<TPHConstraint> res = new ArrayList<>();
for(RefTypeOrTPHOrWildcardOrGeneric p : ref.getParaList()) {
ResolvedType resType;
if(p instanceof WildcardType) {
resType = resultSet.resolveType(((WildcardType) p).getInnerType());
}else {
resType = resultSet.resolveType(p);
}
RefTypeOrTPHOrWildcardOrGeneric resolved = resType.resolvedType;
if(resolved instanceof TypePlaceholder) {
resType.additionalGenerics.forEach(ag ->{
TPHConstraint constr = new ExtendsConstraint(ag.TA1.getName(), ag.TA2.getName(), Relation.EXTENDS);
if(!contains(res,constr)) {
res.add(constr);
}
});
}
if(resolved instanceof WildcardType) {
WildcardType resWC = (WildcardType) resolved;
ResolvedType resType2 = resultSet.resolveType(resWC.getInnerType());
if(resType2.resolvedType instanceof TypePlaceholder) {
resType2.additionalGenerics.forEach(ag ->{
TPHConstraint constr = new ExtendsConstraint(ag.TA1.getName(), ag.TA2.getName(), Relation.EXTENDS);
if(!contains(res,constr)) {
res.add(constr);
}
});
}
}
}
System.out.println("RES GIP === " + res.size());
return res;
}
private boolean contains(ArrayList<TPHConstraint> constraints, TPHConstraint constr) {
for(int i=0; i<constraints.size();++i) {
TPHConstraint p = constraints.get(i);
if(constr.getLeft().equals(p.getLeft()) && constr.getRight().equals(p.getRight()))
return true;
}
return false;
}
/**
* Visits parameter type or return type with {@link SignatureVisitor} to create
* the method signature
* @param t type of parameter or return type
* @param isParameterType true if t is type of parameter
*
* @param t type of parameter or return type
* @param sv true if t is type of parameter
*/
private void doVisitParamsOrReturn(RefTypeOrTPHOrWildcardOrGeneric t, boolean isParameterType) {
private void doVisitParamsOrReturn(RefTypeOrTPHOrWildcardOrGeneric t, SignatureVisitor sv) {
String type = t.acceptTV(new TypeToString());
SignatureVisitor sv;
if(isParameterType) {
sv = sw.visitParameterType();
}
else {
sv = sw.visitReturnType();
}
switch (type) {
case "RT":
String sig = t.acceptTV(new TypeToSignature());
String sig = t.acceptTV(new TypeToSignature(constraints));
sv.visitClassType(sig.substring(1, sig.length()));
break;
case "GRT":
GenericRefType g = (GenericRefType) t;
sv.visitTypeVariable(g.acceptTV(new TypeToSignature()).substring(1));
sv.visitTypeVariable(g.acceptTV(new TypeToSignature(constraints)));
break;
case "TPH":
RefTypeOrTPHOrWildcardOrGeneric r = resultSet.resolveType(t).resolvedType;
// der Fall wenn die Type eine Interface ist, muss betrachtet werden
// der Fall wenn der Typ eine Interface ist, muss betrachtet werden
// Deswegen muss in ResutSet noch enthalten werden, ob die Type eine
// Interface oder eine Klasse ist.
// das braucht man nicht es reicht: sv.visitTypeVariable(r.acceptTV(new TypeToSignature())
//
String sig2 = r.acceptTV(new TypeToSignature());
String eqTPH = getEqualTPH(methodConstraints, sig2.substring(1, sig2.length()-1))+"$";
if(!(r instanceof TypePlaceholder)) {
if(sig2.contains("$$")) {
System.out.println(" Signature FUN$$: "+r);
sv.visitInterface().visitClassType(sig2.substring(1, sig2.length()));
// das braucht man nicht es reicht: sv.visitTypeVariable(r.acceptTV(new
// TypeToSignature())
//
String sig2 = r.acceptTV(new TypeToSignature(constraints));
if (r instanceof GenericRefType) {
sv.visitTypeVariable(sig2);
} else if (!(r instanceof TypePlaceholder)) {
if (sig2.contains(SPECIAL_CHAR_FOR_FUN)) {
sv.visitInterface().visitClassType(sig2.substring(1));
} else {
sv.visitClassType(sig2.substring(1, sig2.length()));
// Kann zwischen GenericRefType und RefType nicht unterscheiden
// Deswegen wird immer geprüft, ob der Name in Generic Maps liegt
String n = sig2.substring(1, sig2.length() - 1);
// if(genericsAndBoundsMethod.containsKey(n) || genericsAndBounds.containsKey(n)) {
// sv.visitTypeVariable(n);
// } else {
sv.visitClassType(n);
sv.visitEnd();
// }
// sv.visitClassType(n);
}
} else {
System.out.println(r.getClass()+" Signature TPH: "+r.acceptTV(new TypeToSignature()));
sv.visitTypeVariable(eqTPH);
String realName = sig2.substring(1, sig2.length() - 1);
String toVisit = realName+SPECIAL_CHAR;
if(!genericsAndBounds.containsKey(toVisit)) {
Optional<GenericsGeneratorResult> equalTPH = getEqualTPHFromClassConstraints(consClass, realName);
if(equalTPH.isPresent()){
toVisit = equalTPH.get().getConstraint().getLeft() + SPECIAL_CHAR;
} else {
toVisit = getEqualTPH(constraints, realName) + SPECIAL_CHAR;
}
}
sv.visitTypeVariable(toVisit);
}
break;
case "SWC":
System.out.println("SWC---Signature");
SuperWildcardType swc = (SuperWildcardType) t;
String sigInner = swc.getInnerType().acceptTV(new TypeToSignature());
if(swc.getInnerType() instanceof TypePlaceholder) {
sv.visitTypeArgument('-').visitTypeVariable(sigInner.substring(1, sigInner.length()));
} else if(swc.getInnerType() instanceof RefType) {
if(sigInner.contains("$$")) {
sv.visitTypeArgument('-').visitInterface().visitClassType(sigInner.substring(1,sigInner.length()));
}else {
sv.visitTypeArgument('-').visitClassType(sigInner.substring(1,sigInner.length()));
}
}else {
sv.visitTypeArgument('-').visitTypeVariable(sigInner.substring(1));
}
String sigInner = swc.getInnerType().acceptTV(new TypeToSignature(constraints));
int length = sigInner.length();
visitWildCard(sv, sigInner, length, swc.getInnerType(), SUPER_CHAR);
break;
case "EWC":
System.out.println("EWC---Signature");
ExtendsWildcardType ewc = (ExtendsWildcardType) t;
String esigInner = ewc.getInnerType().acceptTV(new TypeToSignature());
System.out.println(esigInner);
if(ewc.getInnerType() instanceof TypePlaceholder) {
sv.visitTypeArgument('+').visitTypeVariable(esigInner.substring(1, esigInner.length()));
} else if(ewc.getInnerType() instanceof RefType) {
if(esigInner.contains("$$")) {
sv.visitTypeArgument('+').visitInterface().visitClassType(esigInner.substring(1,esigInner.length()));
}else {
// sv.visitClassType(esigInner.substring(1,esigInner.length()));
sv.visitTypeArgument('+').visitClassType(esigInner.substring(1,esigInner.length()));
}
}else {
sv.visitTypeArgument('+').visitTypeVariable(esigInner.substring(1));
}
String esigInner = ewc.getInnerType().acceptTV(new TypeToSignature(constraints));
int lengthEWCSig = esigInner.length();
visitWildCard(sv, esigInner, lengthEWCSig, ewc.getInnerType(), EXTENDS_CHAR);
break;
default:
if(!isParameterType)
sv.visitBaseType('V');
// if (!sv)
// sv.visitBaseType('V');
break;
}
}
private void visitWildCard(SignatureVisitor sv, String sigInner, int length, RefTypeOrTPHOrWildcardOrGeneric innerType, char superOrExtendsChar) {
if (innerType instanceof TypePlaceholder) {
sv.visitTypeArgument(superOrExtendsChar).visitTypeVariable(sigInner.substring(1, length));
} else if (innerType instanceof RefType) {
checkInnerSignatureOfWildCard(sv, sigInner, length, superOrExtendsChar);
} else {
sv.visitTypeArgument(superOrExtendsChar).visitTypeVariable(sigInner.substring(1));
}
}
private void checkInnerSignatureOfWildCard(SignatureVisitor sv, String sigInner, int length, char superOrExtendsChar) {
if (sigInner.contains(SPECIAL_CHAR_FOR_FUN)) {
sv.visitTypeArgument(superOrExtendsChar).visitInterface().visitClassType(sigInner.substring(1, length));
} else {
sv.visitTypeArgument(superOrExtendsChar).visitClassType(sigInner.substring(1, length));
}
}
private Optional<GenericsGeneratorResult> getEqualTPHFromClassConstraints(List<GenericsGeneratorResult> consClass, String tph) {
return consClass.stream()
.filter(c -> c.getConstraint().getLeft().equals(tph) || c.getEqualsTPHs().contains(tph))
.findFirst();
}
private String getEqualTPH(List<GenericsGeneratorResult> constraints2, String tph) {
return constraints2.stream()
.filter(c -> c.getConstraint().getLeft().equals(tph) || c.getEqualsTPHs().contains(tph))
.findFirst().get().getConstraint().getLeft();
}
/**
* Creates signature for class or interface with {@link SignatureWriter}
* Signature looks like:
* <typevaliables (K:Ljava/lang/Object "Bounds")>superclass
* Signature looks like: <typevaliables (K:Ljava/lang/Object
* "Bounds")>superclass
*/
private void createSignatureForClassOrInterface() {
Iterator<GenericTypeVar> itr = classOrInterface.getGenerics().iterator();
public String createSignatureForClassOrInterface() {
defineTypeVariablesForClassOrInterface();
defineGenericsFromConstraints(consClass,genericsAndBounds);
while(itr.hasNext()) {
GenericTypeVar g = itr.next();
getBoundsOfTypeVar(g,genericsAndBounds);
}
if(!consClass.isEmpty()) {
ArrayList<String> types = new ArrayList<>();
ArrayList<String> superTypes = new ArrayList<>();
for(TPHConstraint cons : consClass) {
types.add(cons.getLeft());
superTypes.add(cons.getRight());
}
for(TPHConstraint cons : consClass) {
String t = cons.getLeft()+"$";
String bound = cons.getRight()+"$";
sw.visitFormalTypeParameter(t);
sw.visitClassBound().visitTypeVariable(bound);
genericsAndBounds.put(t, bound);
}
for(TPHConstraint cons : consClass) {
if(!types.contains(cons.getRight()) && !genericsAndBounds.keySet().contains(cons.getRight()+"$")) {
String t = cons.getRight()+"$";
String bound = Type.getInternalName(Object.class);
sw.visitFormalTypeParameter(t);
sw.visitClassBound().visitClassType(bound);
genericsAndBounds.put(t, bound);
sw.visitClassBound().visitEnd();
}
}
}
/*if(!commonPairs.isEmpty()) {
ArrayList<TypePlaceholder> types = new ArrayList<>();
ArrayList<TypePlaceholder> superTypes = new ArrayList<>();
for(GenericInsertPair p : commonPairs) {
types.add(p.TA1);
superTypes.add(p.TA2);
}
for(GenericInsertPair p : commonPairs) {
String t = p.TA1.getName()+"$";
String bound = p.TA2.getName()+"$";
sw.visitFormalTypeParameter(t);
sw.visitClassBound().visitTypeVariable(bound);
genericsAndBounds.put(t, bound);
}
for(GenericInsertPair p : commonPairs) {
if(!types.contains(p.TA2)) {
String t = p.TA2.getName()+"$";
String bound = Type.getInternalName(Object.class);
sw.visitFormalTypeParameter(t);
sw.visitClassBound().visitClassType(bound);
genericsAndBounds.put(t, bound);
sw.visitClassBound().visitEnd();
}
}
}
for(TypePlaceholder t : tphsClass) {
String n = t.getName()+"$";
String bound = Type.getInternalName(Object.class);
sw.visitFormalTypeParameter(n);
sw.visitClassBound().visitClassType(bound);
genericsAndBounds.put(n, bound);
sw.visitClassBound().visitEnd();
}*/
String sClass = classOrInterface.getSuperClass().acceptTV(new TypeToSignature());
sw.visitSuperclass().visitClassType(sClass.substring(1, sClass.length()-1));
sw.visitSuperclass().visitClassType(sClass.substring(1, sClass.length() - 1));
sw.visitEnd();
}
/**
* Get bounds of type variable
* @param g type variable
* @param genAndBounds
*/
private void getBoundsOfTypeVar(GenericTypeVar g, HashMap<String, String> genAndBounds) {
sw.visitFormalTypeParameter(g.getName());
Iterator<? extends RefTypeOrTPHOrWildcardOrGeneric> bItr = g.getBounds().iterator();
while(bItr.hasNext()) {
RefTypeOrTPHOrWildcardOrGeneric b =bItr.next();
String boundDesc = b.acceptTV(new TypeToDescriptor());
// System.out.println("GetBounds: " + boundDesc);
// Ensure that <...> extends java.lang.Object OR ...
sw.visitClassBound().visitClassType(boundDesc);
genAndBounds.put(g.getName(), boundDesc);
}
sw.visitClassBound().visitEnd();
}
public String toString() {
return sw.toString();
}
private void defineTypeVariablesForClassOrInterface() {
Iterator<GenericTypeVar> itr = classOrInterface.getGenerics().iterator();
while (itr.hasNext()) {
GenericTypeVar g = itr.next();
visitTypeVarsAndTheirBounds(g, genericsAndBounds);
}
}
/**
* @param genericsAndBounds2
*
*/
private void defineGenericsFromConstraints(List<GenericsGeneratorResult> constraints, HashMap<String,String> genericsAndBounds2) {
constraints.forEach(c -> {
String typeVariable = c.getConstraint().getLeft() + SPECIAL_CHAR;
sw.visitFormalTypeParameter(typeVariable);
String bound = c.getConstraint().getRight();
bound = checkBound(bound);
genericsAndBounds2.put(typeVariable, bound);
});
}
/**
* @param bound
* @return
*/
private String checkBound(String bound) {
if (bound.equals(Type.getInternalName(Object.class))) {
visitClassBound(bound);
} else {
bound += SPECIAL_CHAR;
sw.visitClassBound().visitTypeVariable(bound);
}
return bound;
}
/**
* @param bound
*/
private void visitClassBound(String bound) {
sw.visitClassBound().visitClassType(bound);
sw.visitClassBound().visitEnd();
}
/**
* Get bounds of type variable
*
* @param g type variable
* @param genAndBounds
*/
private void visitTypeVarsAndTheirBounds(GenericTypeVar g, HashMap<String, String> genAndBounds) {
sw.visitFormalTypeParameter(g.getName());
Iterator<? extends RefTypeOrTPHOrWildcardOrGeneric> bItr = g.getBounds().iterator();
while (bItr.hasNext()) {
RefTypeOrTPHOrWildcardOrGeneric b = bItr.next();
String boundDesc = b.acceptTV(new TypeToDescriptor());
// Ensure that <...> extends java.lang.Object OR ...
if (b instanceof GenericRefType) {
sw.visitClassBound().visitTypeVariable(boundDesc);
} else {
visitClassBound(boundDesc);
}
genAndBounds.put(g.getName(), boundDesc);
}
}
@Override
public String toString() {
if(sw == null)
return super.toString();
return sw.toString();
}
}

@ -1,8 +1,11 @@
package de.dhbwstuttgart.bytecode.signature;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
@ -12,6 +15,15 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.syntaxtree.type.TypeVisitor;
public class TypeToSignature implements TypeVisitor<String> {
private List<GenericsGeneratorResult> constraints;
public TypeToSignature() {
this.constraints = new ArrayList<>();
}
public TypeToSignature(List<GenericsGeneratorResult> constraints) {
this.constraints = constraints;
}
@Override
public String visit(RefType refType) {
@ -33,7 +45,7 @@ public class TypeToSignature implements TypeVisitor<String> {
// } else {
// params += "L"+param.toString().replace(".", "/");
// }
params += param.acceptTV(new TypeToSignature());
params += param.acceptTV(new TypeToSignature(constraints));
if(param instanceof TypePlaceholder)
params += ";";
@ -48,7 +60,7 @@ public class TypeToSignature implements TypeVisitor<String> {
@Override
public String visit(SuperWildcardType superWildcardType) {
// throw new NotImplementedException();
String sig = "-" + superWildcardType.getInnerType().acceptTV(new TypeToSignature());
String sig = "-" + superWildcardType.getInnerType().acceptTV(new TypeToSignature(constraints));
if(superWildcardType.getInnerType() instanceof TypePlaceholder)
sig += ";";
return sig;
@ -57,13 +69,21 @@ public class TypeToSignature implements TypeVisitor<String> {
@Override
public String visit(TypePlaceholder typePlaceholder) {
// return typePlaceholder.toString().replace(".", "/");
return "T" + typePlaceholder.getName() + "$";
String name = typePlaceholder.getName();
if(!constraints.isEmpty()){
Optional<GenericsGeneratorResult> equalName = getEqualTPHFromClassConstraints(constraints, name);
if(equalName.isPresent())
name = equalName.get().getConstraint().getLeft();
}
return "T" + name + "$";
}
@Override
public String visit(ExtendsWildcardType extendsWildcardType) {
// throw new NotImplementedException();
String sig = "+" + extendsWildcardType.getInnerType().acceptTV(new TypeToSignature());
String sig = "+" + extendsWildcardType.getInnerType().acceptTV(new TypeToSignature(constraints));
if(extendsWildcardType.getInnerType() instanceof TypePlaceholder)
sig += ";";
return sig;
@ -73,5 +93,10 @@ public class TypeToSignature implements TypeVisitor<String> {
public String visit(GenericRefType genericRefType) {
return genericRefType.getParsedName().replace(".", "/");
}
private Optional<GenericsGeneratorResult> getEqualTPHFromClassConstraints(List<GenericsGeneratorResult> listOfConstraints, String tph) {
return listOfConstraints.stream()
.filter(c -> c.getConstraint().getLeft().equals(tph) || c.getEqualsTPHs().contains(tph))
.findFirst();
}
}

@ -0,0 +1,94 @@
package de.dhbwstuttgart.bytecode.utilities;
import de.dhbwstuttgart.bytecode.signature.Signature;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.statement.ArgumentList;
import de.dhbwstuttgart.syntaxtree.statement.Expression;
import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.signature.SignatureVisitor;
import org.objectweb.asm.signature.SignatureWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
public class ByteCodeForFunNGenerator {
public static void generateBCForFunN(LambdaExpression lambdaExpression, String methDesc, String path) {
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
SignatureWriter methSig = new SignatureWriter();
int numberOfParams = 0;
SignatureVisitor paramVisitor = methSig.visitParameterType();
Iterator<FormalParameter> itr = lambdaExpression.params.iterator();
while (itr.hasNext()) {
numberOfParams++;
// getBounds
paramVisitor.visitTypeVariable(CONSTANTS.T + numberOfParams);
itr.next();
}
methSig.visitReturnType().visitTypeVariable(CONSTANTS.R);
// ")"+lam.getReturn.getBounds
Signature sig = new Signature(numberOfParams);
String name = CONSTANTS.FUN + numberOfParams + CONSTANTS.$$;
classWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC+Opcodes.ACC_INTERFACE + Opcodes.ACC_ABSTRACT, name, sig.toString(),
Type.getInternalName(Object.class), null);
MethodVisitor mvApply = classWriter.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "apply", methDesc,
methSig.toString(), null);
mvApply.visitEnd();
writeClassFile(classWriter.toByteArray(), name, path);
}
public static void generateBCForFunN(ArgumentList argumentList, String methDesc, String path) {
ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);
SignatureWriter methSig = new SignatureWriter();
int numberOfParams = 0;
SignatureVisitor paramVisitor = methSig.visitParameterType();
Iterator<Expression> itr1 = argumentList.getArguments().iterator();
while(itr1.hasNext()) {
numberOfParams++;
// getBounds
paramVisitor.visitTypeVariable(CONSTANTS.T + numberOfParams);
itr1.next();
}
methSig.visitReturnType().visitTypeVariable(CONSTANTS.R);
// ")"+lam.getReturn.getBounds
Signature sig = new Signature(numberOfParams);
String name = CONSTANTS.FUN + numberOfParams + CONSTANTS.$$;
classWriter.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC+Opcodes.ACC_INTERFACE + Opcodes.ACC_ABSTRACT, name, sig.toString(),
Type.getInternalName(Object.class), null);
MethodVisitor mvApply = classWriter.visitMethod(Opcodes.ACC_PUBLIC + Opcodes.ACC_ABSTRACT, "apply", methDesc,
methSig.toString(), null);
mvApply.visitEnd();
writeClassFile(classWriter.toByteArray(), name, path);
}
public static void writeClassFile(byte[] bytecode, String name, String path) {
FileOutputStream output;
try {
System.out.println("generating " + name + ".class file...");
output = new FileOutputStream(
new File(path + name + CONSTANTS.EXTENSIONCLASS));
output.write(bytecode);
output.close();
System.out.println(name + ".class file generated");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}

@ -0,0 +1,22 @@
package de.dhbwstuttgart.bytecode.utilities;
public interface CONSTANTS {
String VOID = "void";
String TPH = "TPH ";
String ANGLEBRACKET = "<";
String FUN = "Fun";
String EXTENSIONCLASS = ".class";
String $$ = "$$";
String T = "T";
String R = "R";
String DESUGAREDMETHODNAME = "lambda$new$";
String REFTYPE_BYTE = "java/lang/Byte";
String REFTYPE_SHORT = "java/lang/Short";
String REFTYPE_INTEGER = "java/lang/Integer";
String REFTYPE_LONG = "java/lang/Long";
String REFTYPE_DOUBLE = "java/lang/Double";
String REFTYPE_FLOAT = "java/lang/Float";
String REFTYPE_STRING = "java/lang/String";
String TO_STRING = "toString";
}

@ -5,25 +5,27 @@ import java.util.List;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.ConstraintsWithSameLeftSide;
public class ConstraintsFinder {
private List<TPHConstraint> allConstaints;
public ConstraintsFinder(List<TPHConstraint> allConstaints) {
super();
this.allConstaints = allConstaints;
}
public List<List<TPHConstraint>> findConstraints() {
List<List<TPHConstraint>> result = new ArrayList<>();
public List<ConstraintsWithSameLeftSide> findConstraints() {
List<ConstraintsWithSameLeftSide> result = new ArrayList<>();
List<TPHConstraint> visitedCons = new ArrayList<>();
for(TPHConstraint c : allConstaints) {
if(c.getRel() == Relation.EXTENDS) {
// get constraints with the same left side
List<TPHConstraint> cons = getConstraints(c,visitedCons);
if(cons.size()>1)
result.add(cons);
if(cons.size()>1) {
ConstraintsWithSameLeftSide consWithSameLeftSide = new ConstraintsWithSameLeftSide(cons);
result.add(consWithSameLeftSide);
}
}
}

@ -1,6 +1,5 @@
package de.dhbwstuttgart.bytecode.utilities;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.statement.*;
import java.util.ArrayList;
@ -19,7 +18,8 @@ public class KindOfLambda implements StatementVisitor{
private boolean isInstanceCapturingLambda = false;
private List<RefTypeOrTPHOrWildcardOrGeneric> argumentList = new ArrayList<>();
private ArrayList<String> usedVars = new ArrayList<>();
private boolean hasThis = false;
private ArrayList<String> varsFromInnerLambdas = new ArrayList<>();
private boolean thisUsed = false;
private ArrayList<String> definedLocals = new ArrayList<>();
public KindOfLambda(LambdaExpression lambdaExpression) {
@ -40,19 +40,20 @@ public class KindOfLambda implements StatementVisitor{
return argumentList;
}
public boolean isHasThis() {
return hasThis;
public boolean isThisUsed() {
return thisUsed;
}
@Override
public void visit(ArgumentList argumentList) {
// TODO Auto-generated method stub
argumentList.getArguments().forEach(a->a.accept(this));
}
@Override
public void visit(LambdaExpression lambdaExpression) {
lambdaExpression.params.getFormalparalist().forEach(p->varsFromInnerLambdas.add(p.getName()));
lambdaExpression.methodBody.accept(this);
}
@Override
@ -111,9 +112,11 @@ public class KindOfLambda implements StatementVisitor{
@Override
public void visit(LocalVar localVar) {
if(!contain(params, localVar.name) && !definedLocals.contains(localVar.name)) {
boolean addVar = !contain(params, localVar.name) && !definedLocals.contains(localVar.name) &&
!varsFromInnerLambdas.contains(localVar.name) && !usedVars.contains(localVar.name);
if(addVar) {
argumentList.add(localVar.getType());
if(hasThis) {
if(thisUsed) {
usedVars.add(1, localVar.name);
} else {
usedVars.add(0, localVar.name);
@ -141,12 +144,13 @@ public class KindOfLambda implements StatementVisitor{
@Override
public void visit(MethodCall methodCall) {
methodCall.receiver.accept(this);
methodCall.arglist.accept(this);
}
@Override
public void visit(NewClass methodCall) {
// TODO Auto-generated method stub
methodCall.receiver.accept(this);
methodCall.arglist.accept(this);
}
@Override
@ -190,8 +194,8 @@ public class KindOfLambda implements StatementVisitor{
@Override
public void visit(This aThis) {
if(!hasThis) {
hasThis = true;
if(!thisUsed) {
thisUsed = true;
this.argumentList.add(0,aThis.getType());
}
if(!isInstanceCapturingLambda) {

@ -2,31 +2,37 @@ package de.dhbwstuttgart.bytecode.utilities;
import java.util.ArrayList;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.result.GenericInsertPair;
import de.dhbwstuttgart.typeinference.result.ResultPair;
public class MethodAndTPH {
private String name;
private String id;
private final ArrayList<String> tphs = new ArrayList<>();
private final ArrayList<GenericInsertPair> pairs = new ArrayList<>();
//private final ArrayList<GenericInsertPair> pairs = new ArrayList<>();
private final ArrayList<ResultPair<TypePlaceholder, TypePlaceholder>> pairs = new ArrayList<>();
// tphs of local variables and parameters
private final ArrayList<String> localTphs = new ArrayList<>();
public MethodAndTPH(String name) {
this.name = name;
this.id = name;
}
public ArrayList<String> getTphs() {
return tphs;
}
public ArrayList<GenericInsertPair> getPairs(){
// public ArrayList<GenericInsertPair> getPairs(){
// return pairs;
// }
public ArrayList<ResultPair<TypePlaceholder, TypePlaceholder>> getPairs(){
return pairs;
}
public String getName() {
return name;
public String getId() {
return id;
}
public ArrayList<String> getLocalTphs() {

@ -0,0 +1,243 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.utilities;
import de.dhbwstuttgart.bytecode.Exception.NotInCurrentPackageException;
import de.dhbwstuttgart.bytecode.descriptor.DescriptorToString;
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.statement.Expression;
import de.dhbwstuttgart.syntaxtree.statement.MethodCall;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.typeinference.result.ResultSet;
import javassist.NotFoundException;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import java.util.*;
/**
* @author fayez
*
*/
public class MethodCallHelper {
private MethodCall methCall;
private SourceFile sourceFile;
private ResultSet resultSet;
private String path;
/**
* @param methCall
* @param sourceFile
* @param resultSet
* @param path TODO
*/
public MethodCallHelper(MethodCall methCall, SourceFile sourceFile, ResultSet resultSet, String path) {
this.methCall = methCall;
this.sourceFile = sourceFile;
this.resultSet = resultSet;
this.path = path;
}
public String getResolvedType(RefTypeOrTPHOrWildcardOrGeneric type) {
return resultSet.resolveType(type).resolvedType.acceptTV(new TypeToDescriptor());
}
public boolean isInCurrPkg(String className) {
for (ClassOrInterface cl : sourceFile.KlassenVektor) {
if (className.equals(cl.getClassName().toString()))
return true;
}
return false;
}
public String getSuperClass(String className) throws NotInCurrentPackageException {
for (ClassOrInterface cl : sourceFile.getClasses()) {
if (className.equals(cl.getClassName().toString())) {
return cl.getSuperClass().getName().toString();
}
}
throw new NotInCurrentPackageException("Class " + className + " is not in the current package.");
}
public ClassOrInterface getClassFromCurrPkg(String className) throws NotInCurrentPackageException {
for (ClassOrInterface cl : sourceFile.KlassenVektor) {
if (className.equals(cl.getClassName().toString()))
return cl;
}
throw new NotInCurrentPackageException("Class of " + className + " is not in the current package.");
}
public String getDesc(String className) throws NotInCurrentPackageException, NotFoundException {
String name = methCall.name;
ClassOrInterface clazz = getClassFromCurrPkg(className);
String retType = getResolvedType(methCall.getType());
ArrayList<String> params = getTypes(methCall.arglist.getArguments());
Map<String, String> genAndBoundsClass = getGenericsAndBounds(clazz.getGenerics());
modifyGenAndBounds(genAndBoundsClass);
for (Method m : clazz.getMethods()) {
if (name.equals(m.getName()) && retType.equals(getResolvedType(m.getReturnType()))) {
ArrayList<String> paramsOfM = getTypes(m.getParameterList());
if(areEquals(params,paramsOfM)) {
Map<String, String> genAndBoundsMethod = getGenericsAndBoundsMethod(m.getGenerics());
modifyGenAndBounds(genAndBoundsMethod);
boolean hasGen = hasGen(m, genAndBoundsClass);
NormalMethod nm = new NormalMethod(m, (HashMap<String, String>) genAndBoundsClass,
(HashMap<String, String>) genAndBoundsMethod, hasGen);
return nm.accept(new DescriptorToString(resultSet));
}
}
}
throw new NotFoundException("Method " + name + " is not found");
}
private boolean areEquals(ArrayList<String> params, ArrayList<String> paramsOfM) {
if(params.size() != paramsOfM.size())
return false;
for(String t : params) {
for(String t2 : paramsOfM) {
if(!t.equals(t2))
return false;
}
}
return true;
}
private ArrayList<String> getTypes(ParameterList parameterList) {
Iterator<FormalParameter> itr = parameterList.iterator();
ArrayList<String> typeList = new ArrayList<>();
while (itr.hasNext()) {
FormalParameter fp = itr.next();
String t = getResolvedType(fp.getType());
typeList.add(t);
}
return typeList;
}
private ArrayList<String> getTypes(List<Expression> arguments) {
ArrayList<String> types = new ArrayList<>();
for(int i = 0; i<arguments.size(); ++i) {
String t = getResolvedType(arguments.get(i).getType());
types.add(t);
}
return types;
}
private boolean hasGen(Method m, Map<String, String> genericsAndBounds) {
String retType = resultSet.resolveType(m.getReturnType()).resolvedType.acceptTV(new TypeToSignature());
/*Prüfe, ob die Rückgabe-Type der Methode eine Type-Variable ist*/
boolean hasGenInParameterList = genericsAndBounds.containsKey(retType) || retType.contains("TPH ") || retType.contains("<");
Map<String,RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes = new HashMap<>();
Iterator<FormalParameter> itr = m.getParameterList().iterator();
while(itr.hasNext()) {
FormalParameter fp = itr.next();
methodParamsAndTypes.put(fp.getName(), resultSet.resolveType(fp.getType()).resolvedType);
}
/*Wenn die Rückgabe-Type eine Typ-variable ist, erzeuge direkt die Signature, wenn nicht,
* prüfe, ob einer der Parameter Typ-Variable als Typ hat*/
if(!hasGenInParameterList) {
for(String paramName : methodParamsAndTypes.keySet()) {
String typeOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToDescriptor());
String sigOfParam = methodParamsAndTypes.get(paramName).acceptTV(new TypeToSignature());
if(genericsAndBounds.containsKey(typeOfParam)||typeOfParam.contains("TPH ")||sigOfParam.contains("<")) {
hasGenInParameterList = true;
break;
}
}
}
return m.getGenerics().iterator().hasNext() || hasGenInParameterList;
}
private Map<String, String> getGenericsAndBoundsMethod(Iterable<? extends GenericTypeVar> generics) {
Map<String, String> genAndBounds = new HashMap<>();
Iterator<? extends GenericTypeVar> itr = generics.iterator();
while (itr.hasNext()) {
GenericTypeVar gtv = itr.next();
getBoundsOfTypeVar(gtv, genAndBounds);
}
return genAndBounds;
}
private void modifyGenAndBounds(Map<String, String> genAndBoundsClass) {
List<String> visited = new ArrayList<>(genAndBoundsClass.size());
Map<String, String> toReplace = new HashMap<>();
for (String tv : genAndBoundsClass.keySet()) {
if (visited.contains(tv))
continue;
List<String> types = new LinkedList<>();
String bound = genAndBoundsClass.get(tv);
types.add(tv);
visited.add(tv);
boolean doReplace = false;
while (genAndBoundsClass.keySet().contains(bound)) {
doReplace = true;
types.add(bound);
visited.add(bound);
bound = genAndBoundsClass.get(bound);
}
if (doReplace) {
for (String tt : types) {
toReplace.put(tt, bound);
}
}
}
for (String key : toReplace.keySet()) {
genAndBoundsClass.replace(key, toReplace.get(key));
}
}
private Map<String, String> getGenericsAndBounds(GenericDeclarationList generics) {
Map<String, String> genAndBounds = new HashMap<>();
Iterator<GenericTypeVar> itr = generics.iterator();
while (itr.hasNext()) {
GenericTypeVar gtv = itr.next();
getBoundsOfTypeVar(gtv, genAndBounds);
}
return genAndBounds;
}
private void getBoundsOfTypeVar(GenericTypeVar g, Map<String, String> genAndBounds) {
Iterator<? extends RefTypeOrTPHOrWildcardOrGeneric> bItr = g.getBounds().iterator();
while (bItr.hasNext()) {
RefTypeOrTPHOrWildcardOrGeneric b = bItr.next();
String boundDesc = b.acceptTV(new TypeToDescriptor());
genAndBounds.put(g.getName(), boundDesc);
}
}
public void generateBCForFunN(String methodDescriptor) {
ByteCodeForFunNGenerator.generateBCForFunN(methCall.arglist,methodDescriptor,path);
}
public String getDescriptorOfApplyMethod(String methodCallType) {
return new DescriptorToString().createDescForFunN(methCall.arglist, methodCallType);
}
/**
* @param methodCall
*/
public void createCheckCast(MethodCall methodCall, MethodVisitor mv) {
String checkCast = getResolvedType(methodCall.getType());
if(!checkCast.contains("TPH ")) {
int pos = checkCast.length();
if(checkCast.contains("<"))
pos = checkCast.indexOf("<");
mv.visitTypeInsn(Opcodes.CHECKCAST,checkCast.substring(0,pos));
}
}
}

@ -23,6 +23,7 @@ public class MethodFromMethodCall {
this.genericsAndBounds = genericsAndBounds;
}
public ArgumentList getArgList() {
return argList;
}

@ -0,0 +1,34 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.utilities;
import java.util.Iterator;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import de.dhbwstuttgart.syntaxtree.Method;
/**
* @author fayez
*
*/
public class MethodUtility {
/**
* Creates an ID for a method
*
* @param resolver type Resolver
* @param method for which the ID will be generated
* @return ID for the given method.
* ID = ReturntypeMethodname(Parametertypes)
*/
public static String createID(Resolver resolver, Method method) {
String id = resolver.getResolvedType(method.getReturnType()) + method.name + "(";
Iterator<FormalParameter> itr = method.getParameterList().iterator();
while (itr.hasNext()) {
FormalParameter fp = itr.next();
id += resolver.getResolvedType(fp.getType());
}
id += ")";
return id;
}
}

@ -4,13 +4,18 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.NameReplacementResult;
import de.dhbwstuttgart.syntaxtree.factory.NameGenerator;
public class NameReplacer {
//TODO rename
private List<TPHConstraint> constraints;
private List<TPHConstraint> allConstraints;
private List<MethodAndTPH> methodAndTPHs;
// TODO rename into tphClass
private List<String> tphs;
private List<String> localTphs;
@ -22,7 +27,98 @@ public class NameReplacer {
this.localTphs = localTphs;
}
public Map<String, List<String>> replaceNames() {
public NameReplacer(List<TPHConstraint> constraints, List<TPHConstraint> allConstraints,List<String> tphs) {
super();
this.constraints = constraints;
this.allConstraints = allConstraints;
this.tphs = tphs;
}
public NameReplacer(List<TPHConstraint> constraints, List<TPHConstraint> allConstraints) {
this.constraints = constraints;
this.allConstraints = allConstraints;
}
public NameReplacer(List<TPHConstraint> constraints, List<TPHConstraint> allConstraints, List<MethodAndTPH> methodAndTPHs,
List<String> tphsClass) {
this.constraints = constraints;
this.allConstraints = allConstraints;
this.methodAndTPHs = methodAndTPHs;
this.tphs = tphsClass;
}
public NameReplacementResult replaceNames() {
String newName = NameGenerator.makeNewName();
List<String> names = new ArrayList<>();
substituteRightSidesWithNewName(newName, names);
substituteNamesInAllConstraints(newName, names);
Stream<ArrayList<String>> tphsOfMethods = methodAndTPHs.stream().map(m->m.getTphs());
Stream<ArrayList<String>> localTphsOfMethods = methodAndTPHs.stream().map(m->m.getLocalTphs());
replaceOldNames(newName, names, tphsOfMethods);
replaceOldNames(newName, names, localTphsOfMethods);
if(tphs.removeAll(names))
tphs.add(newName);
NameReplacementResult res = new NameReplacementResult(newName, names);
return res;
}
/**
* @param newName
* @param names
* @param tphsOfMethods
*/
public void replaceOldNames(final String newName, final List<String> names, Stream<ArrayList<String>> tphsOfMethods) {
tphsOfMethods.forEach(tphsMethod->{
if(tphsMethod.removeAll(names))
tphsMethod.add(newName);
});
}
public NameReplacementResult replaceNamesLocal() {
String newName = NameGenerator.makeNewName();
List<String> names = new ArrayList<>();
substituteRightSidesWithNewName(newName, names);
substituteNamesInAllConstraints(newName, names);
tphs.removeAll(names);
tphs.add(newName);
NameReplacementResult res = new NameReplacementResult(newName, names);
return res;
}
/**
* @param newName
* @param names
*/
public void substituteNamesInAllConstraints(String newName, List<String> names) {
for(TPHConstraint cons : allConstraints) {
if(names.contains(cons.getLeft()))
cons.setLeft(newName);
if(names.contains(cons.getRight()))
cons.setRight(newName);
}
}
/**
* @param newName
* @param names
*/
public void substituteRightSidesWithNewName(String newName, List<String> names) {
for(TPHConstraint cons : constraints) {
names.add(cons.getRight());
cons.setRight(newName);
}
}
public Map<String, List<String>> replaceNamesWithLocals() {
String newName = NameGenerator.makeNewName();
ArrayList<String> names = new ArrayList<>();
for(TPHConstraint cons : constraints) {

@ -0,0 +1,28 @@
/**
*
*/
package de.dhbwstuttgart.bytecode.utilities;
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.typeinference.result.ResultSet;
/**
* @author fayez
*
*/
public class Resolver {
private ResultSet resultSet;
/**
* @param resultSet
*/
public Resolver(ResultSet resultSet) {
this.resultSet = resultSet;
}
public String getResolvedType(RefTypeOrTPHOrWildcardOrGeneric type) {
return resultSet.resolveType(type).resolvedType.acceptTV(new TypeToDescriptor());
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -35,7 +35,7 @@ public class SyntaxTreeGenerator{
Set<JavaClassName> imports = new HashSet();
private Map<String, RefTypeOrTPHOrWildcardOrGeneric> fields = new HashMap<>(); //PL 2018-11-01 fields eingefuegt, damit die fields immer die gleiche TPH bekommen
List<Statement> fieldInitializations = new ArrayList<>();
List<Statement> fieldInitializations = new ArrayList<>(); //PL 2019-10-23: Muss für jede Klasse neu initilisiert werden
public SyntaxTreeGenerator(JavaClassRegistry reg, GenericsRegistry globalGenerics){
//Die Generics müssen während des Bauens des AST erstellt werden,
@ -159,6 +159,7 @@ public class SyntaxTreeGenerator{
private ClassOrInterface convertClass(Java8Parser.ClassDeclarationContext ctx) {
ClassOrInterface newClass;
fieldInitializations = new ArrayList<>(); //PL 2019-10-22: muss für jede Klasse neu initilisiert werden
if(ctx.normalClassDeclaration() != null){
newClass = convertNormal(ctx.normalClassDeclaration());
}

@ -2,6 +2,10 @@ package de.dhbwstuttgart.syntaxtree;
import org.antlr.v4.runtime.Token;
import com.google.common.collect.Lists;
import de.dhbwstuttgart.parser.NullToken;
import java.util.*;
@ -15,11 +19,21 @@ public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<G
private Token offsetOfLastElement;
private List<GenericTypeVar> gtvs = new ArrayList<>();
public GenericDeclarationList(List<GenericTypeVar> values, Token endOffset) {
@SuppressWarnings("unchecked")
public GenericDeclarationList(Iterable<? extends GenericTypeVar> values, Token endOffset) {
super(endOffset);
gtvs = isListOfGenericTypeVar(values) ? (List<GenericTypeVar>)values : Lists.newArrayList(values);
this.offsetOfLastElement = endOffset;
}
public GenericDeclarationList(ArrayList<GenericTypeVar> values, Token endOffset) {
super(endOffset);
gtvs = values;
this.offsetOfLastElement = endOffset;
this.offsetOfLastElement = endOffset; }
private boolean isListOfGenericTypeVar(Iterable<? extends GenericTypeVar> values) {
return values instanceof List && ((List<?>)values).size() > 0 && ((List<?>)values).get(0) instanceof GenericTypeVar;
}
@Override

@ -100,7 +100,7 @@ public class UnifyTypeFactory {
}
ret = new ReferenceType(t.getName().toString(),new TypeParams(params));
}else{
ret = new ReferenceType(t.getName().toString());
ret = new ReferenceType(t.getName().toString(), false);
}
return ret;
}
@ -136,7 +136,7 @@ public class UnifyTypeFactory {
}
public static UnifyType convert(GenericRefType t, Boolean innerType){
return new ReferenceType(t.getParsedName());
return new ReferenceType(t.getParsedName(), true);
}
public static UnifyType convert(WildcardType t, Boolean innerType){
@ -222,12 +222,15 @@ public class UnifyTypeFactory {
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (RefType) tr);
}else if(tr instanceof WildcardType){
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (WildcardType) tr);
}else if(tr instanceof GenericRefType){
return new PairTPHequalRefTypeOrWildcardType((TypePlaceholder)tl, (GenericRefType) tr);
}else throw new NotImplementedException();
}else throw new NotImplementedException();
}
public static RefTypeOrTPHOrWildcardOrGeneric convert(ReferenceType t, Map<String,TypePlaceholder> tphs) {
if(JavaClassName.Void.equals(t.getName()))return new Void(new NullToken());
if (t.isGenTypeVar()) return new GenericRefType(t.getName(),new NullToken());
RefType ret = new RefType(new JavaClassName(t.getName()),convert(t.getTypeParams(), tphs),new NullToken());
return ret;
}

@ -1,24 +1,24 @@
package de.dhbwstuttgart.syntaxtree.statement;
import java.util.List;
import de.dhbwstuttgart.syntaxtree.StatementVisitor;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
import de.dhbwstuttgart.exceptions.NotImplementedException;
public class NewArray extends Expression
{
public NewArray(int offset,int variableLength)
{
super(null,null);
}
private RefTypeOrTPHOrWildcardOrGeneric type;
public List<Expression> expr;
@Override
public void accept(StatementVisitor visitor) {
visitor.visit(this);
}
}
package de.dhbwstuttgart.syntaxtree.statement;
import java.util.List;
import de.dhbwstuttgart.syntaxtree.StatementVisitor;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.typeinference.assumptions.TypeInferenceBlockInformation;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
import de.dhbwstuttgart.exceptions.NotImplementedException;
public class NewArray extends Expression
{
public NewArray(int offset,int variableLength)
{
super(null,null);
}
private RefTypeOrTPHOrWildcardOrGeneric type;
public List<Expression> expr;
@Override
public void accept(StatementVisitor visitor) {
visitor.visit(this);
}
}

@ -19,4 +19,8 @@ public class This extends Expression
public void accept(StatementVisitor visitor) {
visitor.visit(this);
}
public String toString() {
return "this: "+ this.getType();
}
}

@ -1,22 +1,23 @@
package de.dhbwstuttgart.typedeployment;
import org.antlr.v4.runtime.Token;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import de.dhbwstuttgart.typeinference.result.ResultPair;
public class TypeInsert {
/**
* point wird hauptsächlich zur Anzeige einer Annotation im Eclipse-plugin benutzt.
*/
public final TypeInsertPoint point;
Set<TypeInsertPoint> inserts;
ResultPair<?, ?> resultPair;
public TypeInsert(TypeInsertPoint point, Set<TypeInsertPoint> additionalPoints){
public TypeInsert(TypeInsertPoint point, Set<TypeInsertPoint> additionalPoints, ResultPair<?, ?> resultPair){
this.point = point;
inserts = additionalPoints;
this.resultPair = resultPair;
}
public String insert(String intoSource){
@ -34,6 +35,10 @@ public class TypeInsert {
return point.getInsertString();
}
public ResultPair<?, ?> getResultPair() {
return this.resultPair;
}
/* PL 2018-06-18
* Zwei TypeInsert's sind gleich, wenn ihre point's und ihre inserts' gleich sind
* eingefuegt damit man TypeReplaceMarker vergleichen kann

@ -1,9 +1,18 @@
package de.dhbwstuttgart.typedeployment;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass;
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
import de.dhbwstuttgart.bytecode.utilities.Resolver;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.parser.NullToken;
import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.type.*;
import de.dhbwstuttgart.typeinference.result.*;
import org.antlr.v4.runtime.Token;
import org.objectweb.asm.Type;
import java.util.*;
@ -29,62 +38,90 @@ public class TypeInsertFactory {
public static TypeInsert createInsertPoints(RefTypeOrTPHOrWildcardOrGeneric type, Token offset, ClassOrInterface cl, Method m,
ResultSet resultSet) {
ResolvedType resolvedType = resultSet.resolveType(type);
TypeInsertPoint insertPoint = new TypeInsertPoint(offset,
new TypeToInsertString(resolvedType.resolvedType).insert);
return new TypeInsert(insertPoint, new HashSet<>(Arrays.asList(createGenericInsert(resolvedType.additionalGenerics, cl, m))));
try {
ResolvedType resolvedType = resultSet.resolveType(type);
TypeInsertPoint insertPoint = new TypeInsertPoint(offset,
new TypeToInsertString(resolvedType.resolvedType).insert);
List<GenericGenratorResultForSourceFile> simplifyResults = JavaTXCompiler.INSTANCE.getGeneratedGenericResultsForAllSourceFiles();
for (GenericGenratorResultForSourceFile simplifyResultsEntries : simplifyResults) {
GenericsGeneratorResultForClass genericResultsForClass = simplifyResultsEntries.getSimplifyResultsByName("", cl.getClassName().toString());
return new TypeInsert(insertPoint, createGenericInsert(genericResultsForClass, cl, m, resultSet), resolvedType.getResultPair());
}
return new TypeInsert(insertPoint, new HashSet<>(), resolvedType.getResultPair());
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
private static TypeInsertPoint createGenericInsert(Set<GenericInsertPair> toInsert, ClassOrInterface cl, Method m){
//Momentan wird Methode ignoriert. Parameter werden immer als Klassenparameter angefügt:
//Offset zum Einstzen bestimmen:
Token offset;
String insert = "";
String end;
if(cl.getGenerics().iterator().hasNext()){
//offset = cl.getGenerics().iterator().next().getOffset();
offset = cl.getGenerics().getOffset();
end=",";
}else{
offset = cl.getGenerics().getOffset();
insert += "<";
end = ">";
private static synchronized Set<TypeInsertPoint> createGenericInsert(GenericsGeneratorResultForClass genericResult, ClassOrInterface cl, Method m, ResultSet resultSet){
Set<TypeInsertPoint> result = createGenericClassInserts(genericResult, cl);
for (Method method : cl.getMethods()) {
Resolver resolver = new Resolver(resultSet);
List<GenericsGeneratorResult> methodConstraints = genericResult.getMethodConstraintsByID(MethodUtility.createID(resolver, method));
createMethodConstraints(method, methodConstraints);
}
//Alle einzusetzenden Generics und deren Bounds bestimmen:
HashMap<TypePlaceholder, HashSet<TypePlaceholder>> genericsAndBounds = new HashMap<>();
for(GenericInsertPair p : toInsert){
if(!genericsAndBounds.containsKey(p.TA1)){
genericsAndBounds.put((TypePlaceholder) p.TA1, new HashSet<>());
}
if(p.TA2 != null){
genericsAndBounds.get(p.TA1).add((TypePlaceholder) p.TA2);
if(!genericsAndBounds.containsKey(p.TA2)){
genericsAndBounds.put((TypePlaceholder) p.TA2, new HashSet<>());
}
}
}
//String zum Einsetzen (Generics mit bounds) generieren:
Iterator<TypePlaceholder> it = genericsAndBounds.keySet().iterator();
if(! it.hasNext())return new TypeInsertPoint(offset, "");
while(it.hasNext()){
TypePlaceholder tph = it.next();
insert += tph.getName();
Set<TypePlaceholder> bounds = genericsAndBounds.get(tph);
if(bounds.size() > 0){
insert += " extends ";
Iterator<TypePlaceholder> boundIt = bounds.iterator();
while(boundIt.hasNext()){
TypePlaceholder bound = boundIt.next();
insert += bound.getName();
if(boundIt.hasNext())insert += " & ";
}
}
if(it.hasNext())insert+=",";
}
return new TypeInsertPoint(offset, insert + end);
return result;
}
private static Set<TypeInsertPoint> createMethodConstraints(Method method, List<GenericsGeneratorResult> constraints) {
Set<TypeInsertPoint> result = new HashSet<>();
Token offset = new GenericDeclarationList(method.getGenerics(), new NullToken()).getOffset();
if (constraints.size() == 0) {
result.add(new TypeInsertPoint(offset, ""));
return result;
}
String insert = " <";
for (GenericsGeneratorResult genericInsertConstraint : constraints) {
if (genericInsertConstraint.getConstraint().getRight().equals(Type.getInternalName(Object.class))) {
insert += genericInsertConstraint.getConstraint().getLeft();
} else {
insert += genericInsertConstraint.getConstraint().getLeft() + " extends " + genericInsertConstraint.getConstraint().getRight() + ", ";
}
}
insert = insert.substring(0, insert.length() -2);
insert += ">";
result.add(new TypeInsertPoint(offset, insert));
return result;
}
private static Set<TypeInsertPoint> createGenericClassInserts(GenericsGeneratorResultForClass genericResult, ClassOrInterface cl) {
Set<TypeInsertPoint> result = new HashSet<>();
Token offset = cl.getGenerics().getOffset();
List<GenericsGeneratorResult> classConstraints = genericResult.getClassConstraints();
if (classConstraints.size() == 0) {
result.add(new TypeInsertPoint(offset, ""));
return result;
}
String insert = " <";
for (GenericsGeneratorResult genericInsertConstraint : classConstraints) {
if (genericInsertConstraint.getConstraint().getRight().equals(Type.getInternalName(Object.class))) {
insert += genericInsertConstraint.getConstraint().getLeft();
} else {
insert += genericInsertConstraint.getConstraint().getLeft() + " extends " + genericInsertConstraint.getConstraint().getRight() + ", ";
}
}
insert = insert.substring(0, insert.length() -2);
insert += ">";
result.add(new TypeInsertPoint(offset, insert));
return result;
}
}
class TypeToInsertString implements ResultSetVisitor{

@ -4,12 +4,14 @@ import org.antlr.v4.runtime.Token;
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.stream.Collectors;
public class TypeInsertPoint {
public final Token point;
public Token point;
private String insertString;
private int extraOffset = 0;
public TypeInsertPoint(Token point, String toInsert){
this.point = point;
@ -21,12 +23,20 @@ public class TypeInsertPoint {
//token.point.getLine() != point.getLine() && token.point.getCharPositionInLine() <= point.getCharPositionInLine()))
token.point.getStartIndex() <= point.getStartIndex()))
.mapToInt((typeInsertPoint -> typeInsertPoint.insertString.length())).sum();
return new StringBuilder(intoSource).insert(point.getStartIndex()+offset, insertString).toString();
return new StringBuilder(intoSource).insert(point.getStartIndex()+offset+extraOffset, insertString).toString();
}
public String getInsertString() {
return insertString;
}
public void addExtraOffset(int toAdd) {
this.extraOffset += toAdd;
}
public int getPositionInCode() {
return point.getStartIndex() + extraOffset;
}
/* PL 2018-06-19
* Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind

@ -23,4 +23,9 @@ public class GenericInsertPair {
if(TA2.equals(additionalTPH))return true;
return false;
}
@Override
public String toString() {
return "GenIns(" + TA1.toString() + " < " + TA2.toString() + ")";
}
}

@ -21,4 +21,9 @@ public class PairTPHequalRefTypeOrWildcardType extends ResultPair{
public void accept(ResultPairVisitor visitor) {
visitor.visit(this);
}
@Override
public String toString() {
return "(" + left.toString() + " = " + right.toString() + ")";
}
}

@ -20,4 +20,9 @@ public class PairTPHsmallerTPH extends ResultPair{
public void accept(ResultPairVisitor visitor) {
visitor.visit(this);
}
@Override
public String toString() {
return "(" + left.toString() + " < " + right.toString() + ")";
}
}

@ -7,11 +7,21 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import java.util.Set;
public class ResolvedType{
private ResultPair<?, ?> resultPair;
public final RefTypeOrTPHOrWildcardOrGeneric resolvedType;
public final Set<GenericInsertPair> additionalGenerics;
//public final Set<GenericInsertPair> additionalGenerics;
public ResolvedType(RefTypeOrTPHOrWildcardOrGeneric resolvedType, Set<GenericInsertPair> additionalGenerics){
this.resolvedType = resolvedType;
this.additionalGenerics = additionalGenerics;
//this.additionalGenerics = additionalGenerics;
}
public void setResultPair(ResultPair<?, ?> resultPair) {
this.resultPair = resultPair;
}
public ResultPair<?, ?> getResultPair() {
return resultPair;
}
}

@ -27,4 +27,36 @@ public abstract class ResultPair<A extends RefTypeOrTPHOrWildcardOrGeneric,B ext
public String toString() {
return "(" + left.toString() + ", " + right.toString() + ")";
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((left == null) ? 0 : left.getOffset().hashCode());
result = prime * result + ((right == null) ? 0 : right.getOffset().hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResultPair<?,?> other = (ResultPair<?,?>) obj;
if (left == null) {
if (other.left != null)
return false;
} else if (!left.getOffset().equals(other.left.getOffset()))
return false;
if (right == null) {
if (other.right != null)
return false;
} else if (!right.getOffset().equals(other.right.getOffset()))
return false;
return true;
}
}

@ -1,38 +1,68 @@
package de.dhbwstuttgart.typeinference.result;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.*;
import java.util.HashSet;
import java.util.Set;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
@SuppressWarnings("rawtypes")
public class ResultSet {
public final Set<ResultPair> results;
public ResultSet(Set<ResultPair> results){
this.results = results;
public Set<ResultPair<TypePlaceholder, TypePlaceholder>> genIns;
public ResultSet(Set<ResultPair> set){
this.results = set;
this.genIns = new HashSet<>();
results.forEach(x -> { if (x instanceof PairTPHsmallerTPH) { this.genIns.add(x);}} );
}
public boolean contains(ResultPair toCheck) {
return this.results.contains(toCheck);
}
public void remove(ResultPair toCheck) {
results.remove(toCheck);
}
public ResolvedType resolveType(RefTypeOrTPHOrWildcardOrGeneric type) {
if(type instanceof TypePlaceholder)
return new Resolver(this).resolve((TypePlaceholder)type);
if(type instanceof GenericRefType)return new ResolvedType(type, new HashSet<>());
if(type instanceof RefType){
if(type instanceof RefType) {
RelatedTypeWalker related = new RelatedTypeWalker(null, this);
type.accept(related);
return new ResolvedType(type, related.relatedTPHs);
}else{
} else {
throw new NotImplementedException();
//return new ResolvedType(type,new HashSet<>());
}
}
//TODO Beim Einsetzen eines Generics, müssen die new und Methodenaufrufe verändert werden
public String toString() {
return results.toString();
}
@Override
public boolean equals(Object o) {
if (o instanceof ResultSet) {
ResultSet other = (ResultSet)o;
return this.results.equals(other.results);
} else {
return false;
}
}
@Override
public int hashCode() {
return results.hashCode();
}
}
class Resolver implements ResultSetVisitor {
@ -40,6 +70,7 @@ class Resolver implements ResultSetVisitor {
private TypePlaceholder toResolve;
private RefTypeOrTPHOrWildcardOrGeneric resolved;
private final Set<GenericInsertPair> additionalTPHs = new HashSet<>();
private ResultPair<?,?> currentPair;
public Resolver(ResultSet resultPairs){
this.result = resultPairs;
@ -49,23 +80,28 @@ class Resolver implements ResultSetVisitor {
toResolve = tph;
resolved = null;
System.out.println(tph.toString());
for(ResultPair resultPair : result.results){
for(ResultPair<?,?> resultPair : result.results) {
if(resultPair instanceof PairTPHEqualTPH && ((PairTPHEqualTPH) resultPair).getLeft().equals(toResolve)){
currentPair = resultPair;
return resolve(((PairTPHEqualTPH) resultPair).getRight());
}
}
for(ResultPair resultPair : result.results){
for(ResultPair<?,?> resultPair : result.results){
currentPair = resultPair;
resultPair.accept(this);
}
if(resolved==null){//TPH kommt nicht im Result vor:
resolved = tph;
}
return new ResolvedType(resolved, additionalTPHs);//resolved;
ResolvedType result = new ResolvedType(resolved, additionalTPHs);//resolved;
result.setResultPair(currentPair);
return result;
}
@Override
public void visit(PairTPHsmallerTPH p) {
currentPair = p;
if(p.left.equals(toResolve)){
additionalTPHs.add(new GenericInsertPair(p.left, p.right));
additionalTPHs.addAll(new RelatedTypeWalker(p.right, result).relatedTPHs);
@ -76,6 +112,7 @@ class Resolver implements ResultSetVisitor {
@Override
public void visit(PairTPHequalRefTypeOrWildcardType p) {
currentPair = p;
if(p.left.equals(toResolve)){
resolved = p.right;
RelatedTypeWalker related = new RelatedTypeWalker(null, result);
@ -121,6 +158,7 @@ class Resolver implements ResultSetVisitor {
/**
* Sucht aus dem Result Set den Sub/supertyp für einen TPH
*/
@SuppressWarnings("rawtypes")
class TPHResolver implements ResultSetVisitor {
private final TypePlaceholder tph;
@ -189,6 +227,7 @@ class TPHResolver implements ResultSetVisitor {
}
}
@SuppressWarnings("rawtypes")
class RelatedTypeWalker implements ResultSetVisitor {
final Set<GenericInsertPair> relatedTPHs = new HashSet<>();

@ -229,7 +229,7 @@ public class TYPEStmt implements StatementVisitor{
binary.operation.equals(BinaryExpr.Operator.MUL)||
binary.operation.equals(BinaryExpr.Operator.MOD)||
binary.operation.equals(BinaryExpr.Operator.ADD)||
binary.operation.equals(BinaryExpr.Operator.SUB)){
binary.operation.equals(BinaryExpr.Operator.SUB)) {
Set<Constraint<Pair>> numericAdditionOrStringConcatenation = new HashSet<>();
// TODO PL 2018-11-06
@ -312,6 +312,9 @@ public class TYPEStmt implements StatementVisitor{
numericAdditionOrStringConcatenation.add(stringConcat);
}
}
if(numericAdditionOrStringConcatenation.size()<1){
throw new TypeinferenceException("Kein Typ für " + binary.operation.toString() + " vorhanden", binary.getOffset());
}
constraintsSet.addOderConstraint(numericAdditionOrStringConcatenation);
}else if(binary.operation.equals(BinaryExpr.Operator.LESSEQUAL) ||
binary.operation.equals(BinaryExpr.Operator.BIGGEREQUAL) ||
@ -355,6 +358,7 @@ public class TYPEStmt implements StatementVisitor{
//***ACHTUNG: Moeglicherweise oder und und-Contraint falsch
*/
//Testeise eingefuegt PL 2018-05-24
//Hier sollte evtl. noch importe angefragt werden PL 2019-05-07
constraintsSet.addUndConstraint(new Pair(binary.lexpr.getType(), number, PairOperator.SMALLERNEQDOT));
constraintsSet.addUndConstraint(new Pair(binary.rexpr.getType(), number, PairOperator.SMALLERNEQDOT));
//Rückgabetyp ist Boolean

@ -1,23 +1,23 @@
package de.dhbwstuttgart.typeinference.unify;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Sets;
import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations;
/**
* Implements set operations using google guava.
* @author DH10STF
*
*/
public class GuavaSetOperations implements ISetOperations {
@Override
public <B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets) {
// Wraps the call to google guava
return Sets.cartesianProduct(sets);
}
}
package de.dhbwstuttgart.typeinference.unify;
import java.util.List;
import java.util.Set;
import com.google.common.collect.Sets;
import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations;
/**
* Implements set operations using google guava.
* @author DH10STF
*
*/
public class GuavaSetOperations implements ISetOperations {
@Override
public <B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets) {
// Wraps the call to google guava
return Sets.cartesianProduct(sets);
}
}

@ -1,108 +1,108 @@
package de.dhbwstuttgart.typeinference.unify;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
/**
* Implementation of the Martelli-Montanari unification algorithm.
* @author Florian Steurer
*/
public class MartelliMontanariUnify implements IUnify {
@Override
public Optional<Unifier> unify(Set<UnifyType> terms) {
// Sets with less than 2 terms are trivially unified
if(terms.size() < 2)
return Optional.of(Unifier.identity());
// For the the set of terms {t1,...,tn},
// build a list of equations {(t1 = t2), (t2 = t3), (t3 = t4), ....}
ArrayList<UnifyPair> termsList = new ArrayList<UnifyPair>();
Iterator<UnifyType> iter = terms.iterator();
UnifyType prev = iter.next();
package de.dhbwstuttgart.typeinference.unify;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
/**
* Implementation of the Martelli-Montanari unification algorithm.
* @author Florian Steurer
*/
public class MartelliMontanariUnify implements IUnify {
@Override
public Optional<Unifier> unify(Set<UnifyType> terms) {
// Sets with less than 2 terms are trivially unified
if(terms.size() < 2)
return Optional.of(Unifier.identity());
// For the the set of terms {t1,...,tn},
// build a list of equations {(t1 = t2), (t2 = t3), (t3 = t4), ....}
ArrayList<UnifyPair> termsList = new ArrayList<UnifyPair>();
Iterator<UnifyType> iter = terms.iterator();
UnifyType prev = iter.next();
while(iter.hasNext()) {
UnifyType next = iter.next();
UnifyType next = iter.next();
termsList.add(new UnifyPair(prev, next, PairOperator.EQUALSDOT));
prev = next;
}
// Start with the identity unifier. Substitutions will be added later.
Unifier mgu = Unifier.identity();
// Apply rules while possible
int idx = 0;
while(idx < termsList.size()) {
UnifyPair pair = termsList.get(idx);
UnifyType rhsType = pair.getRhsType();
UnifyType lhsType = pair.getLhsType();
TypeParams rhsTypeParams = rhsType.getTypeParams();
TypeParams lhsTypeParams = lhsType.getTypeParams();
// REDUCE - Rule
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
Set<UnifyPair> result = new HashSet<>();
// f<...> = g<...> with f != g are not unifiable
if(!rhsType.getName().equals(lhsType.getName()))
return Optional.empty(); // conflict
// f<t1,...,tn> = f<s1,...,sm> are not unifiable
if(rhsTypeParams.size() != lhsTypeParams.size())
return Optional.empty(); // conflict
// f = g is not unifiable (cannot be f = f because erase rule would have been applied)
//if(rhsTypeParams.size() == 0)
//return Optional.empty();
// Unpack the arguments
for(int i = 0; i < rhsTypeParams.size(); i++)
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
termsList.remove(idx);
termsList.addAll(result);
continue;
}
// DELETE - Rule
if(pair.getRhsType().equals(pair.getLhsType())) {
termsList.remove(idx);
continue;
}
// SWAP - Rule
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
termsList.remove(idx);
termsList.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT));
continue;
}
// OCCURS-CHECK
if(pair.getLhsType() instanceof PlaceholderType
&& pair.getRhsType().getTypeParams().occurs((PlaceholderType) pair.getLhsType()))
return Optional.empty();
// SUBST - Rule
if(lhsType instanceof PlaceholderType) {
mgu.add((PlaceholderType) lhsType, rhsType);
//PL 2018-04-01 nach checken, ob es richtig ist, dass keine Substitutionen uebergeben werden muessen.
termsList = termsList.stream().map(x -> mgu.apply(x)).collect(Collectors.toCollection(ArrayList::new));
idx = idx+1 == termsList.size() ? 0 : idx+1;
continue;
}
idx++;
}
return Optional.of(mgu);
}
}
prev = next;
}
// Start with the identity unifier. Substitutions will be added later.
Unifier mgu = Unifier.identity();
// Apply rules while possible
int idx = 0;
while(idx < termsList.size()) {
UnifyPair pair = termsList.get(idx);
UnifyType rhsType = pair.getRhsType();
UnifyType lhsType = pair.getLhsType();
TypeParams rhsTypeParams = rhsType.getTypeParams();
TypeParams lhsTypeParams = lhsType.getTypeParams();
// REDUCE - Rule
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
Set<UnifyPair> result = new HashSet<>();
// f<...> = g<...> with f != g are not unifiable
if(!rhsType.getName().equals(lhsType.getName()))
return Optional.empty(); // conflict
// f<t1,...,tn> = f<s1,...,sm> are not unifiable
if(rhsTypeParams.size() != lhsTypeParams.size())
return Optional.empty(); // conflict
// f = g is not unifiable (cannot be f = f because erase rule would have been applied)
//if(rhsTypeParams.size() == 0)
//return Optional.empty();
// Unpack the arguments
for(int i = 0; i < rhsTypeParams.size(); i++)
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
termsList.remove(idx);
termsList.addAll(result);
continue;
}
// DELETE - Rule
if(pair.getRhsType().equals(pair.getLhsType())) {
termsList.remove(idx);
continue;
}
// SWAP - Rule
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
termsList.remove(idx);
termsList.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT));
continue;
}
// OCCURS-CHECK
if(pair.getLhsType() instanceof PlaceholderType
&& pair.getRhsType().getTypeParams().occurs((PlaceholderType) pair.getLhsType()))
return Optional.empty();
// SUBST - Rule
if(lhsType instanceof PlaceholderType) {
mgu.add((PlaceholderType) lhsType, rhsType);
//PL 2018-04-01 nach checken, ob es richtig ist, dass keine Substitutionen uebergeben werden muessen.
termsList = termsList.stream().map(x -> mgu.apply(x)).collect(Collectors.toCollection(ArrayList::new));
idx = idx+1 == termsList.size() ? 0 : idx+1;
continue;
}
idx++;
}
return Optional.of(mgu);
}
}

@ -1,91 +1,91 @@
package de.dhbwstuttgart.typeinference.unify;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.interfaces.IMatch;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
/**
* Implementation of match derived from unification algorithm.
* @author Martin Pluemicke
*/
public class Match implements IMatch {
@Override
//A<X> =. A<Integer> ==> True
//A<Integer> =. A<X> ==> False
public Optional<Unifier> match(ArrayList<UnifyPair> termsList) {
// Start with the identity unifier. Substitutions will be added later.
Unifier mgu = Unifier.identity();
// Apply rules while possible
int idx = 0;
while(idx < termsList.size()) {
UnifyPair pair = termsList.get(idx);
UnifyType rhsType = pair.getRhsType();
UnifyType lhsType = pair.getLhsType();
TypeParams rhsTypeParams = rhsType.getTypeParams();
TypeParams lhsTypeParams = lhsType.getTypeParams();
// REDUCE - Rule
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
Set<UnifyPair> result = new HashSet<>();
// f<...> = g<...> with f != g are not unifiable
if(!rhsType.getName().equals(lhsType.getName()))
return Optional.empty(); // conflict
// f<t1,...,tn> = f<s1,...,sm> are not unifiable
if(rhsTypeParams.size() != lhsTypeParams.size())
return Optional.empty(); // conflict
// f = g is not unifiable (cannot be f = f because erase rule would have been applied)
//if(rhsTypeParams.size() == 0)
//return Optional.empty();
// Unpack the arguments
for(int i = 0; i < rhsTypeParams.size(); i++)
result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT));
termsList.remove(idx);
termsList.addAll(result);
continue;
}
// DELETE - Rule
if(pair.getRhsType().equals(pair.getLhsType())) {
termsList.remove(idx);
continue;
}
// SWAP - Rule
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
return Optional.empty(); // conflict
}
// OCCURS-CHECK
//deleted
// SUBST - Rule
if(lhsType instanceof PlaceholderType) {
mgu.add((PlaceholderType) lhsType, rhsType);
termsList = termsList.stream().map(mgu::applyleft).collect(Collectors.toCollection(ArrayList::new));
idx = idx+1 == termsList.size() ? 0 : idx+1;
continue;
}
idx++;
}
return Optional.of(mgu);
}
}
package de.dhbwstuttgart.typeinference.unify;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.interfaces.IMatch;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
/**
* Implementation of match derived from unification algorithm.
* @author Martin Pluemicke
*/
public class Match implements IMatch {
@Override
//A<X> =. A<Integer> ==> True
//A<Integer> =. A<X> ==> False
public Optional<Unifier> match(ArrayList<UnifyPair> termsList) {
// Start with the identity unifier. Substitutions will be added later.
Unifier mgu = Unifier.identity();
// Apply rules while possible
int idx = 0;
while(idx < termsList.size()) {
UnifyPair pair = termsList.get(idx);
UnifyType rhsType = pair.getRhsType();
UnifyType lhsType = pair.getLhsType();
TypeParams rhsTypeParams = rhsType.getTypeParams();
TypeParams lhsTypeParams = lhsType.getTypeParams();
// REDUCE - Rule
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
Set<UnifyPair> result = new HashSet<>();
// f<...> = g<...> with f != g are not unifiable
if(!rhsType.getName().equals(lhsType.getName()))
return Optional.empty(); // conflict
// f<t1,...,tn> = f<s1,...,sm> are not unifiable
if(rhsTypeParams.size() != lhsTypeParams.size())
return Optional.empty(); // conflict
// f = g is not unifiable (cannot be f = f because erase rule would have been applied)
//if(rhsTypeParams.size() == 0)
//return Optional.empty();
// Unpack the arguments
for(int i = 0; i < rhsTypeParams.size(); i++)
result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT));
termsList.remove(idx);
termsList.addAll(result);
continue;
}
// DELETE - Rule
if(pair.getRhsType().equals(pair.getLhsType())) {
termsList.remove(idx);
continue;
}
// SWAP - Rule
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
return Optional.empty(); // conflict
}
// OCCURS-CHECK
//deleted
// SUBST - Rule
if(lhsType instanceof PlaceholderType) {
mgu.add((PlaceholderType) lhsType, rhsType);
termsList = termsList.stream().map(mgu::applyleft).collect(Collectors.toCollection(ArrayList::new));
idx = idx+1 == termsList.size() ? 0 : idx+1;
continue;
}
idx++;
}
return Optional.of(mgu);
}
}

File diff suppressed because it is too large Load Diff

@ -1,119 +1,121 @@
package de.dhbwstuttgart.typeinference.unify;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ForkJoinPool;
import de.dhbwstuttgart.typeinference.constraints.Constraint;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
import de.dhbwstuttgart.typeinference.constraints.Pair;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
public class TypeUnify {
/**
* unify parallel ohne result modell
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @return
*/
public Set<Set<UnifyPair>> unify(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret);
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join();
try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements + "\n");
logFile.flush();
}
catch (IOException e) {
System.err.println("no log-File");
}
return res;
}
/**
* unify asynchron mit Rückgabe UnifyResultModel ohne dass alle results gesammelt sind
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @param ret
* @return
*/
public UnifyResultModel unifyAsync(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret);
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
return ret;
}
/**
* unify parallel mit Rückgabe UnifyResultModel nachdem alle results gesammelt sind
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @param ret
* @return
*/
public UnifyResultModel unifyParallel(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret);
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join();
try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n");
logFile.flush();
}
catch (IOException e) {
System.err.println("no log-File");
}
return ret;
}
/*
public Set<Set<UnifyPair>> unifySequential(Set<UnifyPair> eq, IFiniteClosure fc, FileWriter logFile, Boolean log) {
TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, false, logFile, log);
Set<Set<UnifyPair>> res = unifyTask.compute();
return res;
}
*/
/**
* unify sequentiell mit oderconstraints
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @return
*/
public Set<Set<UnifyPair>> unifyOderConstraints(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, false, logFile, log, 0, ret);
Set<Set<UnifyPair>> res = unifyTask.compute();
try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n");
logFile.flush();
}
catch (IOException e) {
System.err.println("no log-File");
}
return res;
}
}
package de.dhbwstuttgart.typeinference.unify;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ForkJoinPool;
import de.dhbwstuttgart.core.JavaTXCompiler;
import de.dhbwstuttgart.typeinference.constraints.Constraint;
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
import de.dhbwstuttgart.typeinference.constraints.Pair;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
public class TypeUnify {
/**
* unify parallel ohne result modell
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @return
*/
public Set<Set<UnifyPair>> unify(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks);
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join();
try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements + "\n");
logFile.flush();
}
catch (IOException e) {
System.err.println("no log-File");
}
return res;
}
/**
* unify asynchron mit Rückgabe UnifyResultModel ohne dass alle results gesammelt sind
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @param ret
* @return
*/
public UnifyResultModel unifyAsync(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks);
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
return ret;
}
/**
* unify parallel mit Rückgabe UnifyResultModel nachdem alle results gesammelt sind
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @param ret
* @return
*/
public UnifyResultModel unifyParallel(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, true, logFile, log, 0, ret, usedTasks);
ForkJoinPool pool = new ForkJoinPool();
pool.invoke(unifyTask);
Set<Set<UnifyPair>> res = unifyTask.join();
try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n");
logFile.flush();
}
catch (IOException e) {
System.err.println("no log-File");
}
return ret;
}
/*
public Set<Set<UnifyPair>> unifySequential(Set<UnifyPair> eq, IFiniteClosure fc, FileWriter logFile, Boolean log) {
TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, false, logFile, log);
Set<Set<UnifyPair>> res = unifyTask.compute();
return res;
}
*/
/**
* unify sequentiell mit oderconstraints
* @param undConstrains
* @param oderConstraints
* @param fc
* @param logFile
* @param log
* @param cons
* @return
*/
public Set<Set<UnifyPair>> unifyOderConstraints(Set<UnifyPair> undConstrains, List<Set<Set<UnifyPair>>> oderConstraints, IFiniteClosure fc, Writer logFile, Boolean log, UnifyResultModel ret, UnifyTaskModel usedTasks) {
TypeUnifyTask unifyTask = new TypeUnifyTask(undConstrains, oderConstraints, fc, false, logFile, log, 0, ret, usedTasks);
Set<Set<UnifyPair>> res = unifyTask.compute();
try {
logFile.write("\nnoShortendElements: " + unifyTask.noShortendElements +"\n");
logFile.flush();
}
catch (IOException e) {
System.err.println("no log-File");
}
return res;
}
}

@ -3,6 +3,7 @@ package de.dhbwstuttgart.typeinference.unify;
import java.io.FileWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -17,8 +18,8 @@ public class TypeUnify2Task extends TypeUnifyTask {
Set<Set<UnifyPair>> setToFlatten;
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Set<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm) {
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm);
public TypeUnify2Task(Set<Set<UnifyPair>> setToFlatten, Set<UnifyPair> eq, List<Set<Set<UnifyPair>>> oderConstraints, Set<UnifyPair> nextSetElement, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks) {
super(eq, oderConstraints, fc, parallel, logFile, log, rekTiefe, urm, usedTasks);
this.setToFlatten = setToFlatten;
this.nextSetElement = nextSetElement;
}
@ -38,9 +39,17 @@ public class TypeUnify2Task extends TypeUnifyTask {
return new HashSet<>(); }
else
*/
noOfThread--;
return res;
}
//writeLog("xxx");
//noOfThread--;
synchronized (usedTasks) {
if (this.myIsCancelled()) {
return new HashSet<>();
}
else {
return res;
}
}
}
public void closeLogFile() {

File diff suppressed because it is too large Load Diff

@ -0,0 +1,18 @@
package de.dhbwstuttgart.typeinference.unify;
import java.util.ArrayList;
public class UnifyTaskModel {
ArrayList<TypeUnifyTask> usedTasks = new ArrayList<>();
public synchronized void add(TypeUnifyTask t) {
usedTasks.add(t);
}
public synchronized void cancel() {
for(TypeUnifyTask t : usedTasks) {
t.myCancel(true);
}
}
}

@ -1,68 +1,68 @@
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.Optional;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
/**
*
* @author Florian Steurer
*/
public interface IFiniteClosure {
public void setLogTrue();
/**
* Returns all types of the finite closure that are subtypes of the argument.
* @return The set of subtypes of the argument.
*/
public Set<UnifyType> smaller(UnifyType type, Set<UnifyType> fBounded);
/**
* Returns all types of the finite closure that are supertypes of the argument.
* @return The set of supertypes of the argument.
*/
public Set<UnifyType> greater(UnifyType type, Set<UnifyType> fBounded);
/**
* Wo passt Type rein?
* @param type
* @return
*/
public Set<UnifyType> grArg(UnifyType type, Set<UnifyType> fBounded);
/**
* Was passt in Type rein?
* @param type
* @return
*/
public Set<UnifyType> smArg(UnifyType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(ReferenceType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(ReferenceType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(ExtendsType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(ExtendsType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(SuperType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(SuperType type, Set<UnifyType> fBounded);
package de.dhbwstuttgart.typeinference.unify.interfaces;
public Set<UnifyType> grArg(PlaceholderType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(PlaceholderType type, Set<UnifyType> fBounded);
import java.util.Optional;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
/**
*
* @author Florian Steurer
*/
public interface IFiniteClosure {
public void setLogTrue();
/**
* Returns all types of the finite closure that are subtypes of the argument.
* @return The set of subtypes of the argument.
*/
public Set<UnifyType> smaller(UnifyType type, Set<UnifyType> fBounded);
/**
* Returns all types of the finite closure that are supertypes of the argument.
* @return The set of supertypes of the argument.
*/
public Set<UnifyType> greater(UnifyType type, Set<UnifyType> fBounded);
/**
* Wo passt Type rein?
* @param type
* @return
*/
public Set<UnifyType> grArg(UnifyType type, Set<UnifyType> fBounded);
/**
* Was passt in Type rein?
* @param type
* @return
*/
public Set<UnifyType> smArg(UnifyType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(ReferenceType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(ReferenceType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(ExtendsType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(ExtendsType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(SuperType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(SuperType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(PlaceholderType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(PlaceholderType type, Set<UnifyType> fBounded);
public Set<UnifyType> grArg(FunNType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(FunNType type, Set<UnifyType> fBounded);
public Optional<UnifyType> getLeftHandedType(String typeName);
public Set<UnifyType> getAncestors(UnifyType t);
public Set<UnifyType> getChildren(UnifyType t);
public Set<UnifyType> getAllTypesByName(String typeName);
public Set<UnifyType> grArg(FunNType type, Set<UnifyType> fBounded);
public Set<UnifyType> smArg(FunNType type, Set<UnifyType> fBounded);
public Optional<UnifyType> getLeftHandedType(String typeName);
public Set<UnifyType> getAncestors(UnifyType t);
public Set<UnifyType> getChildren(UnifyType t);
public Set<UnifyType> getAllTypesByName(String typeName);
public int compare(UnifyType rhsType, UnifyType rhsType2, PairOperator pairop);
}
}

@ -1,29 +1,29 @@
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
/**
* Match
* @author Martin Pluemicke
* abgeleitet aus IUnify.java
*/
public interface IMatch {
/**
* Finds the most general matcher sigma of the set {t1 =. t1',...,tn =. tn'} so that
* sigma(t1) = t1' , ... sigma(tn) = tn'.
* @param terms The set of terms to be matched
* @return An optional of the most general matcher if it exists or an empty optional if there is no matcher.
*/
public Optional<Unifier> match(ArrayList<UnifyPair> termsList);
}
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
/**
* Match
* @author Martin Pluemicke
* abgeleitet aus IUnify.java
*/
public interface IMatch {
/**
* Finds the most general matcher sigma of the set {t1 =. t1',...,tn =. tn'} so that
* sigma(t1) = t1' , ... sigma(tn) = tn'.
* @param terms The set of terms to be matched
* @return An optional of the most general matcher if it exists or an empty optional if there is no matcher.
*/
public Optional<Unifier> match(ArrayList<UnifyPair> termsList);
}

@ -1,102 +1,102 @@
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
/**
* Contains the inference rules that are applied to the set Eq.
* @author Florian Steurer
*/
public interface IRuleSet {
public Optional<UnifyPair> reduceUp(UnifyPair pair);
public Optional<UnifyPair> reduceLow(UnifyPair pair);
public Optional<UnifyPair> reduceUpLow(UnifyPair pair);
public Optional<Set<UnifyPair>> reduceExt(UnifyPair pair, IFiniteClosure fc);
public Optional<Set<UnifyPair>> reduceSup(UnifyPair pair, IFiniteClosure fc);
public Optional<Set<UnifyPair>> reduceEq(UnifyPair pair);
public Optional<Set<UnifyPair>> reduce1(UnifyPair pair, IFiniteClosure fc);
public Optional<Set<UnifyPair>> reduce2(UnifyPair pair);
/*
* Missing Reduce-Rules for Wildcards
*/
public Optional<UnifyPair> reduceWildcardLow(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardLowRight(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardUp(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardUpRight(UnifyPair pair);
/*
* vgl. JAVA_BSP/Wildcard6.java
public Optional<UnifyPair> reduceWildcardLowUp(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardUpLow(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardLeft(UnifyPair pair);
*/
/*
* Additional Rules which replace cases of the cartesian product
*/
/**
* Rule that replaces the fourth case of the cartesian product where (a <.? Theta)
*/
public Optional<UnifyPair> reduceTph(UnifyPair pair);
/**
* Rule that replaces the sixth case of the cartesian product where (? ext Theta <.? a)
*/
public Optional<Set<UnifyPair>> reduceTphExt(UnifyPair pair);
/**
* Rule that replaces the fourth case of the cartesian product where (? sup Theta <.? a)
*/
public Optional<Set<UnifyPair>> reduceTphSup(UnifyPair pair);
/*
* FunN Rules
*/
public Optional<Set<UnifyPair>> reduceFunN(UnifyPair pair);
public Optional<Set<UnifyPair>> greaterFunN(UnifyPair pair);
public Optional<Set<UnifyPair>> smallerFunN(UnifyPair pair);
/**
* Checks whether the erase1-Rule applies to the pair.
* @return True if the pair is erasable, false otherwise.
*/
public boolean erase1(UnifyPair pair, IFiniteClosure fc);
/**
* Checks whether the erase2-Rule applies to the pair.
* @return True if the pair is erasable, false otherwise.
*/
public boolean erase2(UnifyPair pair, IFiniteClosure fc);
/**
* Checks whether the erase3-Rule applies to the pair.
* @return True if the pair is erasable, false otherwise.
*/
public boolean erase3(UnifyPair pair);
public Optional<UnifyPair> swap(UnifyPair pair);
public Optional<UnifyPair> adapt(UnifyPair pair, IFiniteClosure fc);
public Optional<UnifyPair> adaptExt(UnifyPair pair, IFiniteClosure fc);
public Optional<UnifyPair> adaptSup(UnifyPair pair, IFiniteClosure fc);
/**
* Applies the subst-Rule to a set of pairs (usually Eq').
* @param pairs The set of pairs where the subst rule should apply.
* @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions.
*/
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs, List<Set<Set<UnifyPair>>> oderConstraints);
/**
* Applies the subst-Rule to a set of pairs (usually Eq').
* @param pairs The set of pairs where the subst rule should apply.
* @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions.
*/
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs);
}
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
/**
* Contains the inference rules that are applied to the set Eq.
* @author Florian Steurer
*/
public interface IRuleSet {
public Optional<UnifyPair> reduceUp(UnifyPair pair);
public Optional<UnifyPair> reduceLow(UnifyPair pair);
public Optional<UnifyPair> reduceUpLow(UnifyPair pair);
public Optional<Set<UnifyPair>> reduceExt(UnifyPair pair, IFiniteClosure fc);
public Optional<Set<UnifyPair>> reduceSup(UnifyPair pair, IFiniteClosure fc);
public Optional<Set<UnifyPair>> reduceEq(UnifyPair pair);
public Optional<Set<UnifyPair>> reduce1(UnifyPair pair, IFiniteClosure fc);
public Optional<Set<UnifyPair>> reduce2(UnifyPair pair);
/*
* Missing Reduce-Rules for Wildcards
*/
public Optional<UnifyPair> reduceWildcardLow(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardLowRight(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardUp(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardUpRight(UnifyPair pair);
/*
* vgl. JAVA_BSP/Wildcard6.java
public Optional<UnifyPair> reduceWildcardLowUp(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardUpLow(UnifyPair pair);
public Optional<UnifyPair> reduceWildcardLeft(UnifyPair pair);
*/
/*
* Additional Rules which replace cases of the cartesian product
*/
/**
* Rule that replaces the fourth case of the cartesian product where (a <.? Theta)
*/
public Optional<UnifyPair> reduceTph(UnifyPair pair);
/**
* Rule that replaces the sixth case of the cartesian product where (? ext Theta <.? a)
*/
public Optional<Set<UnifyPair>> reduceTphExt(UnifyPair pair);
/**
* Rule that replaces the fourth case of the cartesian product where (? sup Theta <.? a)
*/
public Optional<Set<UnifyPair>> reduceTphSup(UnifyPair pair);
/*
* FunN Rules
*/
public Optional<Set<UnifyPair>> reduceFunN(UnifyPair pair);
public Optional<Set<UnifyPair>> greaterFunN(UnifyPair pair);
public Optional<Set<UnifyPair>> smallerFunN(UnifyPair pair);
/**
* Checks whether the erase1-Rule applies to the pair.
* @return True if the pair is erasable, false otherwise.
*/
public boolean erase1(UnifyPair pair, IFiniteClosure fc);
/**
* Checks whether the erase2-Rule applies to the pair.
* @return True if the pair is erasable, false otherwise.
*/
public boolean erase2(UnifyPair pair, IFiniteClosure fc);
/**
* Checks whether the erase3-Rule applies to the pair.
* @return True if the pair is erasable, false otherwise.
*/
public boolean erase3(UnifyPair pair);
public Optional<UnifyPair> swap(UnifyPair pair);
public Optional<UnifyPair> adapt(UnifyPair pair, IFiniteClosure fc);
public Optional<UnifyPair> adaptExt(UnifyPair pair, IFiniteClosure fc);
public Optional<UnifyPair> adaptSup(UnifyPair pair, IFiniteClosure fc);
/**
* Applies the subst-Rule to a set of pairs (usually Eq').
* @param pairs The set of pairs where the subst rule should apply.
* @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions.
*/
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs, List<Set<Set<UnifyPair>>> oderConstraints);
/**
* Applies the subst-Rule to a set of pairs (usually Eq').
* @param pairs The set of pairs where the subst rule should apply.
* @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions.
*/
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs);
}

@ -1,16 +1,16 @@
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.List;
import java.util.Set;
/**
* Contains operations on sets.
* @author Florian Steurer
*/
public interface ISetOperations {
/**
* Calculates the cartesian product of the sets.
* @return The cartesian product
*/
<B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets);
}
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.List;
import java.util.Set;
/**
* Contains operations on sets.
* @author Florian Steurer
*/
public interface ISetOperations {
/**
* Calculates the cartesian product of the sets.
* @return The cartesian product
*/
<B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets);
}

@ -1,35 +1,35 @@
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.Arrays;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
/**
* Standard unification algorithm (e.g. Robinson, Paterson-Wegman, Martelli-Montanari)
* @author Florian Steurer
*/
public interface IUnify {
/**
* Finds the most general unifier sigma of the set {t1 =. t1',...,tn =. tn'} so that
* sigma(t1) = sigma(t1') , ... sigma(tn) = sigma(tn').
* @param terms The set of terms to be unified
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
*/
public Optional<Unifier> unify(Set<UnifyType> terms);
/**
* Finds the most general unifier sigma of the set {t1 =. t1',...,tn =. tn'} so that
* sigma(t1) = sigma(t1') , ... sigma(tn) = sigma(tn').
* @param terms The set of terms to be unified
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
*/
default public Optional<Unifier> unify(UnifyType... terms) {
return unify(Arrays.stream(terms).collect(Collectors.toSet()));
}
}
package de.dhbwstuttgart.typeinference.unify.interfaces;
import java.util.Arrays;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
/**
* Standard unification algorithm (e.g. Robinson, Paterson-Wegman, Martelli-Montanari)
* @author Florian Steurer
*/
public interface IUnify {
/**
* Finds the most general unifier sigma of the set {t1 =. t1',...,tn =. tn'} so that
* sigma(t1) = sigma(t1') , ... sigma(tn) = sigma(tn').
* @param terms The set of terms to be unified
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
*/
public Optional<Unifier> unify(Set<UnifyType> terms);
/**
* Finds the most general unifier sigma of the set {t1 =. t1',...,tn =. tn'} so that
* sigma(t1) = sigma(t1') , ... sigma(tn) = sigma(tn').
* @param terms The set of terms to be unified
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
*/
default public Optional<Unifier> unify(UnifyType... terms) {
return unify(Arrays.stream(terms).collect(Collectors.toSet()));
}
}

@ -1,96 +1,96 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* An extends wildcard type "? extends T".
*/
public final class ExtendsType extends WildcardType {
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a new extends wildcard type.
* @param extendedType The extended type e.g. Integer in "? extends Integer"
*/
public ExtendsType(UnifyType extendedType) {
super("? extends " + extendedType.getName(), extendedType);
if (extendedType instanceof ExtendsType) {
System.out.print("");
}
}
/**
* The extended type e.g. Integer in "? extends Integer"
*/
public UnifyType getExtendedType() {
return wildcardedType;
}
/**
* Sets the type parameters of the wildcarded type and returns a new extendstype that extends that type.
*/
@Override
public UnifyType setTypeParams(TypeParams newTp) {
UnifyType newType = wildcardedType.setTypeParams(newTp);
if(newType == wildcardedType)
return this; // Reduced the amount of objects created
return new ExtendsType(wildcardedType.setTypeParams(newTp));
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
UnifyType newType = wildcardedType.apply(unif);
if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType))
return this; // Reduced the amount of objects created
return new ExtendsType(newType);
}
@Override
public int hashCode() {
/*
* It is important that the prime that is added is different to the prime added in hashCode() of SuperType.
* Otherwise ? extends T and ? super T have the same hashCode() for every Type T.
*/
return wildcardedType.hashCode() + 229;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ExtendsType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
ExtendsType other = (ExtendsType) obj;
return other.getWildcardedType().equals(wildcardedType);
}
@Override
public String toString() {
return "? extends " + wildcardedType;
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* An extends wildcard type "? extends T".
*/
public final class ExtendsType extends WildcardType {
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a new extends wildcard type.
* @param extendedType The extended type e.g. Integer in "? extends Integer"
*/
public ExtendsType(UnifyType extendedType) {
super("? extends " + extendedType.getName(), extendedType);
if (extendedType instanceof ExtendsType) {
System.out.print("");
}
}
/**
* The extended type e.g. Integer in "? extends Integer"
*/
public UnifyType getExtendedType() {
return wildcardedType;
}
/**
* Sets the type parameters of the wildcarded type and returns a new extendstype that extends that type.
*/
@Override
public UnifyType setTypeParams(TypeParams newTp) {
UnifyType newType = wildcardedType.setTypeParams(newTp);
if(newType == wildcardedType)
return this; // Reduced the amount of objects created
return new ExtendsType(wildcardedType.setTypeParams(newTp));
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
UnifyType newType = wildcardedType.apply(unif);
if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType))
return this; // Reduced the amount of objects created
return new ExtendsType(newType);
}
@Override
public int hashCode() {
/*
* It is important that the prime that is added is different to the prime added in hashCode() of SuperType.
* Otherwise ? extends T and ? super T have the same hashCode() for every Type T.
*/
return wildcardedType.hashCode() + 229;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ExtendsType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
ExtendsType other = (ExtendsType) obj;
return other.getWildcardedType().equals(wildcardedType);
}
@Override
public String toString() {
return "? extends " + wildcardedType;
}
}

@ -1,103 +1,103 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* A real function type in java.
* @author Florian Steurer
*/
public class FunNType extends UnifyType {
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a FunN-Type with the specified TypeParameters.
*/
protected FunNType(TypeParams p) {
super("Fun"+(p.size()-1)+"$$", p);
}
/**
* Creates a new FunNType.
* @param tp The parameters of the type.
* @return A FunNType.
* @throws IllegalArgumentException is thrown when there are to few type parameters or there are wildcard-types.
*/
public static FunNType getFunNType(TypeParams tp) throws IllegalArgumentException {
if(tp.size() == 0)
throw new IllegalArgumentException("FunNTypes need at least one type parameter");
for(UnifyType t : tp)
if(t instanceof WildcardType)
throw new IllegalArgumentException("Invalid TypeParams for a FunNType: " + tp);
return new FunNType(tp);
}
/**
* Returns the degree of the function type, e.g. 2 for FunN<Integer, Integer, Integer>.
*/
public int getN() {
return typeParams.size()-1;
}
@Override
public UnifyType setTypeParams(TypeParams newTp) {
if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams))
return this;
return getFunNType(newTp);
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
// TODO this bypasses the validation of the type parameters.
// Wildcard types can be unified into FunNTypes.
TypeParams newParams = typeParams.apply(unif);
if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams))
return this;
return new FunNType(newParams);
}
@Override
public Boolean wrongWildcard() {
return (new ArrayList<UnifyType>(Arrays.asList(getTypeParams()
.get())).stream().filter(x -> (x instanceof WildcardType)).findFirst().isPresent());
}
@Override
public int hashCode() {
return 181 + typeParams.hashCode();
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof FunNType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
FunNType other = (FunNType) obj;
return other.getTypeParams().equals(typeParams);
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* A real function type in java.
* @author Florian Steurer
*/
public class FunNType extends UnifyType {
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a FunN-Type with the specified TypeParameters.
*/
protected FunNType(TypeParams p) {
super("Fun"+(p.size()-1)+"$$", p);
}
/**
* Creates a new FunNType.
* @param tp The parameters of the type.
* @return A FunNType.
* @throws IllegalArgumentException is thrown when there are to few type parameters or there are wildcard-types.
*/
public static FunNType getFunNType(TypeParams tp) throws IllegalArgumentException {
if(tp.size() == 0)
throw new IllegalArgumentException("FunNTypes need at least one type parameter");
for(UnifyType t : tp)
if(t instanceof WildcardType)
throw new IllegalArgumentException("Invalid TypeParams for a FunNType: " + tp);
return new FunNType(tp);
}
/**
* Returns the degree of the function type, e.g. 2 for FunN<Integer, Integer, Integer>.
*/
public int getN() {
return typeParams.size()-1;
}
@Override
public UnifyType setTypeParams(TypeParams newTp) {
if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams))
return this;
return getFunNType(newTp);
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
// TODO this bypasses the validation of the type parameters.
// Wildcard types can be unified into FunNTypes.
TypeParams newParams = typeParams.apply(unif);
if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams))
return this;
return new FunNType(newParams);
}
@Override
public Boolean wrongWildcard() {
return (new ArrayList<UnifyType>(Arrays.asList(getTypeParams()
.get())).stream().filter(x -> (x instanceof WildcardType)).findFirst().isPresent());
}
@Override
public int hashCode() {
return 181 + typeParams.hashCode();
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof FunNType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
FunNType other = (FunNType) obj;
return other.getTypeParams().equals(typeParams);
}
}

@ -1,100 +1,100 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
/**
* A node of a directed graph.
* @author Florian Steurer
*
* @param <T> The type of the content of the node.
*/
class Node<T> {
/**
* The content of the node.
*/
private T content;
/**
* The set of predecessors
*/
private HashSet<Node<T>> predecessors = new HashSet<>();
/**
* The set of descendants
*/
private HashSet<Node<T>> descendants = new HashSet<>();
/**
* Creates a node containing the specified content.
*/
public Node(T content) {
this.content = content;
}
/**
* Adds a directed edge from this node to the descendant (this -> descendant)
*/
public void addDescendant(Node<T> descendant) {
if(descendants.contains(descendant))
return;
descendants.add(descendant);
descendant.addPredecessor(this);
}
/**
* Adds a directed edge from the predecessor to this node (predecessor -> this)
*/
public void addPredecessor(Node<T> predecessor) {
if(predecessors.contains(predecessor))
return;
predecessors.add(predecessor);
predecessor.addDescendant(this);
}
/**
* The content of this node.
*/
public T getContent() {
return content;
}
/**
* Returns all predecessors (nodes that have a directed edge to this node)
*/
public Set<Node<T>> getPredecessors() {
return predecessors;
}
/**
* Returns all descendants. All nodes M, where there is a edge from this node to the node M.
* @return
*/
public Set<Node<T>> getDescendants() {
return descendants;
}
/**
* Retrieves the content of all descendants.
*/
public Set<T> getContentOfDescendants() {
return descendants.stream().map(x -> x.getContent()).collect(Collectors.toSet());
}
/**
* Retrieves the content of all predecessors.
*/
public Set<T> getContentOfPredecessors() {
return predecessors.stream().map(x -> x.getContent()).collect(Collectors.toSet());
}
@Override
public String toString() {
return "Elem: Node(" + content.toString() + ")\nPrec: " + getContentOfPredecessors().toString()
+ "\nDesc: " + getContentOfDescendants().toString() + "\n\n";
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;
/**
* A node of a directed graph.
* @author Florian Steurer
*
* @param <T> The type of the content of the node.
*/
class Node<T> {
/**
* The content of the node.
*/
private T content;
/**
* The set of predecessors
*/
private HashSet<Node<T>> predecessors = new HashSet<>();
/**
* The set of descendants
*/
private HashSet<Node<T>> descendants = new HashSet<>();
/**
* Creates a node containing the specified content.
*/
public Node(T content) {
this.content = content;
}
/**
* Adds a directed edge from this node to the descendant (this -> descendant)
*/
public void addDescendant(Node<T> descendant) {
if(descendants.contains(descendant))
return;
descendants.add(descendant);
descendant.addPredecessor(this);
}
/**
* Adds a directed edge from the predecessor to this node (predecessor -> this)
*/
public void addPredecessor(Node<T> predecessor) {
if(predecessors.contains(predecessor))
return;
predecessors.add(predecessor);
predecessor.addDescendant(this);
}
/**
* The content of this node.
*/
public T getContent() {
return content;
}
/**
* Returns all predecessors (nodes that have a directed edge to this node)
*/
public Set<Node<T>> getPredecessors() {
return predecessors;
}
/**
* Returns all descendants. All nodes M, where there is a edge from this node to the node M.
* @return
*/
public Set<Node<T>> getDescendants() {
return descendants;
}
/**
* Retrieves the content of all descendants.
*/
public Set<T> getContentOfDescendants() {
return descendants.stream().map(x -> x.getContent()).collect(Collectors.toSet());
}
/**
* Retrieves the content of all predecessors.
*/
public Set<T> getContentOfPredecessors() {
return predecessors.stream().map(x -> x.getContent()).collect(Collectors.toSet());
}
@Override
public String toString() {
return "Elem: Node(" + content.toString() + ")\nPrec: " + getContentOfPredecessors().toString()
+ "\nDesc: " + getContentOfDescendants().toString() + "\n\n";
}
}

@ -1,195 +1,195 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.distributeVariance;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* An unbounded placeholder type.
* @author Florian Steurer
*/
public final class PlaceholderType extends UnifyType{
/**
* Static list containing the names of all existing placeholders.
* Used for generating fresh placeholders.
*/
public static final ArrayList<String> EXISTING_PLACEHOLDERS = new ArrayList<String>();
/**
* Prefix of auto-generated placeholder names.
*/
protected static String nextName = "gen_";
/**
* Random number generator used to generate fresh placeholder name.
*/
protected static Random rnd = new Random(43558747548978L);
/**
* True if this object was auto-generated, false if this object was user-generated.
*/
private final boolean IsGenerated;
/**
* isWildcardable gibt an, ob ein Wildcardtyp dem PlaceholderType zugeordnet werden darf
*/
private boolean wildcardable = true;
/**
* is innerType gibt an, ob der Type des PlaceholderType innerhalb eines Typkonstruktorsverwendet wird
*/
private boolean innerType = false;
/**
* variance shows the variance of the pair
* -1: contravariant
* 1 covariant
* 0 invariant
* PL 2018-03-21
*/
private int variance = 0;
/**
* Creates a new placeholder type with the specified name.
*/
public PlaceholderType(String name) {
super(name, new TypeParams());
EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names
IsGenerated = false; // This type is user generated
}
/**
* Creates a new placeholdertype
* @param isGenerated true if this placeholder is auto-generated, false if it is user-generated.
*/
protected PlaceholderType(String name, boolean isGenerated) {
super(name, new TypeParams());
EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names
IsGenerated = isGenerated;
}
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a fresh placeholder type with a name that does so far not exist.
* A user could later instantiate a type using the same name that is equivalent to this type.
* @return A fresh placeholder type.
*/
public synchronized static PlaceholderType freshPlaceholder() {
String name = nextName + (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
// Add random chars while the name is in use.
while(EXISTING_PLACEHOLDERS.contains(name)) {
name += (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
}
return new PlaceholderType(name, true);
}
/**
* True if this placeholder is auto-generated, false if it is user-generated.
*/
public boolean isGenerated() {
return IsGenerated;
}
public void setVariance(int v) {
variance = v;
}
public int getVariance() {
return variance;
}
public void reversVariance() {
if (variance == 1) {
setVariance(-1);
} else {
if (variance == -1) {
setVariance(1);
}}
}
public Boolean isWildcardable() {
return wildcardable;
}
public void disableWildcardtable() {
wildcardable = false;
}
public void enableWildcardtable() {
wildcardable = true;
}
public void setWildcardtable(Boolean wildcardable) {
this.wildcardable = wildcardable;
}
public Boolean isInnerType() {
return innerType;
}
public void setInnerType(Boolean innerType) {
this.innerType = innerType;
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
public UnifyType setTypeParams(TypeParams newTp) {
return this; // Placeholders never have params.
}
@Override
public int hashCode() {
return typeName.hashCode();
}
@Override
UnifyType apply(Unifier unif) {
if(unif.hasSubstitute(this)) {
UnifyType ret = unif.getSubstitute(this);
//PL 2018-05-17 Auskommentierung muesste korrekt sein,
//bereits in JavaTXComplier Variancen gesetzt werden.
//ret.accept(new distributeVariance(), this.getVariance());
return ret;
}
return this;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof PlaceholderType))
return false;
return ((PlaceholderType) obj).getName().equals(typeName);
}
@Override
public Collection<PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.add(this);
return ret;
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.distributeVariance;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* An unbounded placeholder type.
* @author Florian Steurer
*/
public final class PlaceholderType extends UnifyType{
/**
* Static list containing the names of all existing placeholders.
* Used for generating fresh placeholders.
*/
public static final ArrayList<String> EXISTING_PLACEHOLDERS = new ArrayList<String>();
/**
* Prefix of auto-generated placeholder names.
*/
protected static String nextName = "gen_";
/**
* Random number generator used to generate fresh placeholder name.
*/
protected static Random rnd = new Random(43558747548978L);
/**
* True if this object was auto-generated, false if this object was user-generated.
*/
private final boolean IsGenerated;
/**
* isWildcardable gibt an, ob ein Wildcardtyp dem PlaceholderType zugeordnet werden darf
*/
private boolean wildcardable = true;
/**
* is innerType gibt an, ob der Type des PlaceholderType innerhalb eines Typkonstruktorsverwendet wird
*/
private boolean innerType = false;
/**
* variance shows the variance of the pair
* -1: contravariant
* 1 covariant
* 0 invariant
* PL 2018-03-21
*/
private int variance = 0;
/**
* Creates a new placeholder type with the specified name.
*/
public PlaceholderType(String name) {
super(name, new TypeParams());
EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names
IsGenerated = false; // This type is user generated
}
/**
* Creates a new placeholdertype
* @param isGenerated true if this placeholder is auto-generated, false if it is user-generated.
*/
protected PlaceholderType(String name, boolean isGenerated) {
super(name, new TypeParams());
EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names
IsGenerated = isGenerated;
}
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a fresh placeholder type with a name that does so far not exist.
* A user could later instantiate a type using the same name that is equivalent to this type.
* @return A fresh placeholder type.
*/
public synchronized static PlaceholderType freshPlaceholder() {
String name = nextName + (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
// Add random chars while the name is in use.
while(EXISTING_PLACEHOLDERS.contains(name)) {
name += (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
}
return new PlaceholderType(name, true);
}
/**
* True if this placeholder is auto-generated, false if it is user-generated.
*/
public boolean isGenerated() {
return IsGenerated;
}
public void setVariance(int v) {
variance = v;
}
public int getVariance() {
return variance;
}
public void reversVariance() {
if (variance == 1) {
setVariance(-1);
} else {
if (variance == -1) {
setVariance(1);
}}
}
public Boolean isWildcardable() {
return wildcardable;
}
public void disableWildcardtable() {
wildcardable = false;
}
public void enableWildcardtable() {
wildcardable = true;
}
public void setWildcardtable(Boolean wildcardable) {
this.wildcardable = wildcardable;
}
public Boolean isInnerType() {
return innerType;
}
public void setInnerType(Boolean innerType) {
this.innerType = innerType;
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
public UnifyType setTypeParams(TypeParams newTp) {
return this; // Placeholders never have params.
}
@Override
public int hashCode() {
return typeName.hashCode();
}
@Override
UnifyType apply(Unifier unif) {
if(unif.hasSubstitute(this)) {
UnifyType ret = unif.getSubstitute(this);
//PL 2018-05-17 Auskommentierung muesste korrekt sein,
//bereits in JavaTXComplier Variancen gesetzt werden.
//ret.accept(new distributeVariance(), this.getVariance());
return ret;
}
return this;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof PlaceholderType))
return false;
return ((PlaceholderType) obj).getName().equals(typeName);
}
@Override
public Collection<PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.add(this);
return ret;
}
}

@ -1,83 +1,100 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* A reference type e.q. Integer or List<T>.
* @author Florian Steurer
*
*/
public final class ReferenceType extends UnifyType {
/**
* The buffered hashCode
*/
private final int hashCode;
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
public ReferenceType(String name, UnifyType... params) {
super(name, new TypeParams(params));
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
}
public ReferenceType(String name, TypeParams params) {
super(name, params);
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
TypeParams newParams = typeParams.apply(unif);
if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams))
return this;
return new ReferenceType(typeName, newParams);
}
@Override
public UnifyType setTypeParams(TypeParams newTp) {
if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams))
return this; // reduced the amount of objects created
return new ReferenceType(typeName, newTp);
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ReferenceType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
ReferenceType other = (ReferenceType) obj;
if(!other.getName().equals(typeName))
return false;
return other.getTypeParams().equals(typeParams);
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* A reference type e.q. Integer or List<T>.
* @author Florian Steurer
*
*/
public class ReferenceType extends UnifyType {
/**
* The buffered hashCode
*/
private final int hashCode;
/**
* gibt an, ob der ReferenceType eine generische Typvariable ist
*/
private final boolean genericTypeVar;
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
public ReferenceType(String name, Boolean genericTypeVar) {
super(name, new TypeParams());
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
this.genericTypeVar = genericTypeVar;
}
public ReferenceType(String name, UnifyType... params) {
super(name, new TypeParams(params));
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
genericTypeVar = false;
}
public ReferenceType(String name, TypeParams params) {
super(name, params);
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
genericTypeVar = false;
}
public boolean isGenTypeVar () {
return genericTypeVar;
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
TypeParams newParams = typeParams.apply(unif);
if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams))
return this;
return new ReferenceType(typeName, newParams);
}
@Override
public UnifyType setTypeParams(TypeParams newTp) {
if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams))
return this; // reduced the amount of objects created
return new ReferenceType(typeName, newTp);
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof ReferenceType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
ReferenceType other = (ReferenceType) obj;
if(!other.getName().equals(typeName))
return false;
return other.getTypeParams().equals(typeParams);
}
}

@ -1,88 +1,88 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* A super wildcard type e.g. ? super Integer.
* @author Florian Steurer
*/
public final class SuperType extends WildcardType {
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a new instance "? extends superedType"
* @param superedType The type that is supered e.g. Integer in "? super Integer"
*/
public SuperType(UnifyType superedType) {
super("? super " + superedType.getName(), superedType);
}
/**
* The type that is supered e.g. Integer in "? super Integer"
*/
public UnifyType getSuperedType() {
return wildcardedType;
}
@Override
public String toString() {
return "? super " + wildcardedType;
}
/**
* Sets the type parameters of the wildcarded type and returns a new supertype that supers that type.
*/
@Override
public UnifyType setTypeParams(TypeParams newTp) {
UnifyType newType = wildcardedType.setTypeParams(newTp);
if(newType == wildcardedType)
return this; // Reduced the amount of objects created
return new SuperType(wildcardedType.setTypeParams(newTp));
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
UnifyType newType = wildcardedType.apply(unif);
if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType))
return this; // Reduced the amount of objects created
return new SuperType(newType);
}
@Override
public int hashCode() {
/*
* It is important that the prime that is added is different to the prime added in hashCode() of ExtendsType.
* Otherwise ? extends T and ? super T have the same hashCode() for every Type T.
*/
return wildcardedType.hashCode() + 3917;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof SuperType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
SuperType other = (SuperType) obj;
return other.getSuperedType().equals(wildcardedType);
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashMap;
import java.util.Set;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* A super wildcard type e.g. ? super Integer.
* @author Florian Steurer
*/
public final class SuperType extends WildcardType {
public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht) {
return visitor.visit(this, ht);
}
/**
* Creates a new instance "? extends superedType"
* @param superedType The type that is supered e.g. Integer in "? super Integer"
*/
public SuperType(UnifyType superedType) {
super("? super " + superedType.getName(), superedType);
}
/**
* The type that is supered e.g. Integer in "? super Integer"
*/
public UnifyType getSuperedType() {
return wildcardedType;
}
@Override
public String toString() {
return "? super " + wildcardedType;
}
/**
* Sets the type parameters of the wildcarded type and returns a new supertype that supers that type.
*/
@Override
public UnifyType setTypeParams(TypeParams newTp) {
UnifyType newType = wildcardedType.setTypeParams(newTp);
if(newType == wildcardedType)
return this; // Reduced the amount of objects created
return new SuperType(wildcardedType.setTypeParams(newTp));
}
@Override
Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.smArg(this, fBounded);
}
@Override
Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded) {
return fc.grArg(this, fBounded);
}
@Override
UnifyType apply(Unifier unif) {
UnifyType newType = wildcardedType.apply(unif);
if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType))
return this; // Reduced the amount of objects created
return new SuperType(newType);
}
@Override
public int hashCode() {
/*
* It is important that the prime that is added is different to the prime added in hashCode() of ExtendsType.
* Otherwise ? extends T and ? super T have the same hashCode() for every Type T.
*/
return wildcardedType.hashCode() + 3917;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof SuperType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
SuperType other = (SuperType) obj;
return other.getSuperedType().equals(wildcardedType);
}
}

@ -1,191 +1,191 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.*;
/**
* The generic or non-generic parameters of a type e.g. <T> for List<T>
* @author Florian Steurer
*/
public final class TypeParams implements Iterable<UnifyType>{
/**
* The array which backs the type parameters.
*/
private final UnifyType[] typeParams;
/**
* Hashcode calculation is expensive and must be cached.
*/
private final int hashCode;
/**
* Creates a new set of type parameters.
* @param types The type parameters.
*/
public TypeParams(List<UnifyType> types){
typeParams = new UnifyType[types.size()];
for(int i=0;i<types.size();i++){
typeParams[i] = types.get(i);
if(types.get(i)==null)throw new NullPointerException();
}
// Hashcode calculation is expensive and must be cached.
hashCode = Arrays.deepHashCode(typeParams);
}
/**
* Creates a new set of type parameters.
* @param types The type parameters.
*/
public TypeParams(UnifyType... types) {
typeParams = types;
// Hashcode calculation is expensive and must be cached.
hashCode = Arrays.deepHashCode(typeParams);
}
/**
* True if every parameter in this object is a placeholder type, false otherwise.
*/
public boolean arePlaceholders() {
return Arrays.stream(typeParams).allMatch(x -> x instanceof PlaceholderType);
}
/**
* Returns the number of the type parameters in this object.
* @return number of type parameters, always positive (including 0).
*/
public int size() {
return typeParams.length;
}
/**
* Returns true if this object has size() of zero, false otherwise.
*/
public boolean empty() {
return typeParams.length == 0;
}
/**
* Applies a unifier to every parameter in this object.
* @param unif The applied unifier.
* @return A new type parameter object, where the unifier was applied to every parameter.
*/
public TypeParams apply(Unifier unif) {
UnifyType[] newParams = new UnifyType[typeParams.length];
// If true, a type was modified and a new typeparams object has to be created.
// Otherwise it is enough to return this object, since it is immutable
// This reduced the needed TypeParams-Instances for the lambda14-Test from
// 130.000 to 30.000 without a decrease in speed.
boolean isNew = false;
for(int i = 0; i < typeParams.length; i++) {
UnifyType newType = typeParams[i].apply(unif);
newParams[i] = newType;
if(!isNew && (newType.hashCode() != typeParams[i].hashCode() || !newType.equals(typeParams[i])))
isNew = true;
}
if(!isNew)
return this;
return new TypeParams(newParams);
}
/**
* True if the PlaceholderType t is a parameter of this object, or if any parameter
* contains t (arbitrary depth of recursion), false otherwise.
*/
public boolean occurs(PlaceholderType t) {
for(UnifyType p : typeParams)
if(p instanceof PlaceholderType) {//PL 2018-01-31 dangeling else Problem { ... } eingefuegt.
if(p.equals(t))
return true;
}
else {
if(p.getTypeParams().occurs(t))
return true; }
return false;
}
/**
* Returns the i-th parameter of this object.
*/
public UnifyType get(int i) {
return typeParams[i];
}
/**
* Returns the parameters of this object.
* PL 2018-03-17
*/
public UnifyType[] get() {
return typeParams;
}
/**
* Sets the the type t as the i-th parameter and returns a new object
* that equals this object, except for the i-th type.
*/
public TypeParams set(UnifyType t, int idx) {
// Reduce the creation of new objects for less memory
// Reduced the needed instances of TypeParams in the lambda14-Test from
// 150.000 to 130.000
if(t.hashCode() == typeParams[idx].hashCode() && t.equals(typeParams[idx]))
return this;
UnifyType[] newparams = Arrays.copyOf(typeParams, typeParams.length);
newparams[idx] = t;
return new TypeParams(newparams);
}
@Override
public Iterator<UnifyType> iterator() {
return Arrays.stream(typeParams).iterator();
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof TypeParams))
return false;
if(obj.hashCode() != this.hashCode())
return false;
TypeParams other = (TypeParams) obj;
if(other.size() != this.size())
return false;
for(int i = 0; i < this.size(); i++){
//if(this.get(i) == null)
//System.out.print("s");
}
for(int i = 0; i < this.size(); i++)
if(!(this.get(i).equals(other.get(i))))
return false;
return true;
}
@Override
public String toString() {
String res = "";
for(UnifyType t : typeParams)
res += t + ",";
return "<" + res.substring(0, res.length()-1) + ">";
}
public Collection<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
for(UnifyType t : typeParams){
ret.addAll(t.getInvolvedPlaceholderTypes());
}
return ret;
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.*;
/**
* The generic or non-generic parameters of a type e.g. <T> for List<T>
* @author Florian Steurer
*/
public final class TypeParams implements Iterable<UnifyType>{
/**
* The array which backs the type parameters.
*/
private final UnifyType[] typeParams;
/**
* Hashcode calculation is expensive and must be cached.
*/
private final int hashCode;
/**
* Creates a new set of type parameters.
* @param types The type parameters.
*/
public TypeParams(List<UnifyType> types){
typeParams = new UnifyType[types.size()];
for(int i=0;i<types.size();i++){
typeParams[i] = types.get(i);
if(types.get(i)==null)throw new NullPointerException();
}
// Hashcode calculation is expensive and must be cached.
hashCode = Arrays.deepHashCode(typeParams);
}
/**
* Creates a new set of type parameters.
* @param types The type parameters.
*/
public TypeParams(UnifyType... types) {
typeParams = types;
// Hashcode calculation is expensive and must be cached.
hashCode = Arrays.deepHashCode(typeParams);
}
/**
* True if every parameter in this object is a placeholder type, false otherwise.
*/
public boolean arePlaceholders() {
return Arrays.stream(typeParams).allMatch(x -> x instanceof PlaceholderType);
}
/**
* Returns the number of the type parameters in this object.
* @return number of type parameters, always positive (including 0).
*/
public int size() {
return typeParams.length;
}
/**
* Returns true if this object has size() of zero, false otherwise.
*/
public boolean empty() {
return typeParams.length == 0;
}
/**
* Applies a unifier to every parameter in this object.
* @param unif The applied unifier.
* @return A new type parameter object, where the unifier was applied to every parameter.
*/
public TypeParams apply(Unifier unif) {
UnifyType[] newParams = new UnifyType[typeParams.length];
// If true, a type was modified and a new typeparams object has to be created.
// Otherwise it is enough to return this object, since it is immutable
// This reduced the needed TypeParams-Instances for the lambda14-Test from
// 130.000 to 30.000 without a decrease in speed.
boolean isNew = false;
for(int i = 0; i < typeParams.length; i++) {
UnifyType newType = typeParams[i].apply(unif);
newParams[i] = newType;
if(!isNew && (newType.hashCode() != typeParams[i].hashCode() || !newType.equals(typeParams[i])))
isNew = true;
}
if(!isNew)
return this;
return new TypeParams(newParams);
}
/**
* True if the PlaceholderType t is a parameter of this object, or if any parameter
* contains t (arbitrary depth of recursion), false otherwise.
*/
public boolean occurs(PlaceholderType t) {
for(UnifyType p : typeParams)
if(p instanceof PlaceholderType) {//PL 2018-01-31 dangeling else Problem { ... } eingefuegt.
if(p.equals(t))
return true;
}
else {
if(p.getTypeParams().occurs(t))
return true; }
return false;
}
/**
* Returns the i-th parameter of this object.
*/
public UnifyType get(int i) {
return typeParams[i];
}
/**
* Returns the parameters of this object.
* PL 2018-03-17
*/
public UnifyType[] get() {
return typeParams;
}
/**
* Sets the the type t as the i-th parameter and returns a new object
* that equals this object, except for the i-th type.
*/
public TypeParams set(UnifyType t, int idx) {
// Reduce the creation of new objects for less memory
// Reduced the needed instances of TypeParams in the lambda14-Test from
// 150.000 to 130.000
if(t.hashCode() == typeParams[idx].hashCode() && t.equals(typeParams[idx]))
return this;
UnifyType[] newparams = Arrays.copyOf(typeParams, typeParams.length);
newparams[idx] = t;
return new TypeParams(newparams);
}
@Override
public Iterator<UnifyType> iterator() {
return Arrays.stream(typeParams).iterator();
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof TypeParams))
return false;
if(obj.hashCode() != this.hashCode())
return false;
TypeParams other = (TypeParams) obj;
if(other.size() != this.size())
return false;
for(int i = 0; i < this.size(); i++){
//if(this.get(i) == null)
//System.out.print("s");
}
for(int i = 0; i < this.size(); i++)
if(!(this.get(i).equals(other.get(i))))
return false;
return true;
}
@Override
public String toString() {
String res = "";
for(UnifyType t : typeParams)
res += t + ",";
return "<" + res.substring(0, res.length()-1) + ">";
}
public Collection<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
for(UnifyType t : typeParams){
ret.addAll(t.getInvolvedPlaceholderTypes());
}
return ret;
}
}

@ -1,189 +1,189 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Function;
/**
* A set of substitutions (s -> t) that is an applicable function to types and pairs.
* @author Florian Steurer
*/
public class Unifier implements Function<UnifyType, UnifyType>, Iterable<Entry<PlaceholderType, UnifyType>> {
/**
* The set of substitutions that unify a type-term
*/
private HashMap<PlaceholderType, UnifyType> substitutions = new HashMap<>();
package de.dhbwstuttgart.typeinference.unify.model;
/**
* Creates a new instance with a single substitution (source -> target).
* @param The type that is replaced
* @param The type that replaces
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Function;
/**
* A set of substitutions (s -> t) that is an applicable function to types and pairs.
* @author Florian Steurer
*/
public class Unifier implements Function<UnifyType, UnifyType>, Iterable<Entry<PlaceholderType, UnifyType>> {
/**
* The set of substitutions that unify a type-term
*/
private HashMap<PlaceholderType, UnifyType> substitutions = new HashMap<>();
/**
* Creates a new instance with a single substitution (source -> target).
* @param The type that is replaced
* @param The type that replaces
*/
public Unifier(PlaceholderType source, UnifyType target) {
substitutions.put(source, target);
}
/**
* Identity function as an "unifier".
*/
protected Unifier() {
}
/**
* Creates an unifier that is the identity function (thus has no substitutions).
substitutions.put(source, target);
}
/**
* Identity function as an "unifier".
*/
protected Unifier() {
}
/**
* Creates an unifier that is the identity function (thus has no substitutions).
*/
public static Unifier identity() {
return new Unifier();
}
/**
* Adds a substitution to the unifier from (source -> target)
* @param The type that is replaced
* @param The type that replaces
*/
public static Unifier identity() {
return new Unifier();
}
/**
* Adds a substitution to the unifier from (source -> target)
* @param The type that is replaced
* @param The type that replaces
*/
public void add(PlaceholderType source, UnifyType target) {
Unifier tempU = new Unifier(source, target);
// Every new substitution must be applied to previously added substitutions
// otherwise the unifier needs to be applied multiple times to unify two terms
for(PlaceholderType pt : substitutions.keySet())
substitutions.put(pt, substitutions.get(pt).apply(tempU));
substitutions.put(source, target);
}
@Override
public UnifyType apply(UnifyType t) {
return t.apply(this);
}
/**
* Applies the unifier to the two terms of the pair.
* @return A new pair where the left and right-hand side are applied
*/
public UnifyPair apply(UnifyPair p) {
UnifyType newLhs = this.apply(p.getLhsType());
UnifyType newRhs = this.apply(p.getRhsType());
return new UnifyPair(newLhs, newRhs, p.getPairOp());
}
/**
* Applies the unifier to the two terms of the pair.
* works only for single subsitution
* @return A new pair where the left and right-hand side are applied
*/
public UnifyPair apply(UnifyPair thisAsPair, UnifyPair p) {
UnifyType newLhs = this.apply(p.getLhsType());
UnifyType newRhs = this.apply(p.getRhsType());
//Varianceweitergabe wird nicht benoetigt.
//PlaceholderType lhsph = (PlaceholderType)thisAsPair.getLhsType();
//if (lhsph.getVariance() != 0) {
// if (p.getLhsType().equals(lhsph)) {
// if (p.getRhsType() instanceof PlaceholderType) {
// ((PlaceholderType)p.getRhsType()).setVariance(lhsph.getVariance());
// }
// }
// if (p.getRhsType().equals(lhsph)) {
// if (p.getLhsType() instanceof PlaceholderType) {
// ((PlaceholderType)p.getLhsType()).setVariance(lhsph.getVariance());
// }
// }
//}
if (!(p.getLhsType().equals(newLhs)) || !(p.getRhsType().equals(newRhs))) {//Die Anwendung von this hat was veraendert PL 2018-04-01
Set<UnifyPair> suniUnifyPair = new HashSet<>();
suniUnifyPair.addAll(thisAsPair.getAllSubstitutions());
suniUnifyPair.add(thisAsPair);
if (p.getLhsType() instanceof PlaceholderType //&& newLhs instanceof PlaceholderType entfernt PL 2018-04-13
&& p.getPairOp() == PairOperator.EQUALSDOT) {
suniUnifyPair.add(p); //p koennte auch subsitution sein
}
return new UnifyPair(newLhs, newRhs, p.getPairOp(), suniUnifyPair, p);
}
return new UnifyPair(newLhs, newRhs, p.getPairOp(), p.getSubstitution(), p.getBasePair(), p.getfBounded());
}
/**
* Applies the unifier to the left terms of the pair.
* @return A new pair where the left and right-hand side are applied
*/
public UnifyPair applyleft(UnifyPair p) {
return new UnifyPair(this.apply(p.getLhsType()), p.getRhsType(), p.getPairOp());
}
/**
* True if the typevariable t will be substituted if the unifier is applied.
* false otherwise.
*/
public boolean hasSubstitute(PlaceholderType t) {
return substitutions.containsKey(t);
}
/**
* Returns the type that will replace the typevariable t if the unifier is applied.
*/
public UnifyType getSubstitute(PlaceholderType t) {
return substitutions.get(t);
}
/**
* The number of substitutions in the unifier. If zero, this is the identity function.
*/
public int size() {
return substitutions.size();
}
/**
* Garantuees that if there is a substitutions (a -> b) in this unifier,
* a is not an element of the targetParams. Substitutions that do not
* satisfy this condition, are swapped.
*/
public void swapPlaceholderSubstitutions(Iterable<UnifyType> targetParams) {
for(UnifyType tph : targetParams) {
if(!(tph instanceof PlaceholderType))
continue;
// Swap a substitutions (a -> b) if a is an element of the target params.
if(substitutions.containsKey(tph)) {
if((substitutions.get(tph) instanceof PlaceholderType)) {
PlaceholderType newLhs = (PlaceholderType) substitutions.get(tph);
substitutions.remove(tph);
substitutions.put(newLhs, tph);
}
}
}
}
public void swapPlaceholderSubstitutionsReverse(Iterable<UnifyType> sourceParams) {
for(UnifyType tph : sourceParams) {
if(!(tph instanceof PlaceholderType))
continue;
if(substitutions.containsValue(tph)) {
UnifyType key = substitutions.values().stream().filter(x -> x.equals(tph)).findAny().get();
if(key instanceof PlaceholderType) {
PlaceholderType newLhs = (PlaceholderType) tph;
substitutions.remove(key);
substitutions.put(newLhs, key);
}
}
}
}
@Override
public String toString() {
String result = "{ ";
for(Entry<PlaceholderType, UnifyType> entry : substitutions.entrySet())
result += "(" + entry.getKey() + " -> " + entry.getValue() + "), ";
if(!substitutions.isEmpty())
result = result.substring(0, result.length()-2);
result += " }";
return result;
}
@Override
public Iterator<Entry<PlaceholderType, UnifyType>> iterator() {
return substitutions.entrySet().iterator();
}
}
Unifier tempU = new Unifier(source, target);
// Every new substitution must be applied to previously added substitutions
// otherwise the unifier needs to be applied multiple times to unify two terms
for(PlaceholderType pt : substitutions.keySet())
substitutions.put(pt, substitutions.get(pt).apply(tempU));
substitutions.put(source, target);
}
@Override
public UnifyType apply(UnifyType t) {
return t.apply(this);
}
/**
* Applies the unifier to the two terms of the pair.
* @return A new pair where the left and right-hand side are applied
*/
public UnifyPair apply(UnifyPair p) {
UnifyType newLhs = this.apply(p.getLhsType());
UnifyType newRhs = this.apply(p.getRhsType());
return new UnifyPair(newLhs, newRhs, p.getPairOp());
}
/**
* Applies the unifier to the two terms of the pair.
* works only for single subsitution
* @return A new pair where the left and right-hand side are applied
*/
public UnifyPair apply(UnifyPair thisAsPair, UnifyPair p) {
UnifyType newLhs = this.apply(p.getLhsType());
UnifyType newRhs = this.apply(p.getRhsType());
//Varianceweitergabe wird nicht benoetigt.
//PlaceholderType lhsph = (PlaceholderType)thisAsPair.getLhsType();
//if (lhsph.getVariance() != 0) {
// if (p.getLhsType().equals(lhsph)) {
// if (p.getRhsType() instanceof PlaceholderType) {
// ((PlaceholderType)p.getRhsType()).setVariance(lhsph.getVariance());
// }
// }
// if (p.getRhsType().equals(lhsph)) {
// if (p.getLhsType() instanceof PlaceholderType) {
// ((PlaceholderType)p.getLhsType()).setVariance(lhsph.getVariance());
// }
// }
//}
if (!(p.getLhsType().equals(newLhs)) || !(p.getRhsType().equals(newRhs))) {//Die Anwendung von this hat was veraendert PL 2018-04-01
Set<UnifyPair> suniUnifyPair = new HashSet<>();
suniUnifyPair.addAll(thisAsPair.getAllSubstitutions());
suniUnifyPair.add(thisAsPair);
if (p.getLhsType() instanceof PlaceholderType //&& newLhs instanceof PlaceholderType entfernt PL 2018-04-13
&& p.getPairOp() == PairOperator.EQUALSDOT) {
suniUnifyPair.add(p); //p koennte auch subsitution sein
}
return new UnifyPair(newLhs, newRhs, p.getPairOp(), suniUnifyPair, p);
}
return new UnifyPair(newLhs, newRhs, p.getPairOp(), p.getSubstitution(), p.getBasePair(), p.getfBounded());
}
/**
* Applies the unifier to the left terms of the pair.
* @return A new pair where the left and right-hand side are applied
*/
public UnifyPair applyleft(UnifyPair p) {
return new UnifyPair(this.apply(p.getLhsType()), p.getRhsType(), p.getPairOp());
}
/**
* True if the typevariable t will be substituted if the unifier is applied.
* false otherwise.
*/
public boolean hasSubstitute(PlaceholderType t) {
return substitutions.containsKey(t);
}
/**
* Returns the type that will replace the typevariable t if the unifier is applied.
*/
public UnifyType getSubstitute(PlaceholderType t) {
return substitutions.get(t);
}
/**
* The number of substitutions in the unifier. If zero, this is the identity function.
*/
public int size() {
return substitutions.size();
}
/**
* Garantuees that if there is a substitutions (a -> b) in this unifier,
* a is not an element of the targetParams. Substitutions that do not
* satisfy this condition, are swapped.
*/
public void swapPlaceholderSubstitutions(Iterable<UnifyType> targetParams) {
for(UnifyType tph : targetParams) {
if(!(tph instanceof PlaceholderType))
continue;
// Swap a substitutions (a -> b) if a is an element of the target params.
if(substitutions.containsKey(tph)) {
if((substitutions.get(tph) instanceof PlaceholderType)) {
PlaceholderType newLhs = (PlaceholderType) substitutions.get(tph);
substitutions.remove(tph);
substitutions.put(newLhs, tph);
}
}
}
}
public void swapPlaceholderSubstitutionsReverse(Iterable<UnifyType> sourceParams) {
for(UnifyType tph : sourceParams) {
if(!(tph instanceof PlaceholderType))
continue;
if(substitutions.containsValue(tph)) {
UnifyType key = substitutions.values().stream().filter(x -> x.equals(tph)).findAny().get();
if(key instanceof PlaceholderType) {
PlaceholderType newLhs = (PlaceholderType) tph;
substitutions.remove(key);
substitutions.put(newLhs, key);
}
}
}
}
@Override
public String toString() {
String result = "{ ";
for(Entry<PlaceholderType, UnifyType> entry : substitutions.entrySet())
result += "(" + entry.getKey() + " -> " + entry.getValue() + "), ";
if(!substitutions.isEmpty())
result = result.substring(0, result.length()-2);
result += " }";
return result;
}
@Override
public Iterator<Entry<PlaceholderType, UnifyType>> iterator() {
return substitutions.entrySet().iterator();
}
}

@ -1,256 +1,256 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
/**
* A pair which contains two types and an operator, e.q. (Integer <. a).
* @author Florian Steurer
*/
public class UnifyPair {
/**
* The type on the left hand side of the pair.
*/
private final UnifyType lhs;
/**
* The type on the right hand side of the pair.
*/
private final UnifyType rhs;
/**
* The operator that determines the relation between the left and right hand side type.
*/
private PairOperator pairOp;
/** wieder loesecn wird nicht mehr benoetigt PL 2018-03-31
* variance shows the variance of the pair
* -1: contravariant
* 1 covariant
* 0 invariant
* PL 2018-03-21
*/
private byte variance = 0;
private boolean undefinedPair = false;
/**
* Unifier/substitute that generated this pair
* PL 2018-03-15
*/
private Set<UnifyPair> substitution;
/**
* Base on which the the unifier is applied
* PL 2018-03-15
*/
private UnifyPair basePair;
/**
* For pairs a <. Theta generated in the rule reduceTphSup
* to store the f-Bouned Elements to avoid endless recursion
* PL 2018-03-15
*/
private Set<UnifyType> fBounded = new HashSet<>();
private final int hashCode;
/**
* Creates a new instance of the pair.
* @param lhs The type on the left hand side of the pair.
* @param rhs The type on the right hand side of the pair.
* @param op The operator that determines the relation between the left and right hand side type.
*/
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op) {
this.lhs = lhs;
this.rhs = rhs;
pairOp = op;
substitution = new HashSet<>();
// Caching hashcode
hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode();
}
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set<UnifyPair> uni, UnifyPair base) {
this.lhs = lhs;
this.rhs = rhs;
pairOp = op;
substitution = uni;
basePair = base;
this.variance = variance;
// Caching hashcode
hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode();
}
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set<UnifyPair> uni, UnifyPair base, Set<UnifyType> fBounded) {
this(lhs, rhs, op, uni, base);
this.fBounded = fBounded;
}
/**
* Returns the type on the left hand side of the pair.
*/
public UnifyType getLhsType() {
return lhs;
}
/**
* Returns the type on the right hand side of the pair.
*/
public UnifyType getRhsType() {
return rhs;
}
/**
* Returns the operator that determines the relation between the left and right hand side type.
*/
public PairOperator getPairOp() {
return pairOp;
}
public void setPairOp(PairOperator po) {
pairOp = po;
}
public void addSubstitutions(Set<UnifyPair> sup) {
substitution.addAll(sup);
}
public byte getVariance() {
return variance;
}
public void setVariance(byte v) {
variance = v;
}
public void setUndefinedPair() {
undefinedPair = true;
}
public Set<UnifyPair> getSubstitution() {
return substitution;
}
public UnifyPair getBasePair() {
return basePair;
}
public boolean isUndefinedPair() {
return undefinedPair;
}
public Set<UnifyPair> getAllSubstitutions () {
Set<UnifyPair> ret = new HashSet<>();
ret.addAll(getSubstitution());
if (basePair != null) {
ret.addAll(basePair.getAllSubstitutions());
}
return ret;
}
public Set<UnifyPair> getAllBases () {
Set<UnifyPair> ret = new HashSet<>();
if (basePair != null) {
ret.add(getBasePair());
ret.addAll(basePair.getAllBases());
}
return ret;
}
public UnifyPair getGroundBasePair () {
if (basePair == null) {
return this;
}
if (basePair.getBasePair() == null) {
return basePair;
}
else {
return basePair.getGroundBasePair();
}
}
/**
* wenn in einem Paar bestehend aus 2 Typvariablen eine nicht wildcardtable ist,
* so beide auf nicht wildcardtable setzen
*/
public void disableCondWildcards() {
if (lhs instanceof PlaceholderType && rhs instanceof PlaceholderType
&& (!((PlaceholderType)lhs).isWildcardable() || !((PlaceholderType)rhs).isWildcardable()))
{
((PlaceholderType)lhs).disableWildcardtable();
((PlaceholderType)rhs).disableWildcardtable();
}
}
public Boolean wrongWildcard() {
return lhs.wrongWildcard() || rhs.wrongWildcard();
}
public Set<UnifyType> getfBounded() {
return this.fBounded;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof UnifyPair))
return false;
if(obj.hashCode() != this.hashCode())
return false;
UnifyPair other = (UnifyPair) obj;
if (isUndefinedPair()) {
if (other.getBasePair() != basePair || (other.getBasePair() == null && basePair == null)) {
return false;
}
if (!other.getBasePair().equals(basePair) ||
!other.getAllSubstitutions().equals(getAllSubstitutions())) {
return false;
}
}
return other.getPairOp() == pairOp
&& other.getLhsType().equals(lhs)
&& other.getRhsType().equals(rhs);
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public String toString() {
String ret = "";
if (lhs instanceof PlaceholderType) {
ret = new Integer(((PlaceholderType)lhs).getVariance()).toString() + " " + ((PlaceholderType)lhs).isInnerType()
+ " " + ((PlaceholderType)lhs).isWildcardable();
}
if (rhs instanceof PlaceholderType) {
ret = ret + ", " + new Integer(((PlaceholderType)rhs).getVariance()).toString() + " " + ((PlaceholderType)rhs).isInnerType()
+ " " + ((PlaceholderType)rhs).isWildcardable();
}
return "(" + lhs + " " + pairOp + " " + rhs + ", " + ret + ")"; //+ ", [" + getfBounded().toString()+ "])";
}
/*
public List<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.addAll(lhs.getInvolvedPlaceholderTypes());
ret.addAll(rhs.getInvolvedPlaceholderTypes());
return ret;
}
*/
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
/**
* A pair which contains two types and an operator, e.q. (Integer <. a).
* @author Florian Steurer
*/
public class UnifyPair {
/**
* The type on the left hand side of the pair.
*/
private final UnifyType lhs;
/**
* The type on the right hand side of the pair.
*/
private final UnifyType rhs;
/**
* The operator that determines the relation between the left and right hand side type.
*/
private PairOperator pairOp;
/** wieder loesecn wird nicht mehr benoetigt PL 2018-03-31
* variance shows the variance of the pair
* -1: contravariant
* 1 covariant
* 0 invariant
* PL 2018-03-21
*/
private byte variance = 0;
private boolean undefinedPair = false;
/**
* Unifier/substitute that generated this pair
* PL 2018-03-15
*/
private Set<UnifyPair> substitution;
/**
* Base on which the the unifier is applied
* PL 2018-03-15
*/
private UnifyPair basePair;
/**
* For pairs a <. Theta generated in the rule reduceTphSup
* to store the f-Bouned Elements to avoid endless recursion
* PL 2018-03-15
*/
private Set<UnifyType> fBounded = new HashSet<>();
private final int hashCode;
/**
* Creates a new instance of the pair.
* @param lhs The type on the left hand side of the pair.
* @param rhs The type on the right hand side of the pair.
* @param op The operator that determines the relation between the left and right hand side type.
*/
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op) {
this.lhs = lhs;
this.rhs = rhs;
pairOp = op;
substitution = new HashSet<>();
// Caching hashcode
hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode();
}
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set<UnifyPair> uni, UnifyPair base) {
this.lhs = lhs;
this.rhs = rhs;
pairOp = op;
substitution = uni;
basePair = base;
this.variance = variance;
// Caching hashcode
hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode();
}
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op, Set<UnifyPair> uni, UnifyPair base, Set<UnifyType> fBounded) {
this(lhs, rhs, op, uni, base);
this.fBounded = fBounded;
}
/**
* Returns the type on the left hand side of the pair.
*/
public UnifyType getLhsType() {
return lhs;
}
/**
* Returns the type on the right hand side of the pair.
*/
public UnifyType getRhsType() {
return rhs;
}
/**
* Returns the operator that determines the relation between the left and right hand side type.
*/
public PairOperator getPairOp() {
return pairOp;
}
public void setPairOp(PairOperator po) {
pairOp = po;
}
public void addSubstitutions(Set<UnifyPair> sup) {
substitution.addAll(sup);
}
public byte getVariance() {
return variance;
}
public void setVariance(byte v) {
variance = v;
}
public void setUndefinedPair() {
undefinedPair = true;
}
public Set<UnifyPair> getSubstitution() {
return new HashSet<>(substitution);
}
public UnifyPair getBasePair() {
return basePair;
}
public boolean isUndefinedPair() {
return undefinedPair;
}
public Set<UnifyPair> getAllSubstitutions () {
Set<UnifyPair> ret = new HashSet<>();
ret.addAll(new ArrayList<>(getSubstitution()));
if (basePair != null) {
ret.addAll(new ArrayList<>(basePair.getAllSubstitutions()));
}
return ret;
}
public Set<UnifyPair> getAllBases () {
Set<UnifyPair> ret = new HashSet<>();
if (basePair != null) {
ret.add(getBasePair());
ret.addAll(basePair.getAllBases());
}
return ret;
}
public UnifyPair getGroundBasePair () {
if (basePair == null) {
return this;
}
if (basePair.getBasePair() == null) {
return basePair;
}
else {
return basePair.getGroundBasePair();
}
}
/**
* wenn in einem Paar bestehend aus 2 Typvariablen eine nicht wildcardtable ist,
* so beide auf nicht wildcardtable setzen
*/
public void disableCondWildcards() {
if (lhs instanceof PlaceholderType && rhs instanceof PlaceholderType
&& (!((PlaceholderType)lhs).isWildcardable() || !((PlaceholderType)rhs).isWildcardable()))
{
((PlaceholderType)lhs).disableWildcardtable();
((PlaceholderType)rhs).disableWildcardtable();
}
}
public Boolean wrongWildcard() {
return lhs.wrongWildcard() || rhs.wrongWildcard();
}
public Set<UnifyType> getfBounded() {
return this.fBounded;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof UnifyPair))
return false;
if(obj.hashCode() != this.hashCode())
return false;
UnifyPair other = (UnifyPair) obj;
if (isUndefinedPair()) {
if (other.getBasePair() != basePair || (other.getBasePair() == null && basePair == null)) {
return false;
}
if (!other.getBasePair().equals(basePair) ||
!other.getAllSubstitutions().equals(getAllSubstitutions())) {
return false;
}
}
return other.getPairOp() == pairOp
&& other.getLhsType().equals(lhs)
&& other.getRhsType().equals(rhs);
}
@Override
public int hashCode() {
return hashCode;
}
@Override
public String toString() {
String ret = "";
if (lhs instanceof PlaceholderType) {
ret = new Integer(((PlaceholderType)lhs).getVariance()).toString() + " " + ((PlaceholderType)lhs).isInnerType()
+ " " + ((PlaceholderType)lhs).isWildcardable();
}
if (rhs instanceof PlaceholderType) {
ret = ret + ", " + new Integer(((PlaceholderType)rhs).getVariance()).toString() + " " + ((PlaceholderType)rhs).isInnerType()
+ " " + ((PlaceholderType)rhs).isWildcardable();
}
return "(" + lhs + " " + pairOp + " " + rhs + ", " + ret + ")"; //+ ", [" + getfBounded().toString()+ "])";
}
/*
public List<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.addAll(lhs.getInvolvedPlaceholderTypes());
ret.addAll(rhs.getInvolvedPlaceholderTypes());
return ret;
}
*/
}

@ -1,119 +1,119 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import de.dhbwstuttgart.syntaxtree.StatementVisitor;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* Represents a java type.
* @author Florian Steurer
*/
public abstract class UnifyType {
/**
* The name of the type e.q. "Integer", "? extends Integer" or "List" for (List<T>)
*/
protected final String typeName;
/**
* The type parameters of the type.
*/
protected final TypeParams typeParams;
/**
* Creates a new instance
* @param name Name of the type (e.q. List for List<T>, Integer or ? extends Integer)
* @param typeParams Parameters of the type (e.q. <T> for List<T>)
*/
protected UnifyType(String name, TypeParams p) {
typeName = name;
typeParams = p;
}
abstract public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht);
/**
* Returns the name of the type.
* @return The name e.q. List for List<T>, Integer or ? extends Integer
*/
public String getName() {
return typeName;
}
/**
* The parameters of the type.
* @return Parameters of the type, e.q. <T> for List<T>.
*/
public TypeParams getTypeParams() {
return typeParams;
}
/**
* Returns a new type that equals this type except for the type parameters.
* @param newTp The type params of the new type.
* @return A new type object.
*/
public abstract UnifyType setTypeParams(TypeParams newTp);
/**
* Implementation of the visitor-pattern. Returns the set of smArg
* by calling the most specific overload in the FC.
* @param fc The FC that is called.
* @return The set that is smArg(this)
*/
abstract Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded);
/**
* Implementation of the visitor-pattern. Returns the set of grArg
* by calling the most specific overload in the FC.
* @param fc The FC that is called.
* @return The set that is grArg(this)
*/
abstract Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded);
/**
* Applies a unifier to this object.
* @param unif The unifier
* @return A UnifyType, that may or may not be a new object, that has its subtypes substituted.
*/
abstract UnifyType apply(Unifier unif);
@Override
public String toString() {
String params = "";
if(typeParams.size() != 0) {
for(UnifyType param : typeParams)
params += param.toString() + ",";
params = "<" + params.substring(0, params.length()-1) + ">";
}
return typeName + params;
}
public Collection<PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.addAll(typeParams.getInvolvedPlaceholderTypes());
return ret;
}
public Boolean wrongWildcard() {//default
return false;
}
@Override
public int hashCode() {
return this.toString().hashCode();
}
@Override
public boolean equals(Object obj) {
return this.toString().equals(obj.toString());
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import de.dhbwstuttgart.syntaxtree.StatementVisitor;
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
import de.dhbwstuttgart.typeinference.unify.interfaces.UnifyTypeVisitor;
/**
* Represents a java type.
* @author Florian Steurer
*/
public abstract class UnifyType {
/**
* The name of the type e.q. "Integer", "? extends Integer" or "List" for (List<T>)
*/
protected final String typeName;
/**
* The type parameters of the type.
*/
protected final TypeParams typeParams;
/**
* Creates a new instance
* @param name Name of the type (e.q. List for List<T>, Integer or ? extends Integer)
* @param typeParams Parameters of the type (e.q. <T> for List<T>)
*/
protected UnifyType(String name, TypeParams p) {
typeName = name;
typeParams = p;
}
abstract public <T> UnifyType accept(UnifyTypeVisitor<T> visitor, T ht);
/**
* Returns the name of the type.
* @return The name e.q. List for List<T>, Integer or ? extends Integer
*/
public String getName() {
return typeName;
}
/**
* The parameters of the type.
* @return Parameters of the type, e.q. <T> for List<T>.
*/
public TypeParams getTypeParams() {
return typeParams;
}
/**
* Returns a new type that equals this type except for the type parameters.
* @param newTp The type params of the new type.
* @return A new type object.
*/
public abstract UnifyType setTypeParams(TypeParams newTp);
/**
* Implementation of the visitor-pattern. Returns the set of smArg
* by calling the most specific overload in the FC.
* @param fc The FC that is called.
* @return The set that is smArg(this)
*/
abstract Set<UnifyType> smArg(IFiniteClosure fc, Set<UnifyType> fBounded);
/**
* Implementation of the visitor-pattern. Returns the set of grArg
* by calling the most specific overload in the FC.
* @param fc The FC that is called.
* @return The set that is grArg(this)
*/
abstract Set<UnifyType> grArg(IFiniteClosure fc, Set<UnifyType> fBounded);
/**
* Applies a unifier to this object.
* @param unif The unifier
* @return A UnifyType, that may or may not be a new object, that has its subtypes substituted.
*/
abstract UnifyType apply(Unifier unif);
@Override
public String toString() {
String params = "";
if(typeParams.size() != 0) {
for(UnifyType param : typeParams)
params += param.toString() + ",";
params = "<" + params.substring(0, params.length()-1) + ">";
}
return typeName + params;
}
public Collection<PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.addAll(typeParams.getInvolvedPlaceholderTypes());
return ret;
}
public Boolean wrongWildcard() {//default
return false;
}
@Override
public int hashCode() {
return this.toString().hashCode();
}
@Override
public boolean equals(Object obj) {
return this.toString().equals(obj.toString());
}
}

@ -1,72 +1,72 @@
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
/**
* A wildcard type that is either a ExtendsType or a SuperType.
* @author Florian Steurer
*/
public abstract class WildcardType extends UnifyType {
/**
* The wildcarded type, e.q. Integer for ? extends Integer. Never a wildcard type itself.
*/
protected UnifyType wildcardedType;
/**
* Creates a new instance.
* @param name The name of the type, e.q. ? extends Integer
* @param wildcardedType The wildcarded type, e.q. Integer for ? extends Integer. Never a wildcard type itself.
*/
protected WildcardType(String name, UnifyType wildcardedType) {
super(name, wildcardedType.getTypeParams());
this.wildcardedType = wildcardedType;
}
/**
* Returns the wildcarded type, e.q. Integer for ? extends Integer.
* @return The wildcarded type. Never a wildcard type itself.
*/
public UnifyType getWildcardedType() {
return wildcardedType;
}
/**
* Returns the type parameters of the WILDCARDED TYPE.
*/
@Override
public TypeParams getTypeParams() {
return wildcardedType.getTypeParams();
}
@Override
public Boolean wrongWildcard () {//This is an error
return (wildcardedType instanceof WildcardType);
}
@Override
public int hashCode() {
return wildcardedType.hashCode() + getName().hashCode() + 17;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof WildcardType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
WildcardType other = (WildcardType) obj;
return other.getWildcardedType().equals(wildcardedType);
}
@Override
public Collection<PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.addAll(wildcardedType.getInvolvedPlaceholderTypes());
return ret;
}
}
package de.dhbwstuttgart.typeinference.unify.model;
import java.util.ArrayList;
import java.util.Collection;
/**
* A wildcard type that is either a ExtendsType or a SuperType.
* @author Florian Steurer
*/
public abstract class WildcardType extends UnifyType {
/**
* The wildcarded type, e.q. Integer for ? extends Integer. Never a wildcard type itself.
*/
protected UnifyType wildcardedType;
/**
* Creates a new instance.
* @param name The name of the type, e.q. ? extends Integer
* @param wildcardedType The wildcarded type, e.q. Integer for ? extends Integer. Never a wildcard type itself.
*/
protected WildcardType(String name, UnifyType wildcardedType) {
super(name, wildcardedType.getTypeParams());
this.wildcardedType = wildcardedType;
}
/**
* Returns the wildcarded type, e.q. Integer for ? extends Integer.
* @return The wildcarded type. Never a wildcard type itself.
*/
public UnifyType getWildcardedType() {
return wildcardedType;
}
/**
* Returns the type parameters of the WILDCARDED TYPE.
*/
@Override
public TypeParams getTypeParams() {
return wildcardedType.getTypeParams();
}
@Override
public Boolean wrongWildcard () {//This is an error
return (wildcardedType instanceof WildcardType);
}
@Override
public int hashCode() {
return wildcardedType.hashCode() + getName().hashCode() + 17;
}
@Override
public boolean equals(Object obj) {
if(!(obj instanceof WildcardType))
return false;
if(obj.hashCode() != this.hashCode())
return false;
WildcardType other = (WildcardType) obj;
return other.getWildcardedType().equals(wildcardedType);
}
@Override
public Collection<PlaceholderType> getInvolvedPlaceholderTypes() {
ArrayList<PlaceholderType> ret = new ArrayList<>();
ret.addAll(wildcardedType.getInvolvedPlaceholderTypes());
return ret;
}
}

@ -37,14 +37,14 @@ public class BinaryTest {
public void test() throws Exception {
Method m2 = classToTest.getDeclaredMethod("m2", Integer.class,Integer.class);
Integer res = (Integer) m2.invoke(instanceOfClass, 2,3);
assertEquals(6, res);
assertEquals(new Integer(6), res);
}
@Test
public void testM3() throws Exception {
Method m3 = classToTest.getDeclaredMethod("m3", Integer.class);
Integer res = (Integer) m3.invoke(instanceOfClass, 2);
assertEquals(4, res);
assertEquals(new Integer(4), res);
}
}

@ -0,0 +1,37 @@
package bytecode;
import static org.junit.Assert.*;
import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import org.junit.BeforeClass;
import org.junit.Test;
import de.dhbwstuttgart.core.JavaTXCompiler;
public class ClassGenLamTest {
private static String path;
private static File fileToTest;
private static JavaTXCompiler compiler;
private static ClassLoader loader;
private static Class<?> classToTest;
private static String pathToClassFile;
private static Object instanceOfClass;
@Test
public void generateBC() throws Exception {
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/ClassGenLam.jav";
fileToTest = new File(path);
compiler = new JavaTXCompiler(fileToTest);
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
compiler.generateBytecode(pathToClassFile);
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("ClassGenLam");
instanceOfClass = classToTest.getDeclaredConstructor().newInstance();
}
}

@ -38,7 +38,7 @@ public class FacTest {
public void testInteger() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Method getFac = classToTest.getDeclaredMethod("getFac", Integer.class);
Integer result = (Integer) getFac.invoke(instanceOfClass,3);
assertEquals(result, 6);
assertEquals(result, new Integer(6));
}
}

@ -51,7 +51,7 @@ public class FacultyTest {
// Integer result = (Integer) apply.invoke(lambda,i);
Integer result = (Integer) getFact.invoke(instanceOfClass,i);
assertEquals(6, result);
assertEquals(new Integer(6), result);
}

@ -33,14 +33,14 @@ public class FieldTphConsMethTest {
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("FieldTphConsMeth");
}
@Test
public void test() throws Exception {
instanceOfClass = classToTest.getConstructor(Object.class).newInstance("C");
Field a = classToTest.getDeclaredField("a");
a.setAccessible(true);
Method m = classToTest.getDeclaredMethod("m", Object.class);
Method m = classToTest.getDeclaredMethod("id", Object.class);
Object result = m.invoke(instanceOfClass, 42);
assertEquals(42,result);

@ -8,9 +8,10 @@ import java.net.URL;
import java.net.URLClassLoader;
import org.junit.BeforeClass;
import org.junit.Test;
import de.dhbwstuttgart.core.JavaTXCompiler;
import org.junit.Test;
public class IdTest {

@ -43,7 +43,7 @@ public class LambdaTest {
System.out.println(m.invoke(instanceOfClass).toString());
Integer result = (Integer) apply.invoke(m.invoke(instanceOfClass), i);
assertEquals(77, result);
assertEquals(i, result);
}

@ -28,76 +28,75 @@ public class MatrixOpTest {
private static Object instanceOfClass_m3;
@Test
public void test() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IOException, InstantiationException, NoSuchFieldException {
path = System.getProperty("user.dir")+"/src/test/resources/bytecode/javFiles/MatrixOP.jav";
public void test() throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException, IOException, InstantiationException, NoSuchFieldException {
path = System.getProperty("user.dir") + "/src/test/resources/bytecode/javFiles/MatrixOP.jav";
fileToTest = new File(path);
compiler = new JavaTXCompiler(fileToTest);
pathToClassFile = System.getProperty("user.dir")+"/src/test/resources/testBytecode/generatedBC/";
pathToClassFile = System.getProperty("user.dir") + "/src/test/resources/testBytecode/generatedBC/";
compiler.generateBytecode(pathToClassFile);
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
classToTest = loader.loadClass("MatrixOP");
loader = new URLClassLoader(new URL[]{new URL("file://" + pathToClassFile)});
classToTest = loader.loadClass("MatrixOP");
Vector<Vector<Integer>> vv = new Vector<Vector<Integer>>();
Vector<Integer> v1 = new Vector<Integer> ();
v1.addElement(2);
v1.addElement(2);
Vector<Integer> v2 = new Vector<Integer> ();
v2.addElement(3);
v2.addElement(3);
//Matrix m1 = new Matrix();
//m1.addElement(v1);
//m1.addElement(v2);
vv.addElement(v1);
vv.addElement(v2);
instanceOfClass_m1 = classToTest.getDeclaredConstructor(Vector.class).newInstance(vv); //Matrix m1 = new Matrix(vv);
Vector<Integer> v1 = new Vector<Integer>();
v1.addElement(2);
v1.addElement(2);
Vector<Integer> v2 = new Vector<Integer>();
v2.addElement(3);
v2.addElement(3);
//Matrix m1 = new Matrix();
//m1.addElement(v1);
//m1.addElement(v2);
vv.addElement(v1);
vv.addElement(v2);
Vector<Vector<Integer>> vv1 = new Vector<Vector<Integer>>();
Vector<Integer> v3 = new Vector<Integer> ();
v3.addElement(2);
v3.addElement(2);
Vector<Integer> v4 = new Vector<Integer> ();
v4.addElement(3);
v4.addElement(3);
//Matrix m2 = new Matrix();
//m2.addElement(v3);
//m2.addElement(v4);
vv1.addElement(v3);
vv1.addElement(v4);
instanceOfClass_m2 = classToTest.getDeclaredConstructor(Vector.class).newInstance(vv1);//Matrix m2 = new Matrix(vv1);
instanceOfClass_m1 = classToTest.getDeclaredConstructor(Vector.class).newInstance(vv); //Matrix m1 = new Matrix(vv);
//Matrix m3 = m1.mul(vv1);
Vector<Vector<Integer>> vv1 = new Vector<Vector<Integer>>();
Vector<Integer> v3 = new Vector<Integer>();
v3.addElement(2);
v3.addElement(2);
Vector<Integer> v4 = new Vector<Integer>();
v4.addElement(3);
v4.addElement(3);
//Matrix m2 = new Matrix();
//m2.addElement(v3);
//m2.addElement(v4);
vv1.addElement(v3);
vv1.addElement(v4);
instanceOfClass_m2 = classToTest.getDeclaredConstructor(Vector.class).newInstance(vv1);//Matrix m2 = new Matrix(vv1);
//Matrix m3 = m1.mul(vv1);
// Method mul = classToTest.getDeclaredMethod("mul", Vector.class);
// Object result = mul.invoke(instanceOfClass_m1, instanceOfClass_m2);
Field mul = classToTest.getField("mul");
mul.setAccessible(true);
Class<?> lambda = mul.get(instanceOfClass_m1).getClass();
Method apply = lambda.getMethod("apply", Object.class,Object.class);
Field mul = classToTest.getField("mul");
mul.setAccessible(true);
Class<?> lambda = mul.get(instanceOfClass_m1).getClass();
Method apply = lambda.getMethod("apply", Object.class, Object.class);
// Damit man auf die Methode zugreifen kann
apply.setAccessible(true);
Object result = apply.invoke(mul.get(instanceOfClass_m1),instanceOfClass_m1, instanceOfClass_m2);
System.out.println(instanceOfClass_m1.toString() + " * " + instanceOfClass_m2.toString() + " = " + result.toString());
Vector<Vector<Integer>> res = new Vector<Vector<Integer>>();
Vector<Integer> v5 = new Vector<Integer> ();
v5.addElement(10);
v5.addElement(10);
Vector<Integer> v6 = new Vector<Integer> ();
v6.addElement(15);
v6.addElement(15);
//Matrix m2 = new Matrix();
//m2.addElement(v3);
//m2.addElement(v4);
res.addElement(v5);
res.addElement(v6);
instanceOfClass_m3 = classToTest.getDeclaredConstructor(Vector.class).newInstance(res);
assertEquals(result, instanceOfClass_m3);
apply.setAccessible(true);
Object result = apply.invoke(mul.get(instanceOfClass_m1), instanceOfClass_m1, instanceOfClass_m2);
System.out.println(instanceOfClass_m1.toString() + " * " + instanceOfClass_m2.toString() + " = " + result.toString());
Vector<Vector<Integer>> res = new Vector<Vector<Integer>>();
Vector<Integer> v5 = new Vector<Integer>();
v5.addElement(10);
v5.addElement(10);
Vector<Integer> v6 = new Vector<Integer>();
v6.addElement(15);
v6.addElement(15);
//Matrix m2 = new Matrix();
//m2.addElement(v3);
//m2.addElement(v4);
res.addElement(v5);
res.addElement(v6);
instanceOfClass_m3 = classToTest.getDeclaredConstructor(Vector.class).newInstance(res);
assertEquals(result, instanceOfClass_m3);
}
}

Some files were not shown because too many files have changed in this diff Show More