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 MatchActionInfo.java MatchActionProcessor.java
Date Wed, 13 Jun 2001 01:45:10 GMT
dfs         01/06/12 18:45:10

  Modified:    src/java/examples groups.java semicolon.java
               src/java/org/apache/oro/text MatchActionInfo.java
                        MatchActionProcessor.java
  Added:       src/java/examples semicolon.txt
  Log:
  o Fixed bug in MatchActionProcessor whereby MatchActionInfo.pattern was not
    getting set and was therefore always null when MatchAction.processMatch was
    called.
  
  o Changed fields member of MatchActionInfo to be a List rather than a Vector
    and updated affected code in examples/groups.java and examples/semicolon.java
  
  o Added examples/semicolon.txt which is the input file for the semicolon.java
    example program.  It had been missed when incorporating the TextTools
    classes software into jakarta-oro.
  
  PR: 476, 2077
  
  Revision  Changes    Path
  1.5       +2 -2      jakarta-oro/src/java/examples/groups.java
  
  Index: groups.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/examples/groups.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- groups.java	2001/05/20 23:55:15	1.4
  +++ groups.java	2001/06/13 01:45:07	1.5
  @@ -56,7 +56,7 @@
    */
   
   /*
  - * $Id: groups.java,v 1.4 2001/05/20 23:55:15 dfs Exp $
  + * $Id: groups.java,v 1.5 2001/06/13 01:45:07 dfs Exp $
    */
   import java.io.*;
   import java.util.*;
  @@ -83,7 +83,7 @@
         public void processMatch(MatchActionInfo info) {
   	// Add group name to hashtable entry
   	((Vector)groups.get(info.match.toString())).addElement(
  -				       info.fields.elementAt(0));
  +				       info.fields.get(0));
         }
       };
   
  
  
  
  1.5       +2 -2      jakarta-oro/src/java/examples/semicolon.java
  
  Index: semicolon.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/examples/semicolon.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- semicolon.java	2001/05/20 23:55:15	1.4
  +++ semicolon.java	2001/06/13 01:45:08	1.5
  @@ -56,7 +56,7 @@
    */
   
   /*
  - * $Id: semicolon.java,v 1.4 2001/05/20 23:55:15 dfs Exp $
  + * $Id: semicolon.java,v 1.5 2001/06/13 01:45:08 dfs Exp $
    */
   import java.io.*;
   
  @@ -82,7 +82,7 @@
         processor.addAction(null, new MatchAction() {
   	public void processMatch(MatchActionInfo info) {
   	  // We assume the second column exists
  -	  info.output.println(info.fields.elementAt(1));
  +	  info.output.println(info.fields.get(1));
   	}
         });
       } catch(MalformedPatternException e) {
  
  
  
  1.1                  jakarta-oro/src/java/examples/semicolon.txt
  
  Index: semicolon.txt
  ===================================================================
  1;Trenton;New Jersey
  2;Annapolis;Maryland
  3;Austin;Texas
  4;Richmond;Virginia
  5;Harrisburg;Pennsylvania
  6;Honolulu;Hawaii
  7;Santa Fe;New Mexico
  
  
  
  1.5       +3 -3      jakarta-oro/src/java/org/apache/oro/text/MatchActionInfo.java
  
  Index: MatchActionInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/MatchActionInfo.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MatchActionInfo.java	2001/05/20 23:55:18	1.4
  +++ MatchActionInfo.java	2001/06/13 01:45:09	1.5
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: MatchActionInfo.java,v 1.4 2001/05/20 23:55:18 dfs Exp $
  + * $Id: MatchActionInfo.java,v 1.5 2001/06/13 01:45:09 dfs Exp $
    */ 
   import java.util.*;
   import java.io.*;
  @@ -99,11 +99,11 @@
     public Pattern fieldSeparator;
   
     /**
  -   * A Vector of Strings containing the fields of the line that were
  +   * A List of Strings containing the fields of the line that were
      * separated out by the fieldSeparator.  If no field separator was
      * specified, this variable will be set to null.
      */
  -  public Vector fields;
  +  public List fields;
   
     /** The PatternMatcher used to find the match. */
     public PatternMatcher matcher;
  
  
  
  1.5       +16 -6     jakarta-oro/src/java/org/apache/oro/text/MatchActionProcessor.java
  
  Index: MatchActionProcessor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-oro/src/java/org/apache/oro/text/MatchActionProcessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- MatchActionProcessor.java	2001/05/20 23:55:18	1.4
  +++ MatchActionProcessor.java	2001/06/13 01:45:09	1.5
  @@ -58,7 +58,7 @@
    */
   
   /*
  - * $Id: MatchActionProcessor.java,v 1.4 2001/05/20 23:55:18 dfs Exp $
  + * $Id: MatchActionProcessor.java,v 1.5 2001/06/13 01:45:09 dfs Exp $
    */ 
   import java.io.*;
   import java.util.*;
  @@ -311,6 +311,7 @@
       Object obj;
       Pattern pattern;
       MatchAction action;
  +    List fields = new ArrayList();
   
       // Set those things that will not change.
       info.matcher        = __matcher;
  @@ -332,16 +333,25 @@
   	  if(__matcher.contains(info.charLine, pattern)) {
   	    info.match = __matcher.getMatch();
   	    info.lineNumber = reader.getLineNumber();
  -	    if(__fieldSeparator != null)
  -	      info.fields = Util.split(__matcher, __fieldSeparator, info.line);
  +	    info.pattern    = pattern;
  +	    if(__fieldSeparator != null) {
  +	      fields.clear();
  +	      Util.split(fields, __matcher, __fieldSeparator, info.line);
  +	      info.fields = fields;
  +	    } else
  +	      info.fields = null;
   	    action = (MatchAction)__actions.elementAt(current);
   	    action.processMatch(info);
   	  }
   	} else {
  -	  info.match = null;
  +	  info.match      = null;
   	  info.lineNumber = reader.getLineNumber();
  -	  if(__fieldSeparator != null)
  -	    info.fields = Util.split(__matcher, __fieldSeparator, info.line);
  +	  if(__fieldSeparator != null) {
  +	    fields.clear();
  +	    Util.split(fields, __matcher, __fieldSeparator, info.line);
  +	    info.fields = fields;
  +	  } else
  +	    info.fields = null;
   	  action = (MatchAction)__actions.elementAt(current);
   	  action.processMatch(info);
   	}
  
  
  

Mime
View raw message