forked from JavaTX/JavaCompilerCore
Trennung von KomplexeMenge und COnstraintsSet. Experimenteller Zustand
This commit is contained in:
parent
2b6ffdef11
commit
15e9fb44b8
@ -1,123 +1,57 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import java.util.Vector;
|
||||
import de.dhbwstuttgart.logger.Logger;
|
||||
import de.dhbwstuttgart.logger.*;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||
|
||||
interface Constraint{
|
||||
|
||||
}
|
||||
|
||||
public class ConstraintsSet{
|
||||
private UndMenge<Pair> set = new UndMenge<>();
|
||||
public class ConstraintsSet implements Iterable<OderConstraint>{
|
||||
private static final Logger log = Logger.getLogger(ConstraintsSet.class.getName());
|
||||
|
||||
public void add(ConstraintsSet CSet){
|
||||
for(KomplexeMenge<Pair> i : CSet.set.set){
|
||||
this.set.addItems(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void add(KomplexeMenge<Pair> constraint){
|
||||
this.set.addItems(constraint);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
private UndConstraint constraintsSet;
|
||||
private Menge<OderConstraint> constraintsSet;
|
||||
|
||||
public ConstraintsSet(){
|
||||
constraintsSet = new UndConstraint();
|
||||
constraintsSet = new Menge<OderConstraint>();
|
||||
}
|
||||
|
||||
public void add(ConstraintsSet CSet){
|
||||
constraintsSet.addItems(CSet.getConstraints());
|
||||
for(OderConstraint element : CSet)
|
||||
add(element);
|
||||
}
|
||||
public void add(OderConstraint constraint){
|
||||
constraintsSet.addItems(constraint);
|
||||
constraintsSet.add(constraint);
|
||||
}
|
||||
|
||||
public UndConstraint getConstraints(){
|
||||
return constraintsSet;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* Liefert alle Constraint-Variationen
|
||||
* @return
|
||||
*/
|
||||
/*
|
||||
public Menge<Menge<UndConstraint>> getConstraints(){
|
||||
|
||||
Menge<Menge<UndConstraint>> ret = new Menge<Menge<UndConstraint>>();
|
||||
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
|
||||
public String toString(){
|
||||
return constraintsSet.toString();
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param unify
|
||||
*/
|
||||
public void filterWrongConstraints(Unifier unify) {
|
||||
/*
|
||||
Menge<KomplexeMenge<Pair>> newSet = new Menge<KomplexeMenge<Pair>>();
|
||||
for(OderMenge<Pair> orSet : this.getOrSets()){
|
||||
OderMenge<Pair> filtered = this.filterOrSet(unify, orSet);
|
||||
newSet.add(filtered);
|
||||
}
|
||||
for(KomplexeMenge<Pair> i : this.set.set){
|
||||
newSet.addAll(i.getAndSets());
|
||||
}
|
||||
this.set.set = newSet;
|
||||
|
||||
Menge<KomplexeMenge<Pair>> newSet = new Menge<KomplexeMenge<Pair>>();
|
||||
for(OderMenge<Pair> orSet : this.getOrSets()){
|
||||
Menge<Menge<Pair>> res = unify.apply(orSet.getItems());
|
||||
if(res.size()>0){
|
||||
newSet.add(orSet);
|
||||
}else{
|
||||
Logger.getLogger(this.getClass().getName())
|
||||
.debug("Ausgesondertes Constraint: "+orSet, Section.TYPEINFERENCE);
|
||||
}
|
||||
}
|
||||
for(KomplexeMenge<Pair> i : set){
|
||||
newSet.addAll(i.getAndSets());
|
||||
}
|
||||
this.set = newSet;
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
private OderMenge<Pair> filterOrSet(Unifier unify, OderMenge<Pair> orMenge){
|
||||
/*
|
||||
OderMenge<Pair> ret = new OderMenge<Pair>();
|
||||
for(OderMenge<Pair> m : orMenge.getOrSets()){
|
||||
ret.addItems(this.filterOrSet(unify, m));
|
||||
}
|
||||
for(UndMenge<Pair> m : orMenge.getAndSets()){
|
||||
Menge<Menge<Pair>> res = unify.apply(m.getItems());
|
||||
if(res.size()>0){
|
||||
ret.addItems(m);
|
||||
}else{
|
||||
Logger.getLogger(this.getClass().getName())
|
||||
.debug("Ausgesondertes Constraint: "+m, Section.TYPEINFERENCE);
|
||||
}
|
||||
String ret ="";
|
||||
for(OderConstraint constraint : this){
|
||||
ret += constraint.toString()+"\n";
|
||||
}
|
||||
return ret;
|
||||
*/
|
||||
return orMenge;
|
||||
}
|
||||
|
||||
public Iterator<OderConstraint> iterator() {
|
||||
return constraintsSet.iterator();
|
||||
}
|
||||
|
||||
public void filterWrongConstraints(Unifier unify) {
|
||||
for(OderConstraint constraint : this){
|
||||
constraint.filterWrongConstraints(unify);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,23 +59,21 @@ public class ConstraintsSet{
|
||||
* @param unifier
|
||||
*/
|
||||
public void unifyUndConstraints(Unifier unifier) {
|
||||
/*
|
||||
Menge<UndConstraint> uCons = this.filterUndConstraints();
|
||||
Menge<Pair> alleUndConstraints = new Menge<>();
|
||||
Vector<UndConstraint> uCons = this.filterUndConstraints();
|
||||
Vector<Pair> alleUndConstraints = new Vector<>();
|
||||
for(UndConstraint undConstraint : uCons){
|
||||
alleUndConstraints.addAll(undConstraint.getConstraintPairs());
|
||||
}
|
||||
this.filterWrongConstraints(
|
||||
(pairs)->{
|
||||
Menge<Pair> undConstraintsUndPairs = new Menge<>();
|
||||
Vector<Pair> undConstraintsUndPairs = new Vector<>();
|
||||
undConstraintsUndPairs.addAll(pairs);
|
||||
undConstraintsUndPairs.addAll(alleUndConstraints);
|
||||
log.debug("Versuche Pairs auszusondern:\n"+pairs, Section.TYPEINFERENCE);
|
||||
log.debug("Unifiziere:\n"+undConstraintsUndPairs, Section.TYPEINFERENCE);
|
||||
Menge<Menge<Pair>> unifyResult = unifier.apply(undConstraintsUndPairs);
|
||||
Vector<Vector<Pair>> unifyResult = unifier.apply(undConstraintsUndPairs);
|
||||
return unifyResult;
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,15 +81,12 @@ public class ConstraintsSet{
|
||||
* UndConstraints, welche sich nicht innerhalb eines OderConstraints befinden, herausgefiltert
|
||||
* @return [u1, ... , uN]
|
||||
*/
|
||||
private Menge<UndConstraint> filterUndConstraints() {
|
||||
/*
|
||||
Menge<UndConstraint> ret = new Menge<>();
|
||||
private Vector<UndConstraint> filterUndConstraints() {
|
||||
Vector<UndConstraint> ret = new Vector<>();
|
||||
for(OderConstraint con : constraintsSet){
|
||||
UndConstraint filtered = con.filterUndConstraints();
|
||||
if(filtered != null)ret.add(filtered);
|
||||
}
|
||||
return ret;
|
||||
*/
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.logger.Logger;
|
||||
import de.dhbwstuttgart.logger.Section;
|
||||
@ -10,42 +10,41 @@ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||
|
||||
public class OderConstraint{
|
||||
private OderMenge<Pair> oSet = new OderMenge<Pair>();
|
||||
//private Menge<UndConstraint> oderConstraintPairs;
|
||||
private Menge<UndConstraint> oderConstraintPairs;
|
||||
|
||||
private final static Logger logger = Logger.getLogger(OderConstraint.class.getName());
|
||||
|
||||
/**
|
||||
* Erstellt ein neues Oder Constraint und fügt bereits ein Constraint hinzu.
|
||||
* Erstellt ein neues Oder Constraint und f<EFBFBD>gt bereits ein Constraint hinzu.
|
||||
* @param p1
|
||||
* @param p2
|
||||
*/
|
||||
public OderConstraint(ConstraintType p1, ConstraintType p2){
|
||||
if(p1 == null || p2 == null)throw new NullPointerException();
|
||||
ConstraintPair constraintPair = new ConstraintPair(p1,p2);
|
||||
oderConstraintPairs = new Menge<UndConstraint>();
|
||||
this.addConstraint(constraintPair);
|
||||
}
|
||||
|
||||
public OderConstraint(){
|
||||
oderConstraintPairs = new Menge<UndConstraint>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Liefert alle in diesem OderConstraint enthaltene Constraints. Dabei gehen die Verknüpfungen (Oder/Und) verloren.
|
||||
* Liefert alle in diesem OderConstraint enthaltene Constraints. Dabei gehen die Verkn<EFBFBD>pfungen (Oder/Und) verloren.
|
||||
* @return
|
||||
|
||||
public Menge<Pair> getConstraintPairs(){
|
||||
Menge<Pair> ret = new Menge<Pair>();
|
||||
*/
|
||||
public Vector<Pair> getConstraintPairs(){
|
||||
Vector<Pair> ret = new Vector<Pair>();
|
||||
for(UndConstraint oC : this.oderConstraintPairs){
|
||||
ret.addAll(oC.getConstraintPairs());
|
||||
}
|
||||
return ret;
|
||||
return this.g
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fügt ein Pair(p1, p2) dem Constraint hinzu
|
||||
* F<EFBFBD>gt ein Pair(p1, p2) dem Constraint hinzu
|
||||
* @param p1
|
||||
* @param p2
|
||||
*/
|
||||
@ -58,19 +57,37 @@ public class OderConstraint{
|
||||
* @param toAdd
|
||||
*/
|
||||
public void addConstraint(ConstraintPair toAdd){
|
||||
//oderConstraintPairs.add(new SingleConstraint(toAdd));
|
||||
this.oSet.addItem(toAdd.getPair());
|
||||
}
|
||||
public void addConstraint(UndConstraint methodConstraint) {
|
||||
this.oSet.addItems(methodConstraint.getConstraints());//oderConstraintPairs.add(methodConstraint);
|
||||
oderConstraintPairs.add(new SingleConstraint(toAdd));
|
||||
}
|
||||
|
||||
//TODO: Funktionalität für filter implementieren
|
||||
void filterWrongConstraints(Unifier unifier) {
|
||||
@Override
|
||||
public String toString(){
|
||||
String ret = "[";
|
||||
for(UndConstraint p : this.getUndConstraints()){
|
||||
ret += p.toString()+ "| ";
|
||||
}
|
||||
return ret+"]";
|
||||
}
|
||||
|
||||
public Vector<UndConstraint> getUndConstraints() {
|
||||
return this.oderConstraintPairs;
|
||||
/*
|
||||
Menge<UndConstraint> filteredConstraints = new Menge<>();
|
||||
Vector<UndConstraint> ret = new Vector<UndConstraint>();
|
||||
for(Pair p : this.getConstraintPairs()){
|
||||
ret.add(new UndConstraint(p.TA1,p.TA2));
|
||||
}
|
||||
return ret;
|
||||
*/
|
||||
}
|
||||
|
||||
public void addConstraint(UndConstraint methodConstraint) {
|
||||
oderConstraintPairs.add(methodConstraint);
|
||||
}
|
||||
|
||||
void filterWrongConstraints(Unifier unifier) {
|
||||
Vector<UndConstraint> filteredConstraints = new Vector<>();
|
||||
for(UndConstraint cons : this.getUndConstraints()){
|
||||
Menge<Menge<Pair>> unifierResult = unifier.apply(cons.getItems());
|
||||
Vector<Vector<Pair>> unifierResult = unifier.apply(cons.getConstraintPairs());
|
||||
if(!unifierResult.isEmpty()){
|
||||
filteredConstraints.add(cons);
|
||||
}else{
|
||||
@ -78,42 +95,13 @@ public class OderConstraint{
|
||||
}
|
||||
}
|
||||
this.oderConstraintPairs = filteredConstraints;
|
||||
*/
|
||||
}
|
||||
|
||||
UndConstraint filterUndConstraints() {
|
||||
return null;
|
||||
/*
|
||||
if(this.oderConstraintPairs.size()==1){
|
||||
return this.oderConstraintPairs.firstElement();
|
||||
}
|
||||
return null;
|
||||
*/
|
||||
}
|
||||
|
||||
public void addItems(UndConstraint uCons) {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public String toString(){
|
||||
String ret = "[";
|
||||
for(UndConstraint p : this.getUndConstraints()){
|
||||
ret += p.toString()+ " | ";
|
||||
}
|
||||
return ret+"]";
|
||||
}
|
||||
|
||||
public Menge<UndConstraint> getUndConstraints() {
|
||||
return this.set;
|
||||
|
||||
Menge<UndConstraint> ret = new Menge<UndConstraint>();
|
||||
for(Pair p : this.getConstraintPairs()){
|
||||
ret.add(new UndConstraint(p.TA1,p.TA2));
|
||||
}
|
||||
return ret;
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -18,10 +18,17 @@ import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||
* Item
|
||||
*/
|
||||
|
||||
interface Mapper<A,B>{
|
||||
B applyOrSet(OderMenge<A> i);
|
||||
B applyAndSet(UndMenge<A> i);
|
||||
B applySingle(EinzelElement<A> i);
|
||||
}
|
||||
|
||||
interface KomplexeMenge<A>{
|
||||
void addItems(KomplexeMenge<A> item);
|
||||
void addItem(A item);
|
||||
Menge<Menge<A>> cartesianProduct();
|
||||
<B> KomplexeMenge<B> map(Mapper<A,B> m);
|
||||
}
|
||||
|
||||
public class OderMenge<A> implements KomplexeMenge<A>{
|
||||
@ -85,4 +92,9 @@ public class OderMenge<A> implements KomplexeMenge<A>{
|
||||
}
|
||||
return ret + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B> KomplexeMenge<B> map(Mapper<A, B> m) {
|
||||
return m.applyOrSet(this);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
@ -11,51 +11,47 @@ import de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException;
|
||||
|
||||
|
||||
/**
|
||||
* Beschreibung von Herrn Plümicke:
|
||||
* "The set of constraints consists of constraints of the form ø R ø' , where ø and
|
||||
* ø' are Java types and R (R â { < , <? , = }) is a subtyping condition."
|
||||
* Beschreibung von Herrn Plümicke:
|
||||
* "The set of constraints consists of constraints of the form θ R θ' , where θ and
|
||||
* θ' are Java types and R (R ∈ { < , <? , = }) is a subtyping condition."
|
||||
*
|
||||
* @author AI10023 - Andreas Stadelmeier
|
||||
*
|
||||
* Die Klasse stellt ein OderConstraint-Set dar, welches nur aus einem Constraint besteht.
|
||||
*
|
||||
*/
|
||||
public class SingleConstraint extends EinzelElement<Pair>{
|
||||
//private Pair constraintPair; //entspricht ø condition ø'
|
||||
public class SingleConstraint extends UndConstraint{
|
||||
private Pair constraintPair; //entspricht θ condition θ'
|
||||
//private R condition; //entspricht der condition (R)
|
||||
|
||||
public SingleConstraint(ConstraintType p1, ConstraintType p2){
|
||||
super(new ConstraintPair(p1,p2).getPair());
|
||||
//super(p1,p2);
|
||||
//ConstraintPair constraintPair = new ConstraintPair(p1,p2);//super.getConstraintPairs().firstElement();
|
||||
//this.addConstraint(constraintPair);
|
||||
ConstraintPair constraintPair = new ConstraintPair(p1,p2);//super.getConstraintPairs().firstElement();
|
||||
this.addConstraint(constraintPair);
|
||||
}
|
||||
|
||||
public SingleConstraint(ConstraintPair toAdd) {
|
||||
super(toAdd.getPair());
|
||||
//this.addConstraint(toAdd);
|
||||
this.addConstraint(toAdd);
|
||||
}
|
||||
|
||||
public Pair getPair(){
|
||||
return this.cartesianProduct().firstElement().firstElement();
|
||||
return constraintPair;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override //Methode überschreiben, damit immer nur ein Menge mit nur einem Element zurückgeliefert wird.
|
||||
public Menge<Pair> getConstraintPairs(){
|
||||
Menge<Pair> ret = new Menge<Pair>();
|
||||
@Override //Methode überschreiben, damit immer nur ein Vector mit nur einem Element zurückgeliefert wird.
|
||||
public Vector<Pair> getConstraintPairs(){
|
||||
Vector<Pair> ret = new Vector<Pair>();
|
||||
ret.add(constraintPair);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
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 p2 = toAdd.getPair().TA2;
|
||||
if(p1==null || p2 == null)throw new NullPointerException();
|
||||
this.addItem(toAdd.getPair());
|
||||
|
||||
|
||||
//Hier werden die GTVs zu TPH gewandelt.
|
||||
//if(p1 instanceof RefType)((RefType)p1).GTV2TPH();
|
||||
@ -64,24 +60,22 @@ public class SingleConstraint extends EinzelElement<Pair>{
|
||||
//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.
|
||||
// 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:
|
||||
//{//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);
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public String toString(){
|
||||
return ""+constraintPair.TA1.toString()+" < "+constraintPair.TA2.toString();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
@ -1,57 +1,43 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Vector;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Menge;
|
||||
import de.dhbwstuttgart.syntaxtree.type.Type;
|
||||
import de.dhbwstuttgart.typeinference.unify.Unifier;
|
||||
|
||||
/**
|
||||
* Stellt ein Constraint dar, welches aus mehreren Constraint-Paaren besteht. Diese gelten alle stets gleichzeitig / sind per "Und" miteinander verknüpft.
|
||||
* Stellt ein Constraint dar, welches aus mehreren Constraint-Paaren besteht. Diese gelten alle stets gleichzeitig / sind per "Und" miteinander verknüpft.
|
||||
* @author janulrich
|
||||
*
|
||||
*/
|
||||
public class UndConstraint{
|
||||
|
||||
private UndMenge<Pair> uSet = new UndMenge<Pair>();
|
||||
public class UndConstraint extends OderConstraint {
|
||||
|
||||
public UndConstraint(ConstraintType p1, ConstraintType p2) {
|
||||
//super(p1, p2);
|
||||
this.uSet.addItem(new SingleConstraint(p1,p2).getPair());
|
||||
super(p1, p2);
|
||||
}
|
||||
|
||||
public UndConstraint() {
|
||||
super();
|
||||
}
|
||||
|
||||
UndMenge<Pair> getConstraints(){
|
||||
return uSet;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public Menge<UndConstraint> getUndConstraints() {
|
||||
Menge<UndConstraint> ret = new Menge<UndConstraint>();
|
||||
public Vector<UndConstraint> getUndConstraints() {
|
||||
Vector<UndConstraint> ret = new Vector<UndConstraint>();
|
||||
ret.add(this);
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
//String ret = super.toString();
|
||||
//return ret.replace('|', ',');
|
||||
/*
|
||||
String ret = "[";
|
||||
for(Pair p : this.uSet.getItems()){
|
||||
for(Pair p : this.getConstraintPairs()){
|
||||
ret += p.toString()+ ", ";
|
||||
}
|
||||
return ret+"]";
|
||||
*/
|
||||
return uSet.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
void filterWrongConstraints(Unifier unifier) {
|
||||
//In einem UndConstraint gibt es keine falschen Constraints
|
||||
@ -61,18 +47,4 @@ public class UndConstraint{
|
||||
UndConstraint filterUndConstraints(){
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Iterator<Pair> iterator() {
|
||||
return this.uSet.getItems().iterator();
|
||||
}
|
||||
*/
|
||||
public void addConstraint(ConstraintType type, ConstraintType type2) {
|
||||
this.uSet.addItem(new ConstraintPair(type,type2).getPair());
|
||||
}
|
||||
|
||||
public void addConstraint(ConstraintPair constraintPair) {
|
||||
this.uSet.addItem(constraintPair.getPair());
|
||||
}
|
||||
}
|
||||
|
@ -638,9 +638,9 @@ public class Unify
|
||||
for(Menge<Pair> pairs : vecvecpair){
|
||||
UndConstraint uCons = new UndConstraint();
|
||||
for(Pair p : pairs){
|
||||
uCons.addItem(p);
|
||||
uCons.addConstraint(new ConstraintPair(p));
|
||||
}
|
||||
orConstraints.addItems(uCons);
|
||||
orConstraints.addConstraint(uCons);
|
||||
}
|
||||
cSet.addItems(orConstraints);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user