Cloner durch Unify.deepClone in UndMenge.java ersetzt
This commit is contained in:
parent
3601d11b0b
commit
fbc1bc5b5b
@ -1,18 +1,19 @@
|
|||||||
package de.dhbwstuttgart.typeinference;
|
package de.dhbwstuttgart.typeinference;
|
||||||
|
|
||||||
|
import de.dhbwstuttgart.typeinference.unify.Unify;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
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();
|
public abstract Menge<? extends KomplexeMenge<A>> getSet();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Menge<Menge<A>> cartesianProduct() {
|
public Menge<Menge<A>> cartesianProduct() {
|
||||||
Menge<Menge<A>> ret = null;
|
Menge<Menge<A>> ret = null;
|
||||||
Cloner cloner = new Cloner();
|
//Cloner cloner = new Cloner();
|
||||||
for(KomplexeMenge<A> km : this.getSet()){
|
for(KomplexeMenge<A> km : this.getSet()){
|
||||||
if(ret == null){
|
if(ret == null){
|
||||||
ret = km.cartesianProduct();
|
ret = km.cartesianProduct();
|
||||||
@ -20,7 +21,7 @@ public abstract class UndMenge<A> implements KomplexeMenge<A>{
|
|||||||
Menge<Menge<A>> cartesianProduct = new Menge<>();
|
Menge<Menge<A>> cartesianProduct = new Menge<>();
|
||||||
for(Menge<A> r : ret)for(Menge<A> m : km.cartesianProduct()){ //Für jedes Element aus dem Karthesischen Produkt:
|
for(Menge<A> r : ret)for(Menge<A> m : km.cartesianProduct()){ //Für jedes Element aus dem Karthesischen Produkt:
|
||||||
Menge<A> undElement = new Menge<A>();
|
Menge<A> undElement = new Menge<A>();
|
||||||
undElement.addAll(cloner.deepClone(r));
|
undElement.addAll(Unify.deepClone(r));
|
||||||
undElement.addAll(m);
|
undElement.addAll(m);
|
||||||
cartesianProduct.add(undElement);
|
cartesianProduct.add(undElement);
|
||||||
}
|
}
|
||||||
|
@ -3648,7 +3648,7 @@ tempKlasse.get_Superclass_Name() ); System.out.println( "P. S.:
|
|||||||
return T instanceof FreshWildcardType;
|
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);
|
Menge<A> ret = m.stream().<A>map((Function<A,A>)(x -> x.deepClone())).<Menge<A>>collect(Menge::new, Menge::add, Menge::addAll);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user