From 1e7c25805e81b79ebe3d84f9dd249a31e73663eb Mon Sep 17 00:00:00 2001 From: AluAli Date: Fri, 16 Oct 2020 15:13:50 +0200 Subject: [PATCH] new file: src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java new file: src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java new file: src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java --- .../FamilyOfGeneratedGenerics.java | 89 +++++++++++++++++++ .../bytecode/gGenericsAli/GGenerics.java | 42 +++++++++ .../bytecode/gGenericsAli/preGGenerics.java | 9 ++ 3 files changed, 140 insertions(+) create mode 100644 src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java create mode 100644 src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java create mode 100644 src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java diff --git a/src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java b/src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java new file mode 100644 index 00000000..54c2dbdf --- /dev/null +++ b/src/de/dhbwstuttgart/bytecode/gGenericsAli/FamilyOfGeneratedGenerics.java @@ -0,0 +1,89 @@ +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/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java b/src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java new file mode 100644 index 00000000..a3f289c7 --- /dev/null +++ b/src/de/dhbwstuttgart/bytecode/gGenericsAli/GGenerics.java @@ -0,0 +1,42 @@ +/* +package de.dhbwstuttgart.bytecode.gGenericsAli; + +import de.dhbwstuttgart.core.JavaTXCompiler; +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +*/ +/** + * gets set of typed variable constraints with substitutions and the set of typed classes + * and returns the set of families of generated generics and the set of families of type variable mappings + *//* + +public class GGenerics implements preGGenerics { + private TVarConstraints tVarCons; + private Substitutions subst; + private TClass typedClass; + + + public GGenerics(TVarConstraints tVarCons, Substitutions subst, TClass typedClass) throws IOException, ClassNotFoundException { + this.tVarCons = tVarCons; + this.subst = subst; + this.typedClass = typedClass; + } + + List input = new ArrayList<>(); + List classpath = new ArrayList<>(); + + JavaTXCompiler compiler = new JavaTXCompiler(input, classpath); + compiler.typeInference(); + + public List getResultOfTypeInference() { + return null; + } + + +} +*/ diff --git a/src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java b/src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java new file mode 100644 index 00000000..781e3d76 --- /dev/null +++ b/src/de/dhbwstuttgart/bytecode/gGenericsAli/preGGenerics.java @@ -0,0 +1,9 @@ +package de.dhbwstuttgart.bytecode.gGenericsAli; + +import de.dhbwstuttgart.typeinference.result.ResultSet; + +import java.util.List; + +interface preGGenerics { + public List getResultOfTypeInference(); +} \ No newline at end of file