Changeset 3419
- Timestamp:
- Feb 20, 2008, 8:01:18 PM (13 years ago)
- Location:
- to-imperative/trunk/java/runtime
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
to-imperative/trunk/java/runtime/org/refal/plus/Box.java
r3027 r3419 18 18 } 19 19 20 public Box (Comparable obj) {20 public Box (Comparable<?> obj) { 21 21 expr = new Expr(obj); 22 22 } … … 43 43 } 44 44 45 public Named (String n, Comparable obj) {45 public Named (String n, Comparable<?> obj) { 46 46 super(obj); 47 47 name = n; -
to-imperative/trunk/java/runtime/org/refal/plus/Expr.java
r3388 r3419 209 209 Comparable term = terms[k]; 210 210 Comparable term1 = terms1[k1]; 211 int res = RefalRuntime.c ompare(term.getClass(), term1.getClass());211 int res = RefalRuntime.classCompare(term.getClass(), term1.getClass()); 212 212 if (res == 0) 213 213 res = term.compareTo(term1); -
to-imperative/trunk/java/runtime/org/refal/plus/RefalException.java
r3027 r3419 8 8 9 9 public class RefalException extends Exception { 10 private static final long serialVersionUID = 7453964120524064700L; 11 10 12 private final Expr expr; 11 13 -
to-imperative/trunk/java/runtime/org/refal/plus/RefalRuntime.java
r3027 r3419 22 22 public static void setArgs (String arg0, String[] _args) { 23 23 Expr.Concatenator c = Expr.getConcatenator(_args.length + 1); 24 c.toRight((Comparable ) Expr.fromSequence(arg0));24 c.toRight((Comparable<Expr>) Expr.fromSequence(arg0)); 25 25 for (String arg : _args) 26 c.toRight((Comparable ) Expr.fromSequence(arg));26 c.toRight((Comparable<Expr>) Expr.fromSequence(arg)); 27 27 args = c.yield(); 28 28 } … … 30 30 // =========== CLASS COMPARE ============ 31 31 32 private static Map<Class , Integer> classMap = new HashMap<Class, Integer>();32 private static Map<Class<?>, Integer> classMap = new HashMap<Class<?>, Integer>(); 33 33 private static int maxPriority = 0; 34 34 … … 40 40 } 41 41 42 private static void insert (Class cl, int clPri) {43 for (Map.Entry<Class , Integer> ent : classMap.entrySet()) {42 private static void insert (Class<?> cl, int clPri) { 43 for (Map.Entry<Class<?>, Integer> ent : classMap.entrySet()) { 44 44 int pri = ent.getValue(); 45 45 if (pri >= clPri) … … 50 50 } 51 51 52 private static Integer getPriority (Class cl) {52 private static Integer getPriority (Class<?> cl) { 53 53 Integer clPri = classMap.get(cl); 54 54 if (clPri == null) { … … 59 59 } 60 60 61 public static void setAnyPriority (Class cl) {61 public static void setAnyPriority (Class<?> cl) { 62 62 getPriority(cl); 63 63 } 64 64 65 public static void setPriorityTheSame (Class cl, Classref) {65 public static void setPriorityTheSame (Class<?> cl, Class<?> ref) { 66 66 classMap.put(cl, getPriority(ref)); 67 67 } 68 68 69 public static void setPriorityAfter (Class cl, Classref) {69 public static void setPriorityAfter (Class<?> cl, Class<?> ref) { 70 70 insert(cl, getPriority(ref) + 1); 71 71 } 72 72 73 public static void setPriorityBefore (Class cl, Classref) {73 public static void setPriorityBefore (Class<?> cl, Class<?> ref) { 74 74 insert(cl, getPriority(ref)); 75 75 } 76 76 77 public static int c ompare (Class cl1, Classcl2) {77 public static int classCompare (Class<?> cl1, Class<?> cl2) { 78 78 return getPriority(cl1).compareTo(getPriority(cl2)); 79 79 } -
to-imperative/trunk/java/runtime/org/refal/plus/Reference.java
r3027 r3419 7 7 package org.refal.plus; 8 8 9 public class Reference<T> implements Comparable<Reference > {9 public class Reference<T> implements Comparable<Reference<?>> { 10 10 public final T object; 11 11 … … 15 15 16 16 public boolean equals (Object obj) { 17 return (obj instanceof Reference) && object == ((Reference ) obj).object;17 return (obj instanceof Reference) && object == ((Reference<?>) obj).object; 18 18 } 19 19 … … 26 26 } 27 27 28 public int compareTo (Reference ref) {28 public int compareTo (Reference<?> ref) { 29 29 return RefalRuntime.compare(this, ref); 30 30 } -
to-imperative/trunk/java/runtime/org/refal/plus/Result.java
r3357 r3419 20 20 } 21 21 22 public void assign (Comparable obj) {22 public void assign (Comparable<?> obj) { 23 23 expr = new Expr(obj); 24 24 } -
to-imperative/trunk/java/runtime/org/refal/plus/Symbol.java
r3418 r3419 17 17 private Symbol () {} 18 18 19 public static final Comparable null_object = new Reference(null);19 public static final Comparable<?> null_object = new Reference<Object>(null); 20 20 21 public static Comparable newInt (String str) {21 public static Comparable<?> newInt (String str) { 22 22 return new BigInteger(str); 23 23 } 24 24 25 public static Comparable newWord (String str) {25 public static Comparable<?> newWord (String str) { 26 26 return str; 27 27 } 28 28 29 public static Comparable newBox (String name) {29 public static Comparable<?> newBox (String name) { 30 30 return new Box.Named(name); 31 31 } 32 32 33 public static Comparable newChannel (String name) {33 public static Comparable<?> newChannel (String name) { 34 34 return new Channel.Named(name); 35 35 } … … 39 39 } 40 40 41 public static Comparable newString (String name) {41 public static Comparable<?> newString (String name) { 42 42 return new Reference.Named<StringBuffer>(name, new StringBuffer()); 43 43 } … … 47 47 } 48 48 49 public static Comparable newTable (String name) {49 public static Comparable<?> newTable (String name) { 50 50 return new Reference.Named<Map<Expr, Expr>>(name, new TreeMap<Expr, Expr>()); 51 51 } … … 55 55 } 56 56 57 public static Comparable newVector (String name) {57 public static Comparable<?> newVector (String name) { 58 58 return new Reference.Named<List<Expr>>(name, new Vector<Expr>()); 59 59 } -
to-imperative/trunk/java/runtime/org/refal/plus/Util.java
r3027 r3419 13 13 private Util () {} 14 14 15 public static class ValueOutOfBoundsException extends Exception {} 15 public static class ValueOutOfBoundsException extends Exception { 16 private static final long serialVersionUID = -5631184654192001924L; 17 } 16 18 17 public static class NegativeValueException extends ValueOutOfBoundsException {} 19 public static class NegativeValueException extends ValueOutOfBoundsException { 20 private static final long serialVersionUID = 5680869192032071999L; 21 } 18 22 19 23 private static final BigInteger minInt = BigInteger.valueOf(Integer.MIN_VALUE); -
to-imperative/trunk/java/runtime/refal/plus/Apply.java
r2882 r3419 13 13 private Apply () {} 14 14 15 @SuppressWarnings("all") 15 16 @RefalFormat("$func? Apply s.Name e.Exp = e.Exp;") 16 17 public static boolean Apply (Expr func, Expr arg, Result res) throws RefalException { -
to-imperative/trunk/java/runtime/refal/plus/Box.java
r2882 r3419 13 13 private Box () {} 14 14 15 @SuppressWarnings("all") 15 16 @RefalFormat("$func Box e.Exp = s.Box;") 16 17 public static void Box (Expr e, Result res) { -
to-imperative/trunk/java/runtime/refal/plus/Class.java
r2882 r3419 59 59 } 60 60 61 @SuppressWarnings("unchecked") 61 62 @RefalFormat("$func? IsString e.Exp = ;") 62 63 public static boolean IsString (Expr e) { … … 68 69 } 69 70 71 @SuppressWarnings("unchecked") 70 72 @RefalFormat("$func? IsTable e.Exp = ;") 71 73 public static boolean IsTable (Expr e) { 72 74 try { 73 return e.length() == 1 && (((Reference<Map >) e.at(0)).object instanceof Map);75 return e.length() == 1 && (((Reference<Map<Expr, Expr>>) e.at(0)).object instanceof Map); 74 76 } catch (ClassCastException _) { 75 77 return false; … … 77 79 } 78 80 81 @SuppressWarnings("unchecked") 79 82 @RefalFormat("$func? IsVector e.Exp = ;") 80 83 public static boolean IsVector (Expr e) { 81 84 try { 82 return e.length() == 1 && (((Reference<List >) e.at(0)).object instanceof List);85 return e.length() == 1 && (((Reference<List<Expr>>) e.at(0)).object instanceof List); 83 86 } catch (ClassCastException _) { 84 87 return false; -
to-imperative/trunk/java/runtime/refal/plus/Compare.java
r2882 r3419 17 17 private static final Expr eq = new Expr(new Character('=')); 18 18 19 @SuppressWarnings("all") 19 20 @RefalFormat("$func Compare (e.Exp1) (e.Exp2) = s.Res;") // '<', '>', '=' 20 21 public static void Compare (Expr a, Expr b, Result res) { -
to-imperative/trunk/java/runtime/refal/plus/Dos.java
r2882 r3419 27 27 { 28 28 Calendar c = Calendar.getInstance(); 29 Comparable [] time = {29 Comparable<?>[] time = { 30 30 BigInteger.valueOf(c.get(Calendar.DAY_OF_MONTH)), 31 31 space, -
to-imperative/trunk/java/runtime/refal/plus/System.java
r2882 r3419 35 35 } 36 36 37 @SuppressWarnings("all") 37 38 @RefalFormat("$func System e.cmd = s.res ;") 38 39 public static void System (Expr cmd, Result res) throws RefalException {
Note: See TracChangeset
for help on using the changeset viewer.