jakarta-oro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-oro/src/java/org/apache/oro/text/regex Perl5MatchResult.java
Date Tue, 15 Jun 2004 02:27:53 GMT
dfs         2004/06/14 19:27:53

  Modified:    src/java/org/apache/oro/text/regex Perl5MatchResult.java
  Log:
  Exposed as a public class with protected members to make it possible
  to implement JavaMatchResult through subclassing.
  
  Revision  Changes    Path
  1.10      +37 -37    jakarta-oro/src/java/org/apache/oro/text/regex/Perl5MatchResult.java
  
  Index: Perl5MatchResult.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/regex/Perl5MatchResult.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Perl5MatchResult.java	13 Feb 2004 22:02:00 -0000	1.9
  +++ Perl5MatchResult.java	15 Jun 2004 02:27:53 -0000	1.10
  @@ -28,7 +28,7 @@
    * @see PatternMatcher
    * @see Perl5Matcher
    */
  -final class Perl5MatchResult implements MatchResult {
  +public class Perl5MatchResult implements MatchResult {
     /**
      * The character offset into the line or stream where the match
      * begins.  Pattern matching methods that look for matches a line at
  @@ -37,7 +37,7 @@
      * boundaries should use this field as the offset into the entire
      * text stream.
      */
  -   int _matchBeginOffset;
  +  protected int _matchBeginOffset_;
   
   
     /**
  @@ -55,13 +55,13 @@
      * C language, groups that are not part of a match contain -1 as their
      * begin and end offsets.
      */
  -   int[] _beginGroupOffset, _endGroupOffset;
  +  protected int[] _beginGroupOffset_, _endGroupOffset_;
   
   
     /**
      * The entire string that matched the pattern.
      */
  -   String _match;
  +  protected String _match_;
   
   
     /**
  @@ -73,9 +73,9 @@
      *        sense.  At minimum, a MatchResult stores one group which
      *        represents the entire pattern matched including all subparts.
      */
  -  Perl5MatchResult(int groups){
  -    _beginGroupOffset = new int[groups];
  -    _endGroupOffset   = new int[groups];
  +  protected Perl5MatchResult(int groups){
  +    _beginGroupOffset_ = new int[groups];
  +    _endGroupOffset_   = new int[groups];
     }
   
   
  @@ -85,7 +85,7 @@
     public int length(){
       int length;
   
  -    length = (_endGroupOffset[0] - _beginGroupOffset[0]);
  +    length = (_endGroupOffset_[0] - _beginGroupOffset_[0]);
   
       return (length > 0 ? length : 0);
     }
  @@ -98,7 +98,7 @@
      *         itself.
      */
     public int groups(){
  -    return _beginGroupOffset.length;
  +    return _beginGroupOffset_.length;
     }
   
     /**
  @@ -112,14 +112,14 @@
     public String group(int group){
       int begin, end, length;
   
  -    if(group < _beginGroupOffset.length){
  -      begin  = _beginGroupOffset[group];
  -      end    = _endGroupOffset[group];
  -      length = _match.length();
  +    if(group < _beginGroupOffset_.length){
  +      begin  = _beginGroupOffset_[group];
  +      end    = _endGroupOffset_[group];
  +      length = _match_.length();
   
         if(begin >= 0 && end >= 0) {
   	if(begin < length && end <= length && end > begin)
  -	  return _match.substring(begin, end);
  +	  return _match_.substring(begin, end);
   	else if(begin <= end)
   	  return "";
         }
  @@ -136,12 +136,12 @@
      */
     public int begin(int group){
       int begin, end;//, length;
  -    if(group < _beginGroupOffset.length){
  -      begin  = _beginGroupOffset[group];
  -      end    = _endGroupOffset[group];
  -      //length = _match.length();
  +    if(group < _beginGroupOffset_.length){
  +      begin  = _beginGroupOffset_[group];
  +      end    = _endGroupOffset_[group];
  +      //length = _match_.length();
         if(begin >= 0 && end >= 0)// && begin < length &&
end <= length)
  -	//return _beginGroupOffset[group];
  +	//return _beginGroupOffset_[group];
   	return begin;
       }
   
  @@ -157,12 +157,12 @@
      */
     public int end(int group){
       int begin, end; //, length;
  -    if(group < _beginGroupOffset.length){
  -      begin  = _beginGroupOffset[group];
  -      end    = _endGroupOffset[group];
  -      //length = _match.length();
  +    if(group < _beginGroupOffset_.length){
  +      begin  = _beginGroupOffset_[group];
  +      end    = _endGroupOffset_[group];
  +      //length = _match_.length();
         if(begin >= 0 && end >= 0)// && begin < length &&
end <= length)
  -	//return _endGroupOffset[group];
  +	//return _endGroupOffset_[group];
   	return end;
       }
       return -1;
  @@ -179,13 +179,13 @@
      */
     public int beginOffset(int group){
       int begin, end;//, length;
  -    if(group < _beginGroupOffset.length){
  -      begin  = _beginGroupOffset[group];
  -      end    = _endGroupOffset[group];
  -      //length = _match.length();
  +    if(group < _beginGroupOffset_.length){
  +      begin  = _beginGroupOffset_[group];
  +      end    = _endGroupOffset_[group];
  +      //length = _match_.length();
         if(begin >= 0 && end >= 0)// && begin < length &&
end <= length)
  -	//return _matchBeginOffset + _beginGroupOffset[group];
  -	return _matchBeginOffset + begin;
  +	//return _matchBeginOffset_ + _beginGroupOffset_[group];
  +	return _matchBeginOffset_ + begin;
       }
       return -1;
     }
  @@ -202,13 +202,13 @@
      */
     public int endOffset(int group){
       int begin, end;//, length;
  -    if(group < _endGroupOffset.length){
  -      begin  = _beginGroupOffset[group];
  -      end    = _endGroupOffset[group];
  -      //length = _match.length();
  +    if(group < _endGroupOffset_.length){
  +      begin  = _beginGroupOffset_[group];
  +      end    = _endGroupOffset_[group];
  +      //length = _match_.length();
         if(begin >= 0 && end >= 0)// && begin < length &&
end <= length)
  -	//return _matchBeginOffset + _endGroupOffset[group];
  -	return _matchBeginOffset + end;
  +	//return _matchBeginOffset_ + _endGroupOffset_[group];
  +	return _matchBeginOffset_ + end;
       }
       return -1;
     }
  
  
  

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


Mime
View raw message