commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl ExpressionImpl.java
Date Fri, 09 Aug 2002 13:36:10 GMT
jstrachan    2002/08/09 06:36:10

  Modified:    jexl/src/java/org/apache/commons/jexl ExpressionImpl.java
  Log:
  minor typeo fix, addPostResolver was incorrectly adding a preResolver.
  Also used lazy construction to avoid creating 2 ArrayList instances per Expression instance
as a performance enhancement.
  
  Revision  Changes    Path
  1.3       +14 -6     jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/ExpressionImpl.java
  
  Index: ExpressionImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/jexl/src/java/org/apache/commons/jexl/ExpressionImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ExpressionImpl.java	13 Jun 2002 16:09:53 -0000	1.2
  +++ ExpressionImpl.java	9 Aug 2002 13:36:10 -0000	1.3
  @@ -73,8 +73,8 @@
    */
   class ExpressionImpl implements Expression
   {
  -    List preResolvers = new ArrayList();
  -    List postResolvers = new ArrayList();
  +    List preResolvers;
  +    List postResolvers;
   
       /**
        *  Original expression - this is just a 'snippet', not a valid
  @@ -110,7 +110,7 @@
           /*
            * if we have pre resolvers, give them a wack
            */
  -        if (preResolvers.size() != 0)
  +        if (preResolvers != null)
           {
               val = tryResolver(preResolvers, context);
   
  @@ -125,7 +125,7 @@
           /*
            * if null, call post resolvers
            */
  -        if (val == null && postResolvers.size() != 0)
  +        if (val == null && postResolvers != null)
           {
               val = tryResolver(postResolvers, context);
   
  @@ -178,6 +178,10 @@
   
       public void addPreResolver(JexlExprResolver resolver)
       {
  +        if (preResolvers == null) 
  +        {
  +            preResolvers = new ArrayList();
  +        }
           preResolvers.add(resolver);
       }
   
  @@ -189,7 +193,11 @@
        */
       public void addPostResolver(JexlExprResolver resolver)
       {
  -        preResolvers.add(resolver);
  +        if (postResolvers == null) 
  +        {
  +            postResolvers = new ArrayList();
  +        }
  +        postResolvers.add(resolver);
       }
   
   }
  
  
  

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


Mime
View raw message