X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Ftypes%2Futil%2FTypeTree.java;h=109f85fc21d21a8ae715ae43e74ffed208d4d59b;hp=b41dba8cfd7b451df288ab40b4265115af7a6cfa;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/util/TypeTree.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/util/TypeTree.java index b41dba8cf..109f85fc2 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/util/TypeTree.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/types/util/TypeTree.java @@ -1,70 +1,70 @@ -package org.simantics.scl.compiler.types.util; - -import org.simantics.scl.compiler.types.Skeletons; -import org.simantics.scl.compiler.types.TMetaVar; -import org.simantics.scl.compiler.types.Type; - -public class TypeTree { - - public static class Case { - public Type[] types; - public T result; - } - - private static class Node { - Case[] cases; - Branch[] branches; - - public Node(Case[] cases) { - this.cases = cases; - this.branches = new Branch[cases[0].types.length]; - } - - Branch getBranch(int i) { - // TODO - return null; - } - } - - private static class Branch { - - public void improve(Iterator iterator) { - // TODO Auto-generated method stub - - } - - } - - public static class Iterator { - Node node; - Type[] scrutinee; - - public Iterator(Node node, Type[] scrutinee) { - this.node = node; - this.scrutinee = scrutinee; - } - - public void improve() { - for(int i=0;i branch = node.getBranch(i); - if(branch != null) { - branch.improve(this); - --i; - } - } - } - } - } - - Node root; - - public TypeTree(Case[] cases) { - this.root = new Node(cases); - } - - public Iterator iterator(Type ... scrutinee) { - return new Iterator(root, scrutinee); - } -} +package org.simantics.scl.compiler.types.util; + +import org.simantics.scl.compiler.types.Skeletons; +import org.simantics.scl.compiler.types.TMetaVar; +import org.simantics.scl.compiler.types.Type; + +public class TypeTree { + + public static class Case { + public Type[] types; + public T result; + } + + private static class Node { + Case[] cases; + Branch[] branches; + + public Node(Case[] cases) { + this.cases = cases; + this.branches = new Branch[cases[0].types.length]; + } + + Branch getBranch(int i) { + // TODO + return null; + } + } + + private static class Branch { + + public void improve(Iterator iterator) { + // TODO Auto-generated method stub + + } + + } + + public static class Iterator { + Node node; + Type[] scrutinee; + + public Iterator(Node node, Type[] scrutinee) { + this.node = node; + this.scrutinee = scrutinee; + } + + public void improve() { + for(int i=0;i branch = node.getBranch(i); + if(branch != null) { + branch.improve(this); + --i; + } + } + } + } + } + + Node root; + + public TypeTree(Case[] cases) { + this.root = new Node(cases); + } + + public Iterator iterator(Type ... scrutinee) { + return new Iterator(root, scrutinee); + } +}