checkpoint
authoradam <adam@megacz.com>
Sun, 15 Jan 2006 09:45:59 +0000 (04:45 -0500)
committeradam <adam@megacz.com>
Sun, 15 Jan 2006 09:45:59 +0000 (04:45 -0500)
darcs-hash:20060115094559-5007d-9ecc51d4c4b6287cd3361dd2a0aad44dc4011033.gz

src/edu/berkeley/sbp/misc/CharTopology.java [new file with mode: 0644]
src/edu/berkeley/sbp/util/ANSI.java [new file with mode: 0644]
src/edu/berkeley/sbp/util/Functor.java [new file with mode: 0644]

diff --git a/src/edu/berkeley/sbp/misc/CharTopology.java b/src/edu/berkeley/sbp/misc/CharTopology.java
new file mode 100644 (file)
index 0000000..796a4ce
--- /dev/null
@@ -0,0 +1,10 @@
+package edu.berkeley.sbp.misc;
+import edu.berkeley.sbp.*;
+import edu.berkeley.sbp.util.*;
+
+public class CharTopology extends IntegerTopology<Character> implements Functor<Character,Integer> {
+    public Integer invoke(Character c) { return (int)c.charValue(); }
+    public CharTopology()               { super(null); }
+    public CharTopology(Range.Set r)    { super(null, r); }
+    public CharTopology(char a, char b) { super(null, a, b); }
+}
diff --git a/src/edu/berkeley/sbp/util/ANSI.java b/src/edu/berkeley/sbp/util/ANSI.java
new file mode 100644 (file)
index 0000000..750f90d
--- /dev/null
@@ -0,0 +1,10 @@
+package edu.berkeley.sbp.util;
+public class ANSI {
+    public static String black(Object o) { return "\033[30m"+o+"\033[0m"; }
+    public static String red(Object o) { return "\033[31m"+o+"\033[0m"; }
+    public static String green(Object o) { return "\033[32m"+o+"\033[0m"; }
+    public static String yellow(Object o) { return "\033[33m"+o+"\033[0m"; }
+    public static String blue(Object o) { return "\033[34m"+o+"\033[0m"; }
+    public static String purple(Object o) { return "\033[35m"+o+"\033[0m"; }
+    public static String cyan(Object o) { return "\033[36m"+o+"\033[0m"; }
+}
diff --git a/src/edu/berkeley/sbp/util/Functor.java b/src/edu/berkeley/sbp/util/Functor.java
new file mode 100644 (file)
index 0000000..5f2e89e
--- /dev/null
@@ -0,0 +1,5 @@
+package edu.berkeley.sbp.util;
+
+public interface Functor<A,B> {
+    public B invoke(A a);
+}