ConstraintsSet überarbeitet
This commit is contained in:
parent
6bb01f012f
commit
356a229573
33
src/de/dhbwstuttgart/typeinference/EinzelElement.java
Normal file
33
src/de/dhbwstuttgart/typeinference/EinzelElement.java
Normal file
@ -0,0 +1,33 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import com.rits.cloning.Cloner;
|
||||
|
||||
public class EinzelElement<A> implements KomplexeMenge<A>{
|
||||
private A item;
|
||||
|
||||
public EinzelElement(A element){
|
||||
item = element;
|
||||
}
|
||||
|
||||
public Menge<KomplexeMenge<A>> getSet(){
|
||||
Menge<KomplexeMenge<A>> ret = new Menge<>();
|
||||
ret.add(this);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menge<Menge<A>> cartesianProduct() {
|
||||
Cloner cloner = new Cloner();
|
||||
Menge<Menge<A>> ret = new Menge<>();
|
||||
Menge<A> i = new Menge<A>();
|
||||
i.add(cloner.deepClone(item));
|
||||
ret.add(i);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return item.toString();
|
||||
}
|
||||
|
||||
}
|
6
src/de/dhbwstuttgart/typeinference/KomplexeMenge.java
Normal file
6
src/de/dhbwstuttgart/typeinference/KomplexeMenge.java
Normal file
@ -0,0 +1,6 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
public interface KomplexeMenge<A>{
|
||||
Menge<? extends KomplexeMenge<A>> getSet();
|
||||
Menge<Menge<A>> cartesianProduct();
|
||||
}
|
11
test/plugindevelopment/TypeInsertTests/LambdaTest28.jav
Normal file
11
test/plugindevelopment/TypeInsertTests/LambdaTest28.jav
Normal file
@ -0,0 +1,11 @@
|
||||
class Klasse{
|
||||
main(param){
|
||||
return param.methode();
|
||||
}
|
||||
}
|
||||
|
||||
class Klasse1{
|
||||
<A> A methode(){
|
||||
return null;
|
||||
}
|
||||
}
|
18
test/plugindevelopment/TypeInsertTests/LambdaTest28.java
Normal file
18
test/plugindevelopment/TypeInsertTests/LambdaTest28.java
Normal file
@ -0,0 +1,18 @@
|
||||
package plugindevelopment.TypeInsertTests;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class LambdaTest28 {
|
||||
|
||||
private static final String TEST_FILE = "LambdaTest28.jav";
|
||||
|
||||
@Test
|
||||
public void run(){
|
||||
Menge<String> mustContain = new Menge<String>();
|
||||
//mustContain.add("A a");
|
||||
MultipleTypesInsertTester.test(this.TEST_FILE, mustContain);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user