Changeset 4040


Ignore:
Timestamp:
Dec 4, 2008, 11:33:05 AM (12 years ago)
Author:
orlov
Message:
  • Fixed Expr creation in multi-threaded programs (branch with holes).
  • Fixed error messages in Arithm library.
Location:
to-imperative/trunk/java/java
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/trunk/java/java/org/refal/plus/Expr.java

    r4013 r4040  
    2222    public static int right_copy = 0;
    2323    public static int both_copy = 0;
    24 
    25     private static final InplaceConcatenator concatenator = new InplaceConcatenator();
    2624
    2725    private final Comparable<?>[] terms;
     
    248246        }
    249247        both_copy++;
    250         return concatenator.reinit(len).toRight(expr1).toRight(expr2).yield();
     248        return getConcatenator(len).toRight(expr1).toRight(expr2).yield();
    251249    }
    252250
     
    280278        }
    281279        both_copy++;
    282         return concatenator.reinit(expr.length + 1).toRight(expr).toRight(obj).yield();
     280        return getConcatenator(expr.length + 1).toRight(expr).toRight(obj).yield();
    283281    }
    284282
     
    301299        }
    302300        both_copy++;
    303         return concatenator.reinit(expr.length + 1).toRight(obj).toRight(expr).yield();
     301        return getConcatenator(expr.length + 1).toRight(obj).toRight(expr).yield();
    304302    }
    305303
     
    320318        assert seq != null : "seq=" + seq;
    321319        int len = seq.length();
    322         Expr.Concatenator ec = concatenator.reinit(len);
     320        Expr.Concatenator ec = getConcatenator(len);
    323321        for (int i = 0; i < len; i++)
    324322            ec.toRight(seq.charAt(i));
     
    604602        private int length;
    605603
    606         private InplaceConcatenator reinit (int initialCapacity) {
    607             terms = new Comparable[initialCapacity * 2 + 4];
    608             length = 0;
    609             return this;
    610         }
    611 
    612         private InplaceConcatenator () {
    613             terms = null;
    614             length = 0;
    615         }
    616 
    617604        public InplaceConcatenator (int initialCapacity) {
    618605            assert initialCapacity >= 0;
  • to-imperative/trunk/java/java/refal/plus/Arithm.java

    r3725 r4040  
    5858            rem.assign(Util.getBigInteger(int1).remainder(Util.getBigInteger(int2)));
    5959        } catch (ArithmeticException e) {
    60             throw new RefalException("Arithm", "Div", "Divide by zero");
     60            throw new RefalException("Arithm", "Rem", "Divide by zero");
    6161        } catch (ClassCastException e) {
    6262            throw new RefalException("Arithm", "Rem", "Invalid argument");
     
    9494            res.assign(Util.getBigInteger(int1).abs());
    9595        } catch (ClassCastException e) {
    96             throw new RefalException("Arithm", "Gcd", "Invalid argument");
     96            throw new RefalException("Arithm", "Abs", "Invalid argument");
    9797        }
    9898    }
Note: See TracChangeset for help on using the changeset viewer.