forked from JavaTX/JavaCompilerCore
Compare commits
4 Commits
performanc
...
matrixTest
Author | SHA1 | Date | |
---|---|---|---|
|
890f64c813 | ||
|
5aadb7545e | ||
|
0c0ac61a02 | ||
|
46192e3fd3 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,5 @@
|
||||
CVS
|
||||
bin
|
||||
*.class
|
||||
*.log
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
@@ -15,11 +14,9 @@ bin
|
||||
.classpath
|
||||
*.iml
|
||||
.idea/
|
||||
/target/
|
||||
.DS_Store
|
||||
.project
|
||||
.settings/
|
||||
/target/
|
||||
|
||||
#
|
||||
manually/
|
||||
|
@@ -89,8 +89,8 @@ public class JavaTXCompiler {
|
||||
}
|
||||
public JavaTXCompiler(List<File> sources, List<File> contextPath) throws IOException, ClassNotFoundException {
|
||||
//statistics = new FileWriter(new File(System.getProperty("user.dir") + "/" + sources.get(0).getName() + "_"+ new Timestamp(System.currentTimeMillis())));
|
||||
statistics = new OutputStreamWriter(new NullOutputStream());
|
||||
statistics.write("test");
|
||||
statistics = new OutputStreamWriter(new NullOutputStream());
|
||||
statistics.write("test");
|
||||
if(contextPath == null || contextPath.isEmpty()){
|
||||
//When no contextPaths are given, the working directory is the sources root
|
||||
contextPath = Lists.newArrayList(new File(System.getProperty("user.dir")));
|
||||
|
@@ -56,7 +56,6 @@ import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
|
||||
import com.google.common.collect.Ordering;
|
||||
import org.apache.commons.io.output.NullWriter;
|
||||
|
||||
|
||||
/**
|
||||
@@ -162,10 +161,7 @@ public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
this.statistics = statistics;
|
||||
}
|
||||
public TypeUnifyTask(Set<UnifyPair> eq, List<Set<Constraint<UnifyPair>>> oderConstraints, IFiniteClosure fc, boolean parallel, Writer logFile, Boolean log, int rekTiefe, UnifyResultModel urm, UnifyTaskModel usedTasks) {
|
||||
synchronized (this) {
|
||||
if(statistics==null){
|
||||
statistics = new NullWriter();
|
||||
}
|
||||
synchronized (this) {
|
||||
this.eq = eq;
|
||||
//this.oderConstraints = oderConstraints.stream().map(x -> x.stream().map(y -> new HashSet<>(y)).collect(Collectors.toSet(HashSet::new))).collect(Collectors.toList(ArrayList::new));
|
||||
this.oderConstraintsField = oderConstraints; /*.stream().map(x -> {
|
||||
|
@@ -7,16 +7,7 @@ import de.dhbwstuttgart.syntaxtree.visual.ASTPrinter;
|
||||
import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter;
|
||||
import de.dhbwstuttgart.typedeployment.TypeInsert;
|
||||
import de.dhbwstuttgart.typedeployment.TypeInsertFactory;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Constraint;
|
||||
import de.dhbwstuttgart.typeinference.constraints.ConstraintSet;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
|
||||
import de.dhbwstuttgart.typeinference.unify.UnifyResultModel;
|
||||
import de.dhbwstuttgart.typeinference.unify.UnifyTaskModel;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.*;
|
||||
import org.apache.commons.io.output.NullWriter;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -33,71 +24,7 @@ import java.util.Set;
|
||||
public class UnifyTest {
|
||||
|
||||
public static final String rootDirectory = System.getProperty("user.dir")+"/resources/javFiles/";
|
||||
|
||||
private UnifyPair genPairListOfInteger(String name){
|
||||
|
||||
UnifyType type1 = new PlaceholderType(name);
|
||||
UnifyType type2 = new ReferenceType("List", new TypeParams(new ReferenceType("Integer")));
|
||||
UnifyPair pair1 = new UnifyPair(type2, type1, PairOperator.SMALLERDOT);
|
||||
|
||||
return pair1;
|
||||
}
|
||||
private UnifyPair genPairListOfString(String name){
|
||||
|
||||
PlaceholderType type1 = new PlaceholderType(name);
|
||||
UnifyType type2 = new ReferenceType("List", new TypeParams(new ReferenceType("String")));
|
||||
UnifyPair pair1 = new UnifyPair(type2, type1, PairOperator.SMALLERDOT);
|
||||
|
||||
return pair1;
|
||||
}
|
||||
@Test
|
||||
public void unifyTest(){
|
||||
UnifyType type1;
|
||||
UnifyType type2;
|
||||
|
||||
Set<UnifyPair> undConstraints = new HashSet<>();
|
||||
undConstraints.add(genPairListOfInteger("a"));
|
||||
undConstraints.add(genPairListOfString("a"));
|
||||
|
||||
undConstraints.add(genPairListOfInteger("b"));
|
||||
undConstraints.add(genPairListOfString("b"));
|
||||
undConstraints.add(genPairListOfInteger("c"));
|
||||
undConstraints.add(genPairListOfString("c"));
|
||||
undConstraints.add(genPairListOfInteger("d"));
|
||||
undConstraints.add(genPairListOfString("d"));
|
||||
undConstraints.add(genPairListOfInteger("e"));
|
||||
undConstraints.add(genPairListOfString("e"));
|
||||
undConstraints.add(genPairListOfInteger("e1"));
|
||||
undConstraints.add(genPairListOfString("e1"));
|
||||
undConstraints.add(genPairListOfInteger("e2"));
|
||||
undConstraints.add(genPairListOfString("e2"));
|
||||
undConstraints.add(genPairListOfInteger("e3"));
|
||||
undConstraints.add(genPairListOfString("e3"));
|
||||
|
||||
List<Set<Constraint<UnifyPair>>> oderConstraints = new ArrayList<>();
|
||||
|
||||
Set<UnifyPair> constraints = new HashSet<>();
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("List", new TypeParams(new PlaceholderType("X")));
|
||||
constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER));
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("Integer");
|
||||
constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER));
|
||||
type1 = new ReferenceType("Object");
|
||||
type2 = new ReferenceType("String");
|
||||
constraints.add(new UnifyPair(type2, type1, PairOperator.SMALLER));
|
||||
|
||||
IFiniteClosure finiteClosure = new FiniteClosure(constraints, new NullWriter());
|
||||
|
||||
TypeUnify unifyAlgo = new TypeUnify();
|
||||
ConstraintSet<Pair> cons = new ConstraintSet<>();
|
||||
UnifyResultModel urm = new UnifyResultModel(cons, finiteClosure);
|
||||
UnifyTaskModel tasks = new UnifyTaskModel();
|
||||
Set<Set<UnifyPair>> solution = unifyAlgo.unify(undConstraints, oderConstraints, finiteClosure, new NullWriter(), false, urm, tasks);
|
||||
System.out.println(solution.size());
|
||||
//System.out.println(solution);
|
||||
}
|
||||
/*
|
||||
/*
|
||||
@Test
|
||||
public void finiteClosure() throws IOException, ClassNotFoundException {
|
||||
execute(new File(rootDirectory+"fc.jav"));
|
||||
|
24
src/test/resources/log4jTesting.xml
Normal file
24
src/test/resources/log4jTesting.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
|
||||
<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||
|
||||
<appender name="CONSOLE" class="de.dhbwstuttgart.logger.ConsoleAppender">
|
||||
<param name="Target" value="System.out"/>
|
||||
|
||||
<layout class="de.dhbwstuttgart.logger.PatternLayout">
|
||||
<param name="ConversionPattern" value="%-15C{1} %-5p [%-9c] %m%n"/>
|
||||
</layout>
|
||||
</appender>
|
||||
|
||||
<logger name="trtest">
|
||||
<level value="DEBUG"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
<logger name="funcTest">
|
||||
<level value="DEBUG"/>
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
</logger>
|
||||
|
||||
</log4j:configuration>
|
BIN
src/test/resources/target/AA.class
Normal file
BIN
src/test/resources/target/AA.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Arithmetic.class
Normal file
BIN
src/test/resources/target/Arithmetic.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/ArithmeticConvert.class
Normal file
BIN
src/test/resources/target/ArithmeticConvert.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Conditional.class
Normal file
BIN
src/test/resources/target/Conditional.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Empty.class
Normal file
BIN
src/test/resources/target/Empty.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/For.class
Normal file
BIN
src/test/resources/target/For.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/GreaterEqual.class
Normal file
BIN
src/test/resources/target/GreaterEqual.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/GreaterThan.class
Normal file
BIN
src/test/resources/target/GreaterThan.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/HelloWorld.class
Normal file
BIN
src/test/resources/target/HelloWorld.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/IfStmt.class
Normal file
BIN
src/test/resources/target/IfStmt.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/LessEqual.class
Normal file
BIN
src/test/resources/target/LessEqual.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/LessThan.class
Normal file
BIN
src/test/resources/target/LessThan.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Matrix.class
Normal file
BIN
src/test/resources/target/Matrix.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/New.class
Normal file
BIN
src/test/resources/target/New.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/OL.class
Normal file
BIN
src/test/resources/target/OL.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/OLMain.class
Normal file
BIN
src/test/resources/target/OLMain.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Overloading.class
Normal file
BIN
src/test/resources/target/Overloading.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Overloading2.class
Normal file
BIN
src/test/resources/target/Overloading2.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Point.class
Normal file
BIN
src/test/resources/target/Point.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/PostIncDec.class
Normal file
BIN
src/test/resources/target/PostIncDec.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/PreInc.class
Normal file
BIN
src/test/resources/target/PreInc.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Put.class
Normal file
BIN
src/test/resources/target/Put.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Scalar.class
Normal file
BIN
src/test/resources/target/Scalar.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Sorting.class
Normal file
BIN
src/test/resources/target/Sorting.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/Unary.class
Normal file
BIN
src/test/resources/target/Unary.class
Normal file
Binary file not shown.
BIN
src/test/resources/target/While.class
Normal file
BIN
src/test/resources/target/While.class
Normal file
Binary file not shown.
Reference in New Issue
Block a user