X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fmatching%2FStat.java;h=b1235ce0fb0d770db07253472e15337ff69e07ed;hp=03068c151e01f37a36d5499fc84966c84070047e;hb=refs%2Fchanges%2F38%2F238%2F2;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.graph/src/org/simantics/graph/matching/Stat.java b/bundles/org.simantics.graph/src/org/simantics/graph/matching/Stat.java index 03068c151..b1235ce0f 100644 --- a/bundles/org.simantics.graph/src/org/simantics/graph/matching/Stat.java +++ b/bundles/org.simantics.graph/src/org/simantics/graph/matching/Stat.java @@ -1,70 +1,70 @@ -package org.simantics.graph.matching; - -import java.util.Comparator; - -class Stat { - public int p, o; - - public Stat(int p, int o) { - this.p = p; - this.o = o; - } - - public Stat(Stat stat) { - this.p = stat.p; - this.o = stat.o; - } - - public void map(int[] map) { - if(p >= 0) - p = map[p]; - if(o >= 0) - o = map[o]; - } - - @Override - public String toString() { - return p + " " + o; - } - - public String toString(String[] names) { - return (p >= 0 ? names[p] : "?") + " " + (o >= 0 ? names[o] : "?"); - } - - @Override - public int hashCode() { - return 31*p + o; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Stat other = (Stat) obj; - return p==other.p && o==other.o; - } - - - - static final Stat[] NO_STATS = new Stat[0]; - - static final Comparator STAT_COMPARATOR = new Comparator() { - @Override - public int compare(Stat o1, Stat o2) { - if(o1.p < o2.p) - return -1; - else if(o1.p > o2.p) - return 1; - else if(o1.o < o2.o) - return -1; - else if(o1.o > o2.o) - return 1; - else - return 0; - } - }; +package org.simantics.graph.matching; + +import java.util.Comparator; + +class Stat { + public int p, o; + + public Stat(int p, int o) { + this.p = p; + this.o = o; + } + + public Stat(Stat stat) { + this.p = stat.p; + this.o = stat.o; + } + + public void map(int[] map) { + if(p >= 0) + p = map[p]; + if(o >= 0) + o = map[o]; + } + + @Override + public String toString() { + return p + " " + o; + } + + public String toString(String[] names) { + return (p >= 0 ? names[p] : "?") + " " + (o >= 0 ? names[o] : "?"); + } + + @Override + public int hashCode() { + return 31*p + o; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Stat other = (Stat) obj; + return p==other.p && o==other.o; + } + + + + static final Stat[] NO_STATS = new Stat[0]; + + static final Comparator STAT_COMPARATOR = new Comparator() { + @Override + public int compare(Stat o1, Stat o2) { + if(o1.p < o2.p) + return -1; + else if(o1.p > o2.p) + return 1; + else if(o1.o < o2.o) + return -1; + else if(o1.o > o2.o) + return 1; + else + return 0; + } + }; } \ No newline at end of file