This commit is contained in:
Florian Steurer 2015-10-24 20:32:05 +02:00
parent 5f9452cfda
commit 11fc7a4512
8 changed files with 63 additions and 13 deletions

View File

@ -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...)

View File

@ -0,0 +1,5 @@
package de.dhbwstuttgart.typeinference;
public interface IPair {
}

View File

@ -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
{

View File

@ -1,5 +1,7 @@
package de.dhbwstuttgart.typeinference.unify.interfaces;
public interface IFiniteClosure {
import de.dhbwstuttgart.typeinference.IPair;
public interface IFiniteClosure<T extends IPair> {
}

View File

@ -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;

View File

@ -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<T extends IPair> implements IFiniteClosure<T> {
public FiniteClosure(Set<T> pairs) {
}
}

View File

@ -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;

View File

@ -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<T> {
private T content;
private HashSet<Node<T>> predecessors = new HashSet<>();
private HashSet<Node<T>> descendants = new HashSet<>();
public Node(T content) {
this.content = content;
}
public void AddDescendant(Node<T> descendant) {
descendants.add(descendant);
}
public void AddPredecessor(Node<T> predecessor) {
predecessors.add(predecessor);
predecessor.AddDescendant(this);
}
public T getContent() {
return content;
}
public Set<Node<T>> getPredecessors() {
return null;
}
public Set<Node<T>> getDescendants() {
return null;
}
}