Changeset 2609


Ignore:
Timestamp:
06/26/03 00:45:22 (20 years ago)
Author:
piso
Message:

clone(): work around problem with jikes 1.18 and IBM Java 1.4.1.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/j/src/gnu/regexp/REMatch.java

    r2 r2609  
    5555      copy.next = null;
    5656
    57       copy.start = (int[]) start.clone();
    58       copy.end = (int[]) end.clone();
     57            // Jun 25 2003 3:39 PM PG
     58            // Work around problem with jikes 1.18 and IBM Java 1.4.1.
     59            //copy.start = (int[]) start.clone();
     60            //copy.end = (int[]) end.clone();
     61            copy.start = new int[start.length];
     62            System.arraycopy(start, 0, copy.start, 0, start.length);
     63            copy.end = new int[end.length];
     64            System.arraycopy(end, 0, copy.end, 0, end.length);
    5965
    6066      return copy;
     
    97103  next = null; // cut off alternates
    98104    }
    99    
     105
    100106    /** Clears the current match and moves the offset to the new index. */
    101107    void clear(int index) {
     
    107113  next = null; // cut off alternates
    108114    }
    109    
     115
    110116    /**
    111117     * Returns the string matching the pattern.  This makes it convenient
    112118     * to write code like the following:
    113119     * <P>
    114      * <code> 
     120     * <code>
    115121     * REMatch myMatch = myExpression.getMatch(myString);<br>
    116122     * if (myMatch != null) System.out.println("Regexp found: "+myMatch);
     
    120126  return matchedText;
    121127    }
    122    
     128
    123129    /**
    124130     * Returns the index within the input text where the match in its entirety
     
    128134  return offset + start[0];
    129135    }
    130    
     136
    131137    /**
    132138     * Returns the index within the input string where the match in
     
    144150     * <P>
    145151     * But you can save yourself that work, since the <code>toString()</code>
    146      * method (above) does exactly that for you. 
     152     * method (above) does exactly that for you.
    147153     */
    148154    public int getEndIndex() {
    149155  return offset + end[0];
    150156    }
    151  
     157
    152158    /**
    153159     * Returns the string matching the given subexpression.  The subexpressions
     
    162168  return (matchedText.substring(start[sub],end[sub]));
    163169    }
    164    
    165     /** 
     170
     171    /**
    166172     * Returns the index within the input string used to generate this match
    167173     * where subexpression number <i>sub</i> begins, or <code>-1</code> if
     
    176182  return (x == -1) ? x : offset + x;
    177183    }
    178    
    179     /** 
     184
     185    /**
    180186     * Returns the index within the input string used to generate this match
    181187     * where subexpression number <i>sub</i> begins, or <code>-1</code> if
     
    190196  return (x == -1) ? x : offset + x;
    191197    }
    192  
    193     /** 
     198
     199    /**
    194200     * Returns the index within the input string used to generate this match
    195201     * where subexpression number <i>sub</i> ends, or <code>-1</code> if
     
    204210  return (x == -1) ? x : offset + x;
    205211    }
    206    
    207     /** 
     212
     213    /**
    208214     * Returns the index within the input string used to generate this match
    209215     * where subexpression number <i>sub</i> ends, or <code>-1</code> if
     
    217223  return (x == -1) ? x : offset + x;
    218224    }
    219    
     225
    220226    /**
    221227     * Substitute the results of this match to create a new string.
     
    236242    if (val < start.length) {
    237243        output.append(toString(val));
    238     } 
     244    }
    239245      } else output.append(input.charAt(pos));
    240246  }
Note: See TracChangeset for help on using the changeset viewer.