Changeset 3419


Ignore:
Timestamp:
Feb 20, 2008, 8:01:18 PM (13 years ago)
Author:
yura
Message:
  • Suppress warnings.
  • Parameter at Comparable and Reference classes.
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  
    1818    }
    1919
    20     public Box (Comparable obj) {
     20    public Box (Comparable<?> obj) {
    2121        expr = new Expr(obj);
    2222    }
     
    4343        }
    4444
    45         public Named (String n, Comparable obj) {
     45        public Named (String n, Comparable<?> obj) {
    4646            super(obj);
    4747            name = n;
  • to-imperative/trunk/java/runtime/org/refal/plus/Expr.java

    r3388 r3419  
    209209            Comparable term = terms[k];
    210210            Comparable term1 = terms1[k1];
    211             int res = RefalRuntime.compare(term.getClass(), term1.getClass());
     211            int res = RefalRuntime.classCompare(term.getClass(), term1.getClass());
    212212            if (res == 0)
    213213                res = term.compareTo(term1);
  • to-imperative/trunk/java/runtime/org/refal/plus/RefalException.java

    r3027 r3419  
    88
    99public class RefalException extends Exception {
     10    private static final long serialVersionUID = 7453964120524064700L;
     11
    1012    private final Expr expr;
    1113
  • to-imperative/trunk/java/runtime/org/refal/plus/RefalRuntime.java

    r3027 r3419  
    2222    public static void setArgs (String arg0, String[] _args) {
    2323        Expr.Concatenator c = Expr.getConcatenator(_args.length + 1);
    24         c.toRight((Comparable) Expr.fromSequence(arg0));
     24        c.toRight((Comparable<Expr>) Expr.fromSequence(arg0));
    2525        for (String arg : _args)
    26             c.toRight((Comparable) Expr.fromSequence(arg));
     26            c.toRight((Comparable<Expr>) Expr.fromSequence(arg));
    2727        args = c.yield();
    2828    }
     
    3030    // =========== CLASS COMPARE ============
    3131
    32     private static Map<Class, Integer> classMap = new HashMap<Class, Integer>();
     32    private static Map<Class<?>, Integer> classMap = new HashMap<Class<?>, Integer>();
    3333    private static int maxPriority = 0;
    3434
     
    4040    }
    4141
    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()) {
    4444            int pri = ent.getValue();
    4545            if (pri >= clPri)
     
    5050    }
    5151
    52     private static Integer getPriority (Class cl) {
     52    private static Integer getPriority (Class<?> cl) {
    5353        Integer clPri = classMap.get(cl);
    5454        if (clPri == null) {
     
    5959    }
    6060
    61     public static void setAnyPriority (Class cl) {
     61    public static void setAnyPriority (Class<?> cl) {
    6262        getPriority(cl);
    6363    }
    6464
    65     public static void setPriorityTheSame (Class cl, Class ref) {
     65    public static void setPriorityTheSame (Class<?> cl, Class<?> ref) {
    6666        classMap.put(cl, getPriority(ref));
    6767    }
    6868
    69     public static void setPriorityAfter (Class cl, Class ref) {
     69    public static void setPriorityAfter (Class<?> cl, Class<?> ref) {
    7070        insert(cl, getPriority(ref) + 1);
    7171    }
    7272
    73     public static void setPriorityBefore (Class cl, Class ref) {
     73    public static void setPriorityBefore (Class<?> cl, Class<?> ref) {
    7474        insert(cl, getPriority(ref));
    7575    }
    7676
    77     public static int compare (Class cl1, Class cl2) {
     77    public static int classCompare (Class<?> cl1, Class<?> cl2) {
    7878        return getPriority(cl1).compareTo(getPriority(cl2));
    7979    }
  • to-imperative/trunk/java/runtime/org/refal/plus/Reference.java

    r3027 r3419  
    77package org.refal.plus;
    88
    9 public class Reference<T> implements Comparable<Reference> {
     9public class Reference<T> implements Comparable<Reference<?>> {
    1010    public final T object;
    1111
     
    1515
    1616    public boolean equals (Object obj) {
    17         return (obj instanceof Reference) && object == ((Reference) obj).object;
     17        return (obj instanceof Reference) && object == ((Reference<?>) obj).object;
    1818    }
    1919
     
    2626    }
    2727
    28     public int compareTo (Reference ref) {
     28    public int compareTo (Reference<?> ref) {
    2929        return RefalRuntime.compare(this, ref);
    3030    }
  • to-imperative/trunk/java/runtime/org/refal/plus/Result.java

    r3357 r3419  
    2020    }
    2121
    22     public void assign (Comparable obj) {
     22    public void assign (Comparable<?> obj) {
    2323        expr = new Expr(obj);
    2424    }
  • to-imperative/trunk/java/runtime/org/refal/plus/Symbol.java

    r3418 r3419  
    1717    private Symbol () {}
    1818
    19     public static final Comparable null_object = new Reference(null);
     19    public static final Comparable<?> null_object = new Reference<Object>(null);
    2020
    21     public static Comparable newInt (String str) {
     21    public static Comparable<?> newInt (String str) {
    2222        return new BigInteger(str);
    2323    }
    2424
    25     public static Comparable newWord (String str) {
     25    public static Comparable<?> newWord (String str) {
    2626        return str;
    2727    }
    2828
    29     public static Comparable newBox (String name) {
     29    public static Comparable<?> newBox (String name) {
    3030        return new Box.Named(name);
    3131    }
    3232
    33     public static Comparable newChannel (String name) {
     33    public static Comparable<?> newChannel (String name) {
    3434        return new Channel.Named(name);
    3535    }
     
    3939    }
    4040
    41     public static Comparable newString (String name) {
     41    public static Comparable<?> newString (String name) {
    4242        return new Reference.Named<StringBuffer>(name, new StringBuffer());
    4343    }
     
    4747    }
    4848
    49     public static Comparable newTable (String name) {
     49    public static Comparable<?> newTable (String name) {
    5050        return new Reference.Named<Map<Expr, Expr>>(name, new TreeMap<Expr, Expr>());
    5151    }
     
    5555    }
    5656
    57     public static Comparable newVector (String name) {
     57    public static Comparable<?> newVector (String name) {
    5858        return new Reference.Named<List<Expr>>(name, new Vector<Expr>());
    5959    }
  • to-imperative/trunk/java/runtime/org/refal/plus/Util.java

    r3027 r3419  
    1313    private Util () {}
    1414
    15     public static class ValueOutOfBoundsException extends Exception {}
     15    public static class ValueOutOfBoundsException extends Exception {
     16        private static final long serialVersionUID = -5631184654192001924L;
     17    }
    1618
    17     public static class NegativeValueException extends ValueOutOfBoundsException {}
     19    public static class NegativeValueException extends ValueOutOfBoundsException {
     20        private static final long serialVersionUID = 5680869192032071999L;
     21    }
    1822
    1923    private static final BigInteger minInt = BigInteger.valueOf(Integer.MIN_VALUE);
  • to-imperative/trunk/java/runtime/refal/plus/Apply.java

    r2882 r3419  
    1313    private Apply () {}
    1414
     15    @SuppressWarnings("all")
    1516    @RefalFormat("$func? Apply s.Name e.Exp = e.Exp;")
    1617    public static boolean Apply (Expr func, Expr arg, Result res) throws RefalException {
  • to-imperative/trunk/java/runtime/refal/plus/Box.java

    r2882 r3419  
    1313    private Box () {}
    1414
     15    @SuppressWarnings("all")
    1516    @RefalFormat("$func Box e.Exp = s.Box;")
    1617    public static void Box (Expr e, Result res) {
  • to-imperative/trunk/java/runtime/refal/plus/Class.java

    r2882 r3419  
    5959    }
    6060
     61    @SuppressWarnings("unchecked")
    6162    @RefalFormat("$func? IsString e.Exp = ;")
    6263    public static boolean IsString (Expr e) {
     
    6869    }
    6970
     71    @SuppressWarnings("unchecked")
    7072    @RefalFormat("$func? IsTable e.Exp = ;")
    7173    public static boolean IsTable (Expr e) {
    7274        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);
    7476        } catch (ClassCastException _) {
    7577            return false;
     
    7779    }
    7880
     81    @SuppressWarnings("unchecked")
    7982    @RefalFormat("$func? IsVector e.Exp = ;")
    8083    public static boolean IsVector (Expr e) {
    8184        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);
    8386        } catch (ClassCastException _) {
    8487            return false;
  • to-imperative/trunk/java/runtime/refal/plus/Compare.java

    r2882 r3419  
    1717    private static final Expr eq = new Expr(new Character('='));
    1818
     19    @SuppressWarnings("all")
    1920    @RefalFormat("$func Compare (e.Exp1) (e.Exp2) = s.Res;") // '<', '>', '='
    2021    public static void Compare (Expr a, Expr b, Result res) {
  • to-imperative/trunk/java/runtime/refal/plus/Dos.java

    r2882 r3419  
    2727    {
    2828        Calendar c = Calendar.getInstance();
    29         Comparable[] time = {
     29        Comparable<?>[] time = {
    3030            BigInteger.valueOf(c.get(Calendar.DAY_OF_MONTH)),
    3131            space,
  • to-imperative/trunk/java/runtime/refal/plus/System.java

    r2882 r3419  
    3535    }
    3636
     37    @SuppressWarnings("all")
    3738    @RefalFormat("$func System e.cmd = s.res ;")
    3839    public static void System (Expr cmd, Result res) throws RefalException {
Note: See TracChangeset for help on using the changeset viewer.