summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/matching/Npair.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc/matching/Npair.scala')
-rw-r--r--src/compiler/scala/tools/nsc/matching/Npair.scala64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/Npair.scala b/src/compiler/scala/tools/nsc/matching/Npair.scala
new file mode 100644
index 0000000000..8cb050de2e
--- /dev/null
+++ b/src/compiler/scala/tools/nsc/matching/Npair.scala
@@ -0,0 +1,64 @@
+/* NSC -- new scala compiler
+ * Copyright 2005 LAMP/EPFL
+ * @author buraq
+ */
+// $Id$
+package scala.tools.nsc.matching ;
+
+import java.util.{ HashMap, TreeSet };
+/** cartesian
+ */
+
+/** Int x TreeSet[ Int ]
+ */
+case class Npair(nstate: Integer, nset: TreeSet) {
+
+ override def equals(that: Any): Boolean = {
+ this match {
+ case Npair(nstate, nset) =>
+ that match {
+ case Npair(_nstate, _nset) =>
+ return ((nstate == _nstate)
+ && (nset == _nset));
+ case _ => return false
+ }
+ case _ => return false
+ }
+ }
+
+ override def toString(): String = this match {
+ case Npair(nstate, nset) =>
+ //Integer dstate = (Integer) indexMap.get(nset);
+ "<n" + nstate.toString() + " in " + nset /*+" = d"+dstate*/ + ">";
+ case _ => null
+ }
+
+ def toString(indexMap: HashMap): String = {
+ //assert indexMap != null;
+ this match {
+ case Npair(nstate, nset) =>
+ //assert nstate != null;
+ val dstate = indexMap.get( nset ).asInstanceOf[Integer];
+ return "<n" + nstate.toString() + " in " + nset + " = d" + dstate + ">";
+ case _ =>
+ return null;
+ }
+ }
+
+
+}
+
+class NpairComparator extends StateSetComparator {
+ override def compare(o1: Any, o2: Any): Int = {
+ o1 match {
+ case Npair(nstate, nset) => o2 match {
+ case Npair(_nstate, _nset) =>
+ val res = nstate.compareTo(_nstate);
+ if (res != 0)
+ return res;
+ else
+ return super.compare(nset, _nset);
+ }
+ }
+ }
+}