jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Davey - Sun UK Support Engineer <michael.da...@Sun.COM>
Subject Re: [Patch] Perl5Util minor doc changes
Date Thu, 07 Feb 2002 09:12:49 GMT
Please ignore "[Patch] Perl5Util minor doc changes"
message dated 09:07 GMT.


coderage@r2net.co.uk wrote:
> 
> Hi,
> 
> Here are some minor documentation changes.  This is a patch
> to Perl5Util version 1.10.
> 
> Files also available from http://coderage.org/oro/
> 
> --
> Michael
> 
> i trivial patch to add
> 
> public synchronized int substitute(StringBuffer result, String expression,
> >                                      PatternMatcherInput input)
> 
> ...to Perl5Util.
> 
> --- Perl5Util.java.1.10 Wed Feb  6 13:50:37 2002
> +++ Perl5Util.java.patch        Wed Feb  6 13:35:07 2002
> @@ -538,22 +538,26 @@
>     * result = util.substitute("s#/#\\#g", input);
>     * </pre></blockquote>
>     * <p>
> -   * @param expression The substitution expression.
> -   * @param input      The input.
> -   * @return           The input after substitutions have been performed.
> +   * @param result The <code>StringBuffer</code> in which to store the result
> +   * of the substitutions. The buffer is only appended to.
> +   * @param expression The Perl 5 substitution regular expression.
> +   * @param input The input on which to perform substitutions.
> +   * @return <code>int</code> - The number of substitutions made.
>     * @exception MalformedPerl5PatternException  If there is an error in
>     *            the expression.  You are not forced to catch this exception
>     *            because it is derived from RuntimeException.
> +   * @since oro_release:2.0.5, file_version:1.11
> +   * </p>
>     */
>    // Expression parsing will have to be moved into a separate method if
>    // there are going to be variations of this method.
> -  public synchronized String substitute(String expression, String input)
> -       throws MalformedPerl5PatternException
> +  public synchronized int substitute(StringBuffer result, String expression,
> +                                     PatternMatcherInput input)
> +  throws MalformedPerl5PatternException
>    {
>      boolean backslash, finalDelimiter;
>      int index, compileOptions, numSubstitutions, numInterpolations;
> -    int firstOffset, secondOffset, thirdOffset;
> -    String result;
> +    int firstOffset, secondOffset, thirdOffset, countSubstitutions;
>      StringBuffer replacement;
>      Pattern compiledPattern;
>      char exp[], delimiter;
> @@ -575,12 +579,13 @@
>         break __nullTest;
>        }
> 
> -      result = Util.substitute(__matcher, entry._pattern, entry._substitution,
> -                              input, entry._numSubstitutions);
> +      countSubstitutions = Util.substitute(result, __matcher, entry._pattern,
> +                                           entry._substitution, input,
> +                                           entry._numSubstitutions);
> 
>        __lastMatch = __matcher.getMatch();
> 
> -      return result;
> +      return countSubstitutions;
>      }
> 
>      exp = expression.toCharArray();
> @@ -680,11 +685,41 @@
>                                         numSubstitutions);
>      __expressionCache.addElement(expression, entry);
> 
> -    result = Util.substitute(__matcher, compiledPattern, substitution,
> -                            input, numSubstitutions);
> +    countSubstitutions = Util.substitute(result, __matcher, compiledPattern,
> +                                         substitution, input, numSubstitutions);
> 
>      __lastMatch = __matcher.getMatch();
> 
> +    return countSubstitutions;
> +  }
> +
> +
> +  /**
> +   * Substitutes a pattern in a given input with a replacement string.
> +   * <p>
> +   * @param expression The substitution expression.
> +   * @param input      The input.
> +   * @return           The input after substitutions have been performed.
> +   * @exception MalformedPerl5PatternException  If there is an error in
> +   *            the expression.  You are not forced to catch this exception
> +   *            because it is derived from RuntimeException.
> +   * <dt><b>See Also:</b></dt>
> +   *    substitute(StringBuffer result, String expression, PatternMatcherInput input)
> +   *<dt><b>Equivalent To:</b></dt>
> +   *<code>
> +   *   result = new StringBuffer();
> +   *   pmInput  = new PatternMatcherInput( strInput );
> +   *   perl.substitute(result, expression, pmiInput);
> +   *</code>
> +   */
> +  // Expression parsing will have to be moved into a separate method if
> +  // there are going to be variations of this method.
> +  public synchronized String substitute(String expression, String p_input)
> +  throws MalformedPerl5PatternException
> +  {
> +    result = new StringBuffer();
> +    input = new PatternMatcherInput(p_input);
> +    this.substitute(result, expression, input);
>      return result;
>    }
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:oro-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:oro-dev-help@jakarta.apache.org>

-- 
Michael Davey, Senior Knowledge Engineer   http://sun.co.uk/
UK Mission Critical Knowledge Centre,      http://sunsolve.sun.co.uk/
Enterprise Services, Sun Microsystems Ltd  http://docs.sun.com/ab2/
Guillemont Park, CAMBERLEY, GU17 9QG, UK   http://access1.eu.sun.com/
Tel: +44 8706 003 222                      http://sun.co.uk/developers/
Fax: +44 1252 420 137                    
== take it to the Nth (TM) = Ask me about Forte Developer 6 Update 2 ==

This email, including any attachments are communicated in confidence.
It is intended for the recipient only and may not be disclosed
further without the express consent of the sender.

--
To unsubscribe, e-mail:   <mailto:oro-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:oro-dev-help@jakarta.apache.org>


Mime
View raw message