Changeset 3976 for to-imperative


Ignore:
Timestamp:
Oct 17, 2008, 6:02:46 PM (12 years ago)
Author:
yura
Message:
  • Unused methods, fields and variables are deleted.
  • Pool for short expressions is deleted.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • to-imperative/branches/java_expr_without_holes/Expr.java

    r3975 r3976  
    88
    99import java.util.ArrayList;
    10 import java.util.LinkedList;
    1110import java.util.List;
    1211import java.util.ListIterator;
     
    2625     */
    2726    public static int no_copy = 0;
    28     public static int left_copy = 0;
    29     public static int right_copy = 0;
    3027    public static int both_copy = 0;
    3128   
    32     private static Comparable<?>[] terms_pool = new Comparable[8];
    33     private static int pool_index = 0;
    34 
    3529    private final Comparable<?>[] terms;
    3630    private final int start;
     
    136130        Comparable<?>[] terms1 = expr.terms;
    137131        int k1 = expr.start + j;
    138         int tslen = terms.length;
    139132        int k = start;
    140133        if (terms == terms1 && k == k1)
     
    171164     * Compares this expression with the specified expression for order.
    172165     */
     166    @SuppressWarnings("unchecked")
    173167    public int compareTo (Expr expr) {
    174168        assert expr != null : "expr="+expr;
     
    183177            compare_len = 0;
    184178        Comparable<?>[] terms1 = expr.terms;
    185         int tslen1 = terms1.length;
    186179        int k1 = expr.start;
    187         int tslen = terms.length;
    188180        int k = start;
    189181        for ( ; min_len > 0; min_len--, k++, k1++) {
     
    235227    public static Expr concat (Comparable<?> obj1, Comparable<?> obj2) {
    236228        assert obj1 != null && obj2 != null : "obj1="+obj1+", obj2="+obj2;
    237         if (pool_index >= terms_pool.length - 1) {
    238             terms_pool = new Comparable[8];
    239             pool_index = 0;
    240         }
    241         terms_pool[pool_index++] = obj1;
    242         terms_pool[pool_index++] = obj2;
    243         return new Expr(terms_pool, pool_index - 2, 2);
     229        return new Expr(new Comparable[] {obj1, obj2}, 0, 2);
    244230    }
    245231
     
    287273    public static Expr create (Comparable<?> term) {
    288274        assert term != null : "term=" + term;
    289         if (pool_index >= terms_pool.length) {
    290             terms_pool = new Comparable[8];
    291             pool_index = 0;
    292         }
    293         terms_pool[pool_index] = term;
    294         return new Expr(terms_pool, pool_index++, 1);
     275        return new Expr(new Comparable[] {term}, 0, 1);
    295276    }
    296277
     
    556537        private int length;
    557538       
    558         private InplaceConcatenator reinit (int initialCapacity) {
    559             terms = new Comparable[initialCapacity];
    560             length = 0;
    561             return this;
    562         }
    563 
    564         private InplaceConcatenator () {
    565             terms = null;
    566             length = 0;
    567         }
    568 
    569539        public InplaceConcatenator (int initialCapacity) {
    570540            assert initialCapacity >= 0;
Note: See TracChangeset for help on using the changeset viewer.