diff --git a/notizen/stf/Notes b/notizen/stf/Notes index 81d1c211..940b13f8 100644 --- a/notizen/stf/Notes +++ b/notizen/stf/Notes @@ -14,13 +14,15 @@ /* * Test b <. a, a <. b */ + + + - - - - +- Transitiven Abschluss von FC bilden um schneller Subtypen bestimmen zu können + - Problem: 2 FCs für Pairs und MPairs durch das Mapping - Equals der Typen schreiben um instanceof Prüfungen zu vermeiden +- Refactoring der Klassen Menge und Pair erlaubt? SPEED UP - Anwendungsreihenfolge der Regeln (wahrscheinlichste zuerst, evtl ist nach regel 1 regel 2 nie möglich etc...) diff --git a/src/de/dhbwstuttgart/typeinference/IPair.java b/src/de/dhbwstuttgart/typeinference/IPair.java new file mode 100644 index 00000000..a98693cd --- /dev/null +++ b/src/de/dhbwstuttgart/typeinference/IPair.java @@ -0,0 +1,5 @@ +package de.dhbwstuttgart.typeinference; + +public interface IPair { + +} diff --git a/src/de/dhbwstuttgart/typeinference/Pair.java b/src/de/dhbwstuttgart/typeinference/Pair.java index dcb13958..40dd3acc 100755 --- a/src/de/dhbwstuttgart/typeinference/Pair.java +++ b/src/de/dhbwstuttgart/typeinference/Pair.java @@ -31,7 +31,7 @@ import de.dhbwstuttgart.syntaxtree.type.WildcardType; // Klasse, die ein Paar in der Menge Eq speichern kann // ino.end // ino.class.Pair.26540.declaration -public class Pair implements Serializable, DeepCloneable +public class Pair implements IPair, Serializable, DeepCloneable // ino.end // ino.class.Pair.26540.body { diff --git a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java index 1270c8ce..dd527653 100644 --- a/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java +++ b/src/de/dhbwstuttgart/typeinference/unify/interfaces/IFiniteClosure.java @@ -1,5 +1,7 @@ package de.dhbwstuttgart.typeinference.unify.interfaces; -public interface IFiniteClosure { +import de.dhbwstuttgart.typeinference.IPair; +public interface IFiniteClosure { + } diff --git a/src/de/dhbwstuttgart/typeinference/unifynew/Unify.java b/src/de/dhbwstuttgart/typeinference/unifynew/Unify.java index 3158f6e7..9bbf8e26 100644 --- a/src/de/dhbwstuttgart/typeinference/unifynew/Unify.java +++ b/src/de/dhbwstuttgart/typeinference/unifynew/Unify.java @@ -1,11 +1,7 @@ package de.dhbwstuttgart.typeinference.unifynew; -import java.util.AbstractQueue; import java.util.ArrayList; -import java.util.HashSet; import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.Queue; import java.util.Set; import de.dhbwstuttgart.typeinference.Menge; diff --git a/src/de/dhbwstuttgart/typinference/unify/model/FiniteClosure.java b/src/de/dhbwstuttgart/typinference/unify/model/FiniteClosure.java index f0e90fdc..7c10d8ff 100644 --- a/src/de/dhbwstuttgart/typinference/unify/model/FiniteClosure.java +++ b/src/de/dhbwstuttgart/typinference/unify/model/FiniteClosure.java @@ -1,7 +1,13 @@ package de.dhbwstuttgart.typinference.unify.model; +import java.util.Set; + +import de.dhbwstuttgart.typeinference.IPair; import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure; -public class FiniteClosure implements IFiniteClosure { - +public class FiniteClosure implements IFiniteClosure { + + public FiniteClosure(Set pairs) { + + } } diff --git a/src/de/dhbwstuttgart/typinference/unify/model/MPair.java b/src/de/dhbwstuttgart/typinference/unify/model/MPair.java index abf6c2c7..0259e92e 100644 --- a/src/de/dhbwstuttgart/typinference/unify/model/MPair.java +++ b/src/de/dhbwstuttgart/typinference/unify/model/MPair.java @@ -1,8 +1,9 @@ package de.dhbwstuttgart.typinference.unify.model; +import de.dhbwstuttgart.typeinference.IPair; import de.dhbwstuttgart.typeinference.Pair.PairOperator; -public class MPair { +public class MPair implements IPair { private MType type1; private MType type2; diff --git a/src/de/dhbwstuttgart/typinference/unify/model/Node.java b/src/de/dhbwstuttgart/typinference/unify/model/Node.java new file mode 100644 index 00000000..a7c6e534 --- /dev/null +++ b/src/de/dhbwstuttgart/typinference/unify/model/Node.java @@ -0,0 +1,38 @@ +package de.dhbwstuttgart.typinference.unify.model; + +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +public class Node { + private T content; + + private HashSet> predecessors = new HashSet<>(); + private HashSet> descendants = new HashSet<>(); + + public Node(T content) { + this.content = content; + } + + public void AddDescendant(Node descendant) { + descendants.add(descendant); + } + + public void AddPredecessor(Node predecessor) { + predecessors.add(predecessor); + predecessor.AddDescendant(this); + } + + public T getContent() { + return content; + } + + public Set> getPredecessors() { + return null; + } + + public Set> getDescendants() { + return null; + } +}