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
This commit is contained in:
AluAli 2020-10-16 15:13:50 +02:00
parent 040300d78e
commit 1e7c25805e
3 changed files with 140 additions and 0 deletions

View File

@ -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<TPHConstraint> cs;
public FamilyOfGeneratedGenerics(List<TPHConstraint> cs) {
this.cs = cs;
}
List<ClassConstraints> cs_cl;
List<MethodConstraints> 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<TPHConstraint> constraintsSet) {
//TODO: Regeln
for(TPHConstraint cons: constraintsSet){
cs_cl =
}
}
public void addConstraintToMethodConstraint(List<Constraints> constraintsSet) {
//TODO: Regeln
/*for(Constraint cons: constraintsSet){
cs_m =
}*/
}
GeneratedGenericsFinder genGenFinder;
ConstraintsSimplierResult simplifiedConstraints = null;
GenericsGeneratorResultForClass ggResult = null;
Method m;
public void addMethodConstraints(List<MethodConstraints> cs_m) {
genGenFinder.addMethodConstraints(simplifiedConstraints, ggResult, m);
cs_m.add();
}
}

View File

@ -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<File> input = new ArrayList<>();
List<File> classpath = new ArrayList<>();
JavaTXCompiler compiler = new JavaTXCompiler(input, classpath);
compiler.typeInference();
public List<ResultSet> getResultOfTypeInference() {
return null;
}
}
*/

View File

@ -0,0 +1,9 @@
package de.dhbwstuttgart.bytecode.gGenericsAli;
import de.dhbwstuttgart.typeinference.result.ResultSet;
import java.util.List;
interface preGGenerics {
public List<ResultSet> getResultOfTypeInference();
}