donaldp     02/01/22 04:12:17

  Modified:    proposal/myrmidon/src/java/org/apache/myrmidon/framework
                        Pattern.java
  Log:
  value -> name to conform with ant1
  
  add utility method to evaluate name of pattern
  
  Revision  Changes    Path
  1.11      +32 -11    
jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Pattern.java
  
  Index: Pattern.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-ant/proposal/myrmidon/src/java/org/apache/myrmidon/framework/Pattern.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Pattern.java      20 Jan 2002 17:32:56 -0000      1.10
  +++ Pattern.java      22 Jan 2002 12:12:17 -0000      1.11
  @@ -9,7 +9,10 @@
   
   import org.apache.avalon.excalibur.i18n.ResourceManager;
   import org.apache.avalon.excalibur.i18n.Resources;
  +import org.apache.avalon.framework.context.ContextException;
   import org.apache.myrmidon.api.TaskException;
  +import org.apache.myrmidon.api.TaskContext;
  +import org.apache.tools.ant.Project;
   
   /**
    * Basic data type for holding patterns.
  @@ -22,7 +25,7 @@
       private final static Resources REZ =
           ResourceManager.getPackageResources( Pattern.class );
   
  -    private String m_value;
  +    private String m_name;
       private Condition m_condition;
   
       /**
  @@ -30,9 +33,9 @@
        *
        * @return the value of pattern
        */
  -    public String getValue()
  +    public String getName()
       {
  -        return m_value;
  +        return m_name;
       }
   
       /**
  @@ -46,14 +49,13 @@
       }
   
       /**
  -     * Setter method for value of pattern.
  -     * Conforms to setter patterns
  +     * Setter method for name of pattern.
        *
  -     * @param value the value
  +     * @param name the name
        */
  -    public void setValue( final String value )
  +    public void setName( final String name )
       {
  -        m_value = value;
  +        m_name = name;
       }
   
       /**
  @@ -82,11 +84,30 @@
           m_condition = new Condition( false, condition );
       }
   
  +    public String evaluateName( final TaskContext context )
  +    {
  +        try
  +        {
  +            final boolean result = getCondition().evaluate( context );
  +            if( result )
  +            {
  +                return getName();
  +            }
  +        }
  +        catch( final ContextException ce )
  +        {
  +            //ignore for the moment
  +        }
  +        return null;
  +    }
  +
  +
       public String toString()
       {
  -        String result = "Pattern['" + m_value + "',";
  -        if( null != m_condition ) {
  -          result = result + m_condition;
  +        String result = "Pattern['" + m_name + "',";
  +        if( null != m_condition )
  +        {
  +            result = result + m_condition;
           }
           return result + "]";
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to