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/java JavaMatcher.java
Date Tue, 15 Jun 2004 05:39:54 GMT
dfs         2004/06/14 22:39:54

  Modified:    src/java/org/apache/oro/text/java JavaMatcher.java
  Log:
  Implemented matches methods according to contract defined in PatternMatcher.
  
  Revision  Changes    Path
  1.2       +27 -7     jakarta-oro/src/java/org/apache/oro/text/java/JavaMatcher.java
  
  Index: JavaMatcher.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/java/JavaMatcher.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaMatcher.java	15 Jun 2004 02:46:00 -0000	1.1
  +++ JavaMatcher.java	15 Jun 2004 05:39:54 -0000	1.2
  @@ -66,26 +66,46 @@
       throw new UnsupportedOperationException();
     }
   
  -  /** Currently throws an UnsupportedOperationException. */
  +
  +  private boolean __matches(Matcher matcher) {
  +    boolean matched;
  +
  +    matched = matcher.matches();
  +
  +    if(matched)
  +      __matcher = matcher;
  +    else
  +      __matcher = null;
  +
  +    return matched;
  +  }
  +
  +
     public boolean matches(String input,
                            org.apache.oro.text.regex.Pattern pattern)
     {
  -    throw new UnsupportedOperationException();
  +    JavaPattern jp = (JavaPattern)pattern;
  +    return __matches(jp._matcher(input));
     }
   
  -  /** Currently throws an UnsupportedOperationException. */
  +
     public boolean matches(char[] input,
                            org.apache.oro.text.regex.Pattern pattern)
     {
  -    throw new UnsupportedOperationException();
  +    JavaPattern jp = (JavaPattern)pattern;
  +    return __matches(jp._matcher(CharBuffer.wrap(input)));
     }
   
   
  -  /** Currently throws an UnsupportedOperationException. */
     public boolean matches(PatternMatcherInput input,
                            org.apache.oro.text.regex.Pattern pattern)
     {
  -    throw new UnsupportedOperationException();
  +    JavaPattern jp    = (JavaPattern)pattern;
  +    CharBuffer buffer = 
  +      CharBuffer.wrap(input.getBuffer(), input.getBeginOffset(),
  +                      input.getEndOffset());
  +    Matcher matcher = jp._matcher(buffer);
  +    return __matches(matcher);
     }
   
   
  
  
  

---------------------------------------------------------------------
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