summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/list/compiler.lst1
-rw-r--r--sources/scalac/symtab/SymbolComparator.java37
2 files changed, 38 insertions, 0 deletions
diff --git a/config/list/compiler.lst b/config/list/compiler.lst
index 0d55e231a9..50868c219f 100644
--- a/config/list/compiler.lst
+++ b/config/list/compiler.lst
@@ -94,6 +94,7 @@ symtab/SourceCompleter.java
symtab/SymSet.java
symtab/Symbol.java
symtab/SymbolCloner.java
+symtab/SymbolComparator.java
symtab/SymbolSubstTypeMap.java
symtab/SymbolTablePrinter.java
symtab/Type.java
diff --git a/sources/scalac/symtab/SymbolComparator.java b/sources/scalac/symtab/SymbolComparator.java
new file mode 100644
index 0000000000..c703663bf4
--- /dev/null
+++ b/sources/scalac/symtab/SymbolComparator.java
@@ -0,0 +1,37 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+\* */
+
+// $Id$
+
+package scalac.symtab;
+
+import java.util.Comparator;
+
+/** This class implements a symbol comparator. */
+public class SymbolComparator implements Comparator {
+
+ //########################################################################
+ // Public Constants
+
+ /** The unique instance of this class */
+ public static final Comparator instance = new SymbolComparator();
+
+ //########################################################################
+ // Private Constructors
+
+ /** Initializes this instance. */
+ private SymbolComparator() {}
+
+ //########################################################################
+ // Public Methods
+
+ /** Compares the two arguments which must inherit from Symbol. */
+ public int compare(Object lf, Object rg) {
+ return lf == rg ? 0 : ((Symbol)lf).isLess((Symbol)rg) ? -1 : 1;
+ }
+
+ //########################################################################
+}