Cloner durch Unify.deepClone in UndMenge.java ersetzt

This commit is contained in:
Martin Plümicke 2015-07-16 01:16:06 +02:00
parent 3601d11b0b
commit fbc1bc5b5b
2 changed files with 6 additions and 5 deletions

View File

@ -1,18 +1,19 @@
package de.dhbwstuttgart.typeinference;
import de.dhbwstuttgart.typeinference.unify.Unify;
import java.util.Collection;
import java.util.Iterator;
import com.rits.cloning.Cloner;
//import com.rits.cloning.Cloner;
public abstract class UndMenge<A> implements KomplexeMenge<A>{
public abstract class UndMenge<A extends DeepCloneable> implements KomplexeMenge<A>{
public abstract Menge<? extends KomplexeMenge<A>> getSet();
@Override
public Menge<Menge<A>> cartesianProduct() {
Menge<Menge<A>> ret = null;
Cloner cloner = new Cloner();
//Cloner cloner = new Cloner();
for(KomplexeMenge<A> km : this.getSet()){
if(ret == null){
ret = km.cartesianProduct();
@ -20,7 +21,7 @@ public abstract class UndMenge<A> implements KomplexeMenge<A>{
Menge<Menge<A>> cartesianProduct = new Menge<>();
for(Menge<A> r : ret)for(Menge<A> m : km.cartesianProduct()){ //¼r jedes Element aus dem Karthesischen Produkt:
Menge<A> undElement = new Menge<A>();
undElement.addAll(cloner.deepClone(r));
undElement.addAll(Unify.deepClone(r));
undElement.addAll(m);
cartesianProduct.add(undElement);
}

View File

@ -3648,7 +3648,7 @@ tempKlasse.get_Superclass_Name() ); System.out.println( "P. S.:
return T instanceof FreshWildcardType;
}
private static <A extends DeepCloneable> Menge<A> deepClone(Menge<A> m){
public static <A extends DeepCloneable> Menge<A> deepClone(Menge<A> m){
Menge<A> ret = m.stream().<A>map((Function<A,A>)(x -> x.deepClone())).<Menge<A>>collect(Menge::new, Menge::add, Menge::addAll);