From f6154b8f2caf4505fe0ca0df02c648bccd2945ae Mon Sep 17 00:00:00 2001 From: AluAli Date: Thu, 22 Oct 2020 22:13:05 +0200 Subject: [PATCH] deleted: src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java new file: src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/ClassConstraint.java new file: src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java renamed: src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java -> src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java new file: src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/MethodConstraint.java renamed: src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java -> src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java --- .../FamilyOfGeneratedGenerics.java | 89 ---------- .../gGenericsAli/ClassConstraint.java | 4 + .../FamilyOfGeneratedGenerics.java | 159 ++++++++++++++++++ .../bytecode/gGenericsAli/GGenerics.java | 0 .../gGenericsAli/MethodConstraint.java | 4 + .../bytecode/gGenericsAli/preGGenerics.java | 0 6 files changed, 167 insertions(+), 89 deletions(-) delete mode 100644 src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java create mode 100644 src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/ClassConstraint.java create mode 100644 src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java rename src/{ => main/java}/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java (100%) create mode 100644 src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/MethodConstraint.java rename src/{ => main/java}/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java (100%) diff --git a/src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java b/src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java deleted file mode 100644 index 54c2dbdf..00000000 --- a/src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java +++ /dev/null @@ -1,89 +0,0 @@ -package de.dhbwstuttgart.bytecode.gGenericsAli; - -import de.dhbwstuttgart.bytecode.constraint.TPHConstraint; -import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation; -import de.dhbwstuttgart.bytecode.genericsGenerator.ConstraintsSimplierResult; -import de.dhbwstuttgart.bytecode.genericsGenerator.GeneratedGenericsFinder; -import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass; -import de.dhbwstuttgart.syntaxtree.Method; - -import java.util.List; - -public class FamilyOfGeneratedGenerics { // extends TPHConstraint? - // private final TPHExtractor tphExtractor = new TPHExtractor(); - private final List cs; - public FamilyOfGeneratedGenerics(List cs) { - this.cs = cs; - } - - List cs_cl; - List cs_m; - - public Type getLeftSideOfConstraint(TPHConstraint constraint) { - Type leftSideType = null; - if(!(getRelationOfConstraint(constraint) == Relation.EXTENDS) { - continue; - } else { - leftSideType = constraint.getLeft(); - } - return leftSideType; - - } - - public Type getRightSideOfConstraint(TPHConstraint constraint) { - Type rightSideType = null; - if(!(getRelationOfConstraint(constraint) == Relation.EXTENDS)) { - continue; - } else { - rightSideType = constraint.getRight(); - } - return rightSideType; - } - - public Relation getRelationOfConstraint(TPHConstraint constraint) { - //TODO: get relation (EXTENDS or EQUAL) - return constraint.getRel(); - } - - - public void addConstraintToClassConstraint(List constraintsSet) { - //TODO: Regeln - for(TPHConstraint cons: constraintsSet){ - - cs_cl = - } - } - - public void addConstraintToMethodConstraint(List constraintsSet) { - //TODO: Regeln - /*for(Constraint cons: constraintsSet){ - - cs_m = - }*/ - } - - - - - - - - - - - - - - GeneratedGenericsFinder genGenFinder; - ConstraintsSimplierResult simplifiedConstraints = null; - GenericsGeneratorResultForClass ggResult = null; - Method m; - - public void addMethodConstraints(List cs_m) { - genGenFinder.addMethodConstraints(simplifiedConstraints, ggResult, m); - cs_m.add(); - } - - - -} diff --git a/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/ClassConstraint.java b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/ClassConstraint.java new file mode 100644 index 00000000..113a797e --- /dev/null +++ b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/ClassConstraint.java @@ -0,0 +1,4 @@ +package de.dhbwstuttgart.bytecode.gGenericsAli; + +public class ClassConstraint { +} diff --git a/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java new file mode 100644 index 00000000..ecaded57 --- /dev/null +++ b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java @@ -0,0 +1,159 @@ +package de.dhbwstuttgart.bytecode.gGenericsAli; + +import de.dhbwstuttgart.bytecode.constraint.TPHConstraint; +import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation; +import de.dhbwstuttgart.bytecode.genericsGenerator.ConstraintsSimplierResult; +import de.dhbwstuttgart.bytecode.genericsGenerator.GeneratedGenericsFinder; +import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass; +import de.dhbwstuttgart.syntaxtree.Method; + +import java.util.List; + +public class FamilyOfGeneratedGenerics { // extends TPHConstraint? + // private final TPHExtractor tphExtractor = new TPHExtractor(); + private final List cs; + public FamilyOfGeneratedGenerics(List cs) { + this.cs = cs; + } + + List cs_cl; + List cs_m; + + /*public Type getLeftSideOfConstraint(TPHConstraint constraint) { + Type leftSideType = null; + if(!(getRelationOfConstraint(constraint) == Relation.EXTENDS)) { + continue; + } else { + leftSideType = constraint.getLeft(); + } + return leftSideType; + }*/ + + public String getLeftSideOfConstraint(TPHConstraint constraint) { + if(constraint.getRel() == Relation.EXTENDS) + return constraint.getLeft(); + } + + /*public Type getRightSideOfConstraint(TPHConstraint constraint) { + Type rightSideType = null; + if(!(getRelationOfConstraint(constraint) == Relation.EXTENDS)) { + continue; + } else { + rightSideType = constraint.getRight(); + } + return rightSideType; + }*/ + + public String getRightSideOfConstraint(TPHConstraint constraint) { + if(constraint.getRel() == Relation.EXTENDS) + return constraint.getRight(); + } + + /*public Relation getRelationOfConstraint(TPHConstraint constraint) { + return constraint.getRel(); + }*/ + + + public void addConstraintToClassConstraint(List constraintsSet) { + //TODO: Regeln + for(TPHConstraint cons: constraintsSet){ + + cs_cl = + } + } + + public void addConstraintToMethodConstraint(List constraintsSet) { + //TODO: Regeln + for(TPHConstraint cons: constraintsSet){ + + cs_m = + } + } + + /** + * Def. FGG: erste Zeile von cs_cl + * {T < .T' | T is a type variable in a type of a node of a field} + */ + public List typeOfANodeOfAField() { + //TODO: + } + + /** + * Def. FGG: zweite Zeile von cs_cl + * {T' <. T'' | \exists T: (T <. T') \in cs_cl, (T' <. T'') \in cs } + */ + public List transitiveSubtypeForClass() { + //TODO: + } + + /** + * Def. FGG: dritte Zeile von cs_cl + * {T <. Object | ((T is a type variable in a type of a node of a field + * or (\exists T~: (T~ <. T) \in cs_cl)) and (\existsnot T': T <. T') \in cs)} + */ + public List hasNoSupertypeForClassTypes() { + + } + + + /** + * Def. FGG: erste Zeile von cs_m + * {T < .T' | T is a type variable in a type of the method/constructor m in cl_\sigma, (T <. T') \in cs} + */ + public List typeOfTheMethodInClSigma() { + + } + + /** + * Def. FGG: zweite Zeile von cs_m + * {R' <. S | (R <. R'), (S <. S') \in cs_m and (R',S) is in the transitive closure of cs} + */ + public List firstTransitiveSubtypeForMethodTypes() { + + } + + /** + * Def. FGG: dritte Zeile von cs_m + * {R' <. S | (R <. R') \in cs_m, (S <. S') \in cs_cl and (R',S) is in the transitive closure of cs} + */ + public List secondTransitiveSubtypeForMethodTypes() { + + } + + /** + * Def. FGG: vierte Zeile von cs_m + * {T <. Object | (T is a type variable in a type of a node of the method/constructor m in cl_\sigma), + * (\existsnot T': T <. T') \in cs)} + */ + public List hasNoSupertypeForMethodTypes() { + + } + + /** + * nimm die Menge cs_cl aus cs_m raus + */ + public List methodTypesWithoutClassTypes() { + + } + + + + + + + + + + GeneratedGenericsFinder genGenFinder; + ConstraintsSimplierResult simplifiedConstraints = null; + GenericsGeneratorResultForClass ggResult = null; + Method m; + + public void addMethodConstraints(List cs_m) { + genGenFinder.addMethodConstraints(simplifiedConstraints, ggResult, m); + cs_m.add(); + } + + + +} diff --git a/src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java similarity index 100% rename from src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java rename to src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java diff --git a/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/MethodConstraint.java b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/MethodConstraint.java new file mode 100644 index 00000000..79e7edab --- /dev/null +++ b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/MethodConstraint.java @@ -0,0 +1,4 @@ +package de.dhbwstuttgart.bytecode.gGenericsAli; + +public class MethodConstraint { +} diff --git a/src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java similarity index 100% rename from src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java rename to src/main/java/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java