ConstraintPair erbt von Pair
This commit is contained in:
parent
15e9fb44b8
commit
e6606d08ee
@ -1,15 +1,9 @@
|
|||||||
package de.dhbwstuttgart.typeinference;
|
package de.dhbwstuttgart.typeinference;
|
||||||
|
|
||||||
public class ConstraintPair {
|
public class ConstraintPair extends Pair{
|
||||||
|
|
||||||
private Pair p;
|
|
||||||
|
|
||||||
public ConstraintPair(ConstraintType t1, ConstraintType t2){
|
public ConstraintPair(ConstraintType t1, ConstraintType t2){
|
||||||
p = new Pair(t1.getType(), t2.getType());
|
super(t1.getType(), t2.getType());
|
||||||
}
|
|
||||||
|
|
||||||
public Pair getPair(){
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import de.dhbwstuttgart.logger.Logger;
|
|||||||
import de.dhbwstuttgart.logger.*;
|
import de.dhbwstuttgart.logger.*;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||||
|
|
||||||
public class ConstraintsSet implements Iterable<OderConstraint>{
|
public class ConstraintsSet extends UndMenge<Pair> implements Iterable<OderConstraint>{
|
||||||
private static final Logger log = Logger.getLogger(ConstraintsSet.class.getName());
|
private static final Logger log = Logger.getLogger(ConstraintsSet.class.getName());
|
||||||
private Menge<OderConstraint> constraintsSet;
|
private Menge<OderConstraint> constraintsSet;
|
||||||
|
|
||||||
@ -21,19 +21,6 @@ public class ConstraintsSet implements Iterable<OderConstraint>{
|
|||||||
public void add(OderConstraint constraint){
|
public void add(OderConstraint constraint){
|
||||||
constraintsSet.add(constraint);
|
constraintsSet.add(constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Liefert alle Constraint-Variationen
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public Vector<Vector<UndConstraint>> getConstraints(){
|
|
||||||
Vector<Vector<UndConstraint>> ret = new Vector<Vector<UndConstraint>>();
|
|
||||||
for(OderConstraint con : constraintsSet){
|
|
||||||
ret.add(con.getUndConstraints());
|
|
||||||
}
|
|
||||||
ret = new KarthesischesProdukt<UndConstraint>().berechneKarthesischesProdukt(ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
@ -66,12 +53,12 @@ public class ConstraintsSet implements Iterable<OderConstraint>{
|
|||||||
}
|
}
|
||||||
this.filterWrongConstraints(
|
this.filterWrongConstraints(
|
||||||
(pairs)->{
|
(pairs)->{
|
||||||
Vector<Pair> undConstraintsUndPairs = new Vector<>();
|
Menge<Pair> undConstraintsUndPairs = new Menge<>();
|
||||||
undConstraintsUndPairs.addAll(pairs);
|
undConstraintsUndPairs.addAll(pairs);
|
||||||
undConstraintsUndPairs.addAll(alleUndConstraints);
|
undConstraintsUndPairs.addAll(alleUndConstraints);
|
||||||
log.debug("Versuche Pairs auszusondern:\n"+pairs, Section.TYPEINFERENCE);
|
log.debug("Versuche Pairs auszusondern:\n"+pairs, Section.TYPEINFERENCE);
|
||||||
log.debug("Unifiziere:\n"+undConstraintsUndPairs, Section.TYPEINFERENCE);
|
log.debug("Unifiziere:\n"+undConstraintsUndPairs, Section.TYPEINFERENCE);
|
||||||
Vector<Vector<Pair>> unifyResult = unifier.apply(undConstraintsUndPairs);
|
Menge<Menge<Pair>> unifyResult = unifier.apply(undConstraintsUndPairs);
|
||||||
return unifyResult;
|
return unifyResult;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -89,4 +76,15 @@ public class ConstraintsSet implements Iterable<OderConstraint>{
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(UndConstraint singleConstraint) {
|
||||||
|
OderConstraint toAdd = new OderConstraint();
|
||||||
|
toAdd.addConstraint(singleConstraint);
|
||||||
|
constraintsSet.add(toAdd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Menge<? extends KomplexeMenge<Pair>> getSet() {
|
||||||
|
return this.constraintsSet;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import de.dhbwstuttgart.syntaxtree.type.Type;
|
|||||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||||
|
|
||||||
public class OderConstraint{
|
public class OderConstraint extends OderMenge<Pair>{
|
||||||
private Menge<UndConstraint> oderConstraintPairs;
|
private Menge<UndConstraint> oderConstraintPairs;
|
||||||
|
|
||||||
private final static Logger logger = Logger.getLogger(OderConstraint.class.getName());
|
private final static Logger logger = Logger.getLogger(OderConstraint.class.getName());
|
||||||
@ -35,8 +35,8 @@ public class OderConstraint{
|
|||||||
* Liefert alle in diesem OderConstraint enthaltene Constraints. Dabei gehen die Verkn<EFBFBD>pfungen (Oder/Und) verloren.
|
* Liefert alle in diesem OderConstraint enthaltene Constraints. Dabei gehen die Verkn<EFBFBD>pfungen (Oder/Und) verloren.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector<Pair> getConstraintPairs(){
|
public Menge<Pair> getConstraintPairs(){
|
||||||
Vector<Pair> ret = new Vector<Pair>();
|
Menge<Pair> ret = new Menge<Pair>();
|
||||||
for(UndConstraint oC : this.oderConstraintPairs){
|
for(UndConstraint oC : this.oderConstraintPairs){
|
||||||
ret.addAll(oC.getConstraintPairs());
|
ret.addAll(oC.getConstraintPairs());
|
||||||
}
|
}
|
||||||
@ -85,9 +85,9 @@ public class OderConstraint{
|
|||||||
}
|
}
|
||||||
|
|
||||||
void filterWrongConstraints(Unifier unifier) {
|
void filterWrongConstraints(Unifier unifier) {
|
||||||
Vector<UndConstraint> filteredConstraints = new Vector<>();
|
Menge<UndConstraint> filteredConstraints = new Menge<>();
|
||||||
for(UndConstraint cons : this.getUndConstraints()){
|
for(UndConstraint cons : this.getUndConstraints()){
|
||||||
Vector<Vector<Pair>> unifierResult = unifier.apply(cons.getConstraintPairs());
|
Menge<Menge<Pair>> unifierResult = unifier.apply(cons.getConstraintPairs());
|
||||||
if(!unifierResult.isEmpty()){
|
if(!unifierResult.isEmpty()){
|
||||||
filteredConstraints.add(cons);
|
filteredConstraints.add(cons);
|
||||||
}else{
|
}else{
|
||||||
@ -103,5 +103,11 @@ public class OderConstraint{
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Menge<? extends KomplexeMenge<Pair>> getSet() {
|
||||||
|
return this.oderConstraintPairs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,83 +18,32 @@ import de.dhbwstuttgart.typeinference.unify.Unifier;
|
|||||||
* Item
|
* Item
|
||||||
*/
|
*/
|
||||||
|
|
||||||
interface Mapper<A,B>{
|
|
||||||
B applyOrSet(OderMenge<A> i);
|
|
||||||
B applyAndSet(UndMenge<A> i);
|
|
||||||
B applySingle(EinzelElement<A> i);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KomplexeMenge<A>{
|
interface KomplexeMenge<A>{
|
||||||
void addItems(KomplexeMenge<A> item);
|
Menge<? extends KomplexeMenge<A>> getSet();
|
||||||
void addItem(A item);
|
|
||||||
Menge<Menge<A>> cartesianProduct();
|
Menge<Menge<A>> cartesianProduct();
|
||||||
<B> KomplexeMenge<B> map(Mapper<A,B> m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class OderMenge<A> implements KomplexeMenge<A>{
|
public abstract class OderMenge<A> implements KomplexeMenge<A>{
|
||||||
Menge<KomplexeMenge<A>> set = new Menge<>();
|
|
||||||
|
public abstract Menge<? extends KomplexeMenge<A>> getSet();
|
||||||
@Override
|
|
||||||
public void addItems(KomplexeMenge<A> item) {
|
|
||||||
set.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public Menge<A> getItems(){
|
|
||||||
Menge<A> ret = new Menge<>();
|
|
||||||
for(KomplexeMenge<A> i : set){
|
|
||||||
ret.addAll(i.getItems());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addItem(A item) {
|
|
||||||
set.add(new EinzelElement<A>(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Menge<Menge<A>> cartesianProduct() {
|
public Menge<Menge<A>> cartesianProduct() {
|
||||||
Menge<Menge<A>> ret = new Menge<>();
|
Menge<Menge<A>> ret = new Menge<>();
|
||||||
for(KomplexeMenge<A> km : this.set){
|
for(KomplexeMenge<A> km : this.getSet()){
|
||||||
ret.addAll(km.cartesianProduct());
|
ret.addAll(km.cartesianProduct());
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public Menge<OderMenge<A>> getOrSets() {
|
|
||||||
Menge<OderMenge<A>> ret = new Menge<>();
|
|
||||||
ret.add(this);
|
|
||||||
//for(KomplexeMenge<A> i : set){
|
|
||||||
// ret.addAll(i.getOrSets());
|
|
||||||
//}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Menge<UndMenge<A>> getAndSets() {
|
|
||||||
Menge<UndMenge<A>> ret = new Menge<>();
|
|
||||||
for(KomplexeMenge<A> i : set){
|
|
||||||
ret.addAll(i.getAndSets());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
String ret = "[";
|
String ret = "[";
|
||||||
for(KomplexeMenge<A> i : set){
|
for(KomplexeMenge<A> i : this.getSet()){
|
||||||
ret += i.toString() + " | ";
|
ret += i.toString() + " | ";
|
||||||
}
|
}
|
||||||
return ret + "]";
|
return ret + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public <B> KomplexeMenge<B> map(Mapper<A, B> m) {
|
|
||||||
return m.applyOrSet(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SingleConstraint extends UndConstraint{
|
public class SingleConstraint extends UndConstraint{
|
||||||
|
|
||||||
private Pair constraintPair; //entspricht θ condition θ'
|
private Pair constraintPair; //entspricht θ condition θ'
|
||||||
//private R condition; //entspricht der condition (R)
|
//private R condition; //entspricht der condition (R)
|
||||||
|
|
||||||
@ -39,8 +40,8 @@ public class SingleConstraint extends UndConstraint{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override //Methode überschreiben, damit immer nur ein Vector mit nur einem Element zurückgeliefert wird.
|
@Override //Methode überschreiben, damit immer nur ein Vector mit nur einem Element zurückgeliefert wird.
|
||||||
public Vector<Pair> getConstraintPairs(){
|
public Menge<Pair> getConstraintPairs(){
|
||||||
Vector<Pair> ret = new Vector<Pair>();
|
Menge<Pair> ret = new Menge<Pair>();
|
||||||
ret.add(constraintPair);
|
ret.add(constraintPair);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -48,28 +49,9 @@ public class SingleConstraint extends UndConstraint{
|
|||||||
public void addConstraint(ConstraintPair toAdd){
|
public void addConstraint(ConstraintPair toAdd){
|
||||||
if(constraintPair != null)throw new DebugException("Ein Constraint darf nur aus einem ConstraintPair bestehen. Das hinzufügen von "+ toAdd + " ist nicht möglich.");
|
if(constraintPair != null)throw new DebugException("Ein Constraint darf nur aus einem ConstraintPair bestehen. Das hinzufügen von "+ toAdd + " ist nicht möglich.");
|
||||||
|
|
||||||
Type p1 = toAdd.getPair().TA1;
|
Type p1 = toAdd.TA1;
|
||||||
Type p2 = toAdd.getPair().TA2;
|
Type p2 = toAdd.TA2;
|
||||||
if(p1==null || p2 == null)throw new NullPointerException();
|
if(p1==null || p2 == null)throw new NullPointerException();
|
||||||
|
|
||||||
|
|
||||||
//Hier werden die GTVs zu TPH gewandelt.
|
|
||||||
//if(p1 instanceof RefType)((RefType)p1).GTV2TPH();
|
|
||||||
//if(p2 instanceof RefType)((RefType)p2).GTV2TPH();
|
|
||||||
|
|
||||||
//if((p1 instanceof GenericTypeVar))p1 = ((GenericTypeVar)p1).getTypePlaceHolder();//throw new DebugException("GenericTypeVar sind in den Constraints nicht erlaubt");//
|
|
||||||
//if((p2 instanceof GenericTypeVar))p2 = ((GenericTypeVar)p2).getTypePlaceHolder();//throw new DebugException("GenericTypeVar sind in den Constraints nicht erlaubt");//
|
|
||||||
|
|
||||||
// BaseTypes werden in RefTypes umgewandelt. Constraints dürfen nur RefTypes oder TypePlaceholder enthalten, da sonst der Unify-Algorithmus nicht funktioniert.
|
|
||||||
//if(!(p1 instanceof RefType) && !(p1 instanceof TypePlaceholder) && !(p1 instanceof GenericTypeVar))p1 = new RefType(p1);
|
|
||||||
//if(!(p2 instanceof RefType) && !(p2 instanceof TypePlaceholder) && !(p2 instanceof GenericTypeVar))p2 = new RefType(p2);
|
|
||||||
|
|
||||||
//if(!(TypePlaceholder.class.isInstance(p1)) || !(RefType.class.isInstance(p1)) || !(TypePlaceholder.class.isInstance(p2)) || !(RefType.class.isInstance(p2)))
|
|
||||||
//{//Wenn die beiden übergebenen Typen weder RefTypes noch TypePlaceholder sind:
|
|
||||||
// throw new TypinferenzException("Ein Constraint darf nur aus TypePlaceholdern und Reftypes bestehen");
|
|
||||||
//}
|
|
||||||
//if(!(p1 instanceof RefType) && !(p1 instanceof TypePlaceholder))throw new DebugException("Fehler: "+p2+" kann nicht in TPH oder RefType umgewandelt werden");
|
|
||||||
//if(!(p2 instanceof RefType) && !(p2 instanceof TypePlaceholder))throw new DebugException("Fehler: "+p2+" kann nicht in TPH oder RefType umgewandelt werden");
|
|
||||||
|
|
||||||
constraintPair = new Pair(p1,p2);
|
constraintPair = new Pair(p1,p2);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
package de.dhbwstuttgart.typeinference;
|
package de.dhbwstuttgart.typeinference;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||||
|
import de.dhbwstuttgart.typeinference.exceptions.DebugException;
|
||||||
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -10,14 +12,32 @@ import de.dhbwstuttgart.typeinference.unify.Unifier;
|
|||||||
* @author janulrich
|
* @author janulrich
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class UndConstraint extends OderConstraint {
|
public class UndConstraint extends UndMenge<Pair> {
|
||||||
|
|
||||||
public UndConstraint(ConstraintType p1, ConstraintType p2) {
|
Menge<EinzelElement<Pair>> set = new Menge<>();
|
||||||
super(p1, p2);
|
|
||||||
|
@Override
|
||||||
|
public Menge<? extends KomplexeMenge<Pair>> getSet() {
|
||||||
|
return set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UndConstraint() {
|
public Menge<Pair> getConstraintPairs() {
|
||||||
super();
|
Menge<Menge<Pair>> ret = this.cartesianProduct();
|
||||||
|
if(ret.size() != 1){
|
||||||
|
//UndConstraints enthalten nur SingleConstraints, wodurch das Karthesische Produkt nur aus einem Element bestehen kann.
|
||||||
|
throw new DebugException("Fehler in ConstraintPairs-Bildung");
|
||||||
|
}
|
||||||
|
return ret.firstElement();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addConstraint(ConstraintType type, ConstraintType rT) {
|
||||||
|
Pair p = new ConstraintPair(type, rT);
|
||||||
|
this.set.add(new EinzelElement<Pair>(p));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
public UndConstraint(ConstraintType p1, ConstraintType p2) {
|
||||||
|
super(p1, p2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -47,4 +67,5 @@ public class UndConstraint extends OderConstraint {
|
|||||||
UndConstraint filterUndConstraints(){
|
UndConstraint filterUndConstraints(){
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -5,33 +5,15 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import com.rits.cloning.Cloner;
|
import com.rits.cloning.Cloner;
|
||||||
|
|
||||||
public class UndMenge<A> implements KomplexeMenge<A>{
|
public abstract class UndMenge<A> implements KomplexeMenge<A>{
|
||||||
Menge<KomplexeMenge<A>> set = new Menge<>();
|
|
||||||
|
public abstract Menge<? extends KomplexeMenge<A>> getSet();
|
||||||
@Override
|
|
||||||
public void addItems(KomplexeMenge<A> item) {
|
|
||||||
set.add(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addItem(A item){
|
|
||||||
set.add(new EinzelElement<A>(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
public Menge<A> getItems(){
|
|
||||||
Menge<A> ret = new Menge<>();
|
|
||||||
for(KomplexeMenge<A> i : set){
|
|
||||||
ret.addAll(i.getItems());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@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.set){
|
for(KomplexeMenge<A> km : this.getSet()){
|
||||||
if(ret == null){
|
if(ret == null){
|
||||||
ret = km.cartesianProduct();
|
ret = km.cartesianProduct();
|
||||||
}else{
|
}else{
|
||||||
@ -49,29 +31,9 @@ public class UndMenge<A> implements KomplexeMenge<A>{
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public Menge<OderMenge<A>> getOrSets() {
|
|
||||||
Menge<OderMenge<A>> ret = new Menge<>();
|
|
||||||
for(KomplexeMenge<A> i : set){
|
|
||||||
ret.addAll(i.getOrSets());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Menge<UndMenge<A>> getAndSets() {
|
|
||||||
Menge<UndMenge<A>> ret = new Menge<>();
|
|
||||||
ret.add(this);
|
|
||||||
//for(KomplexeMenge<A> i : set){
|
|
||||||
// ret.addAll(i.getAndSets());
|
|
||||||
//}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
public String toString(){
|
public String toString(){
|
||||||
String ret = "[";
|
String ret = "[";
|
||||||
for(KomplexeMenge<A> item : set){
|
for(KomplexeMenge<A> item : this.getSet()){
|
||||||
ret += item.toString() + " , ";
|
ret += item.toString() + " , ";
|
||||||
}
|
}
|
||||||
return ret + "]";
|
return ret + "]";
|
||||||
@ -85,25 +47,12 @@ class EinzelElement<A> implements KomplexeMenge<A>{
|
|||||||
public EinzelElement(A element){
|
public EinzelElement(A element){
|
||||||
item = element;
|
item = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addItems(KomplexeMenge<A> item) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
public Menge<KomplexeMenge<A>> getSet(){
|
||||||
@Override
|
Menge<KomplexeMenge<A>> ret = new Menge<>();
|
||||||
public Menge<A> getItems() {
|
ret.add(this);
|
||||||
Menge<A> ret = new Menge<>();
|
|
||||||
ret.add(item);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addItem(A item) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Menge<Menge<A>> cartesianProduct() {
|
public Menge<Menge<A>> cartesianProduct() {
|
||||||
@ -115,20 +64,6 @@ class EinzelElement<A> implements KomplexeMenge<A>{
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Override
|
|
||||||
public Menge<OderMenge<A>> getOrSets() {
|
|
||||||
Menge<OderMenge<A>> ret = new Menge<>();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Menge<UndMenge<A>> getAndSets() {
|
|
||||||
Menge<UndMenge<A>> ret = new Menge<>();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return item.toString();
|
return item.toString();
|
||||||
|
@ -630,6 +630,8 @@ public class Unify
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Schritt 4, Teil 2: Kartesisches Produkt bilden.
|
//Schritt 4, Teil 2: Kartesisches Produkt bilden.
|
||||||
|
|
||||||
|
/*
|
||||||
//TODO: Vor der Bildung des Karthesischen Produkts unmögliche Kombinationen ausfiltern
|
//TODO: Vor der Bildung des Karthesischen Produkts unmögliche Kombinationen ausfiltern
|
||||||
//cartProduktSets kontrollieren:
|
//cartProduktSets kontrollieren:
|
||||||
ConstraintsSet cSet = new ConstraintsSet();
|
ConstraintsSet cSet = new ConstraintsSet();
|
||||||
@ -661,22 +663,12 @@ public class Unify
|
|||||||
cSet.filterWrongConstraints(filterUnify);
|
cSet.filterWrongConstraints(filterUnify);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
for (Menge<Menge<Pair>> vecvecpair : cartProduktSets){
|
|
||||||
OderConstraint orConstraints = new OderConstraint();
|
|
||||||
for(Menge<Pair> pairs : vecvecpair){
|
|
||||||
UndConstraint uCons = new UndConstraint();
|
|
||||||
for(Pair p : pairs){
|
|
||||||
uCons.addConstraint(new ConstraintPair(p.TA1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Menge<Menge<Pair>> bigCartProductErg = cSet.cartesianProduct();
|
Menge<Menge<Pair>> bigCartProductErg = cSet.cartesianProduct();
|
||||||
if(filter)log.debug("Karthesisches Produkt nach Filterung: "+bigCartProductErg);
|
if(filter)log.debug("Karthesisches Produkt nach Filterung: "+bigCartProductErg);
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
///*
|
||||||
//Hier wird aus den in Schritt 4, Teil 1 erzeugten Vektoren das Kartesische Produkt gebildet.
|
//Hier wird aus den in Schritt 4, Teil 1 erzeugten Vektoren das Kartesische Produkt gebildet.
|
||||||
Menge<Pair> helpvp;
|
Menge<Pair> helpvp;
|
||||||
Menge<Menge<Pair>> bigCartProductErg = new Menge<Menge<Pair>>();
|
Menge<Menge<Pair>> bigCartProductErg = new Menge<Menge<Pair>>();
|
||||||
@ -696,7 +688,7 @@ public class Unify
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
//*/
|
||||||
|
|
||||||
//Schritt 5: Einsetzen der Subst Regel
|
//Schritt 5: Einsetzen der Subst Regel
|
||||||
//Hier werden die TPHs substituiert, und dann nach geänderten und nicht geänderten Sets sortiert.
|
//Hier werden die TPHs substituiert, und dann nach geänderten und nicht geänderten Sets sortiert.
|
||||||
|
Loading…
Reference in New Issue
Block a user