modified: ../../../main/java/de/dhbwstuttgart/syntaxtree/factory/UnifyTypeFactory.java

modified:   ../../../main/java/de/dhbwstuttgart/typeinference/unify/model/PlaceholderType.java
	deleted:    ../javFiles/AddLong.jav
	deleted:    ../javFiles/EmptyClass.jav
	deleted:    ../javFiles/EmptyMethod.jav
	deleted:    ../javFiles/Expressions.jav
	deleted:    ../javFiles/FC_Matrix.jav
	deleted:    ../javFiles/Faculty.jav
	deleted:    ../javFiles/FacultyIf.jav
	deleted:    ../javFiles/FacultyTyped.jav
	deleted:    ../javFiles/Fields.jav
	deleted:    ../javFiles/Generics.jav
	deleted:    ../javFiles/IfTest.jav
	deleted:    ../javFiles/Import.jav
	deleted:    ../javFiles/Lambda.jav
	deleted:    ../javFiles/Lambda2.jav
	deleted:    ../javFiles/Lambda3.jav
	deleted:    ../javFiles/LambdaField.jav
	deleted:    ../javFiles/LambdaRunnable.jav
	deleted:    ../javFiles/ListenerOverload.jav
	deleted:    ../javFiles/Matrix.jav
	deleted:    ../javFiles/Meth_Gen.jav
	deleted:    ../javFiles/MethodCallGenerics.jav
	deleted:    ../javFiles/Methods.jav
	deleted:    ../javFiles/MethodsEasy.jav
	deleted:    ../javFiles/Op1.jav
	deleted:    ../javFiles/Package.jav
	deleted:    ../javFiles/Sorting.jav
	deleted:    ../javFiles/Subclass.jav
	deleted:    ../javFiles/Superclass.jav
	deleted:    ../javFiles/Vector.jav
	deleted:    ../javFiles/fc.jav
	deleted:    ../javFiles/mathStruc.jav
	deleted:    ../javFiles/test.jav
	deleted:    ../javFiles/test1.jav
This commit is contained in:
Martin Plümicke 2019-01-11 22:52:39 +01:00
parent c1e4f14fa4
commit 755fd5c821
35 changed files with 15 additions and 476 deletions

View File

@ -120,7 +120,7 @@ public class UnifyTypeFactory {
}
public static UnifyType convert(TypePlaceholder tph){
PlaceholderType ntph = new PlaceholderType(tph.getName());
PlaceholderType ntph = PlaceholderType.convertTypePlaceholder(tph.getName());//eingefuegt PL 2019-01-11 //new PlaceholderType(tph.getName());
int in = PLACEHOLDERS.indexOf(ntph);
if (in == -1) {
PLACEHOLDERS.add(ntph);

View File

@ -23,7 +23,7 @@ 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>();
public static final ArrayList<PlaceholderType> EXISTING_PLACEHOLDERS = new ArrayList<PlaceholderType>();
/**
* Prefix of auto-generated placeholder names.
@ -60,17 +60,28 @@ public final class PlaceholderType extends UnifyType{
*/
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
}
public static PlaceholderType convertTypePlaceholder(String name) {//eingefuegt PL 2019-01-11
PlaceholderType newTph = new PlaceholderType(name);
int i = EXISTING_PLACEHOLDERS.indexOf(newTph);//equals vergleicht den Namen
if (i == -1) {
EXISTING_PLACEHOLDERS.add(newTph); // Add to list of existing placeholder names
return newTph;
}
else {
return EXISTING_PLACEHOLDERS.get(i);
}
}
/**
* 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
EXISTING_PLACEHOLDERS.add(this); // Add to list of existing placeholder names
IsGenerated = isGenerated;
}

View File

@ -1,9 +0,0 @@
import java.lang.Integer;
import java.lang.Long;
public class AddLong{
Long add(Integer a, Long b) {
Long c = a+b;
return c;
}
}

View File

@ -1,3 +0,0 @@
public class EmptyClass{
}

View File

@ -1,37 +0,0 @@
public class EmptyMethod{
static String s1 ="";
String s2;
public void m1(){
//String s = "";
System.out.println("test");
//Integer ab = Math.abs(1);
//Math.abs(1);
//String lV = "local";
//s1 = "1";
//s1.concat("2");
s2 = s1;
//m2();
Clazz i = new Clazz();
Integer i = new Integer(1);
}
public void m2(){}
}
class Clazz{}
/*
public class EmptyMethod2{
public static test = "5";
public void m1(Integer i, String j, Boolean b){
//String s = "";
EmptyMethod em = new EmptyMethod();
em.m1();
em.s1 = "";
//Integer ab = Math.abs(1);
//Math.abs(1);
//String lV = "local";
//s1 = "1";
//s1.concat("2");
//s2 = s1;
}
}*/

View File

@ -1,8 +0,0 @@
class Expressions{
void test(){
var x = 2;
x = x + 2;
}
}

View File

@ -1,10 +0,0 @@
import java.util.Vector;
class Matrix extends Vector<Vector<Integer>> {
methode(m) {
m.add(1);
Matrix i;
methode(i);
}
}

View File

@ -1,15 +0,0 @@
import java.lang.Integer;
class Faculty {
Integer mul(Integer x, Integer y) {
return x;
}
m () {
var fact = (Integer x) -> {
return mul(x, fact.apply(x));
};
return fact;
}
}

View File

@ -1,17 +0,0 @@
import java.lang.Integer;
class Faculty {
m () {
var fact = (Integer x) -> {
if (x == 1) {
return x;
}
else {
return x * (fact.apply(x-1));
}
};
return fact;
}
}

View File

@ -1,19 +0,0 @@
import java.lang.Integer;
class Faculty {
Integer mul(Integer x, Integer y) {
return x;
}
Fun1<java.lang.Integer,java.lang.Integer> m () {
var fact = (Integer x) -> {
return mul(x, fact.apply(x));
};
return fact;
}
}
interface Fun1<A,B>{
B apply(A a);
}

View File

@ -1,11 +0,0 @@
import java.lang.String;
class Fields{
test2 = "test";
test;
m(){
var test3;
return test;
}
}

View File

@ -1,22 +0,0 @@
import java.lang.String;
class Generics<B> {
//<A extends B> A mt1(A a, B b){
B mt1(B a, B b){
return mt1(a, a);
}
}
class Test {
methode(String s){
return new Generics<String>().mt1(s,s);
}
}
/*
Problem:
auto test = new List<String>();
auto test2 = new List<Integer>();
... //code, welcher möglicherweise test und test2 vertauscht
test.add("hallo");
*/

View File

@ -1,14 +0,0 @@
import java.lang.Integer;
import java.lang.Boolean;
import java.lang.Object;
public class IfTest{
Object m1(b) {
Integer i;
if(b) {
return i;
}else{
return b;
}
}
}

View File

@ -1,8 +0,0 @@
import java.util.Vector;
class Import {
void methode(){
Vector v;
v.add(v);
}
}

View File

@ -1,13 +0,0 @@
class Apply { }
public class Lambda {
m () {
var lam1 = (x) -> {
return x;
};
return lam1.apply(new Apply());
}
}

View File

@ -1,33 +0,0 @@
import java.lang.String;
public class Lambda2
{
public static void main(List<String> args){
var listOfStrings = new List<String>();
var listOfObjects;
listOfObjects = map(listOfStrings, (a) -> a);
}
public map(a , b){
b.apply(a);
return a;
}
/*
public static <I,O> List<O> map(List<I> input, Function<I,O> func) {
List<O> output;
output = new List<O>();
output.add(func.apply(input.get()));
return output;
}
*/
}
class List<A>{
A get();
void add(A);
}
class Function<A,B>{
B apply(A a);
}

View File

@ -1,24 +0,0 @@
import java.lang.String;
public class Lambda2
{
/*
public static <A> List<A> map(List<? extends A> input,
Function<? super A, ? extends A> func){
input.add(func.apply(input.get()));
}
*/
public map(input,func){
input.add(func.apply(input.get()));
return map(new List<String>(), func);
}
}
class List<A>{
A get();
void add(A);
}
class Function<A,B>{
B apply(A a);
}

View File

@ -1,6 +0,0 @@
public class LambdaField {
f = x -> x;
}

View File

@ -1,14 +0,0 @@
import java.lang.Runnable;
import java.lang.String;
import java.lang.System;
public class LamRunnable{
public LamRunnable(){
Runnable lam = () -> {System.out.println("lambda");};
lam.run();
}
}

View File

@ -1,20 +0,0 @@
import java.lang.Integer;
import java.lang.String;
class ListenerOverload{
call(p){
call(p.left);
call(p.right);
}
call(Integer i){}
call(String s){}
}
class Pair<A,B>{
A left;
B right;
}

View File

@ -1,28 +0,0 @@
import java.util.Vector;
import java.lang.Integer;
class Matrix extends Vector<Vector<Integer>> {
Integer mul1(Integer x, Integer y) { return x;}
Integer add1(Integer x, Integer y) { return x;}
mul(m) {
var ret = new Matrix();
var i = 0;
while(i < size()) {
var v1 = this.elementAt(i);
var v2 = new Vector<Integer>();
var j = 0;
while(j < v1.size()) {
var erg = 0;
var k = 0;
while(k < v1.size()) {
erg = erg + v1.elementAt(k) * m.elementAt(k).elementAt(j);
//erg = add1(erg, mul1(v1.elementAt(k),
// m.elementAt(k).elementAt(j)));
k++; }
v2.addElement(new Integer(erg));
j++; }
ret.addElement(v2);
i++; }
return ret;
}
}

View File

@ -1,11 +0,0 @@
class Meth_Gen {
m1(x, y) {
m2(x);
x = y;
}
m2(y) {
m1(y, y);
}
}

View File

@ -1,14 +0,0 @@
import java.lang.String;
class Generics<B> {
//<A extends B> A mt1(A a, B b){
B mt1(B a, B b){
return mt1(a, a);
}
}
class Test {
methode(String s){
return new Generics<String>().mt1(s,s);
}
}

View File

@ -1,17 +0,0 @@
class Methods {
mt4(a,b,c) { return a.add(b).sub(c) ; }
mt1(a) {return a;}
mt2(a) {return a.f; }
mt3(a) {return a.add(); }
}
class Test {
java.lang.Object f;
add(){}
add(b){return b;}
sub(b){}
}

View File

@ -1,7 +0,0 @@
class Methods {
mt4(a,b,c) { return a.mt3(b).mt3(c) ; }
mt3(a) {return a.mt3(a); }
}

View File

@ -1,11 +0,0 @@
public class Op1{
public Op1() {
Runnable lam = () -> {
String test = "";
String b = "b";
test = b;
System.out.println(test);};
//lam.run();
}
}

View File

@ -1,5 +0,0 @@
package strucType.input;
class Neu
{
}

View File

@ -1,8 +0,0 @@
import java.util.List;
import java.util.Collection;
class Sorting{
void merge(a, b){
a.addAll(b);
}
}

View File

@ -1,6 +0,0 @@
public class Subclass extends Superclass {
public void printMethod() {
super.printMethod();
}
}

View File

@ -1,6 +0,0 @@
public class Superclass {
public void printMethod() {
System.out.println("Printed in Superclass.");
}
}

View File

@ -1,23 +0,0 @@
import java.util.ArrayList;
import java.util.Vector;
import java.lang.Object;
class MyVector{
id(x){
Object i;
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
x.add(i);
return x;
}
}

View File

@ -1,18 +0,0 @@
import java.util.List;
class Test{
methode(param1, param2, param3) {
param2.add(param3);
return param1.meth(param2);
}
}
interface Klasse1{
Klasse1 meth(List p);
Klasse1 meth(Klasse2 p);
}
interface Klasse2{
Klasse1 meth(Klasse1 p);
Klasse2 meth(Klasse2 p);
}

View File

@ -1,13 +0,0 @@
class mathStruc<A> {
mathStruc(A a) { }
A model(){ A a; return a; }
methode(){
var innerOp = o -> ms ->
new mathStruc<A>(o.apply(this.model(),ms.model()));
return innerOp;
}
}

View File

@ -1,15 +0,0 @@
class Test{
methode(param1, param2, param3) {
return param1.meth(param2.meth(param3));
}
}
interface Klasse1{
Klasse1 meth(Klasse1 p);
Klasse1 meth(Klasse2 p);
}
interface Klasse2{
Klasse1 meth(Klasse1 p);
Klasse2 meth(Klasse2 p);
}

View File

@ -1,7 +0,0 @@
class Faculty {
int a;
m (int x) {
return a+x;
}
}