ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adammurd...@apache.org
Subject cvs commit: jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/conditions Equals.java
Date Tue, 04 Jun 2002 12:34:20 GMT
adammurdoch    2002/06/04 05:34:20

  Added:       framework/src/java/org/apache/myrmidon/framework/conditions
                        Equals.java
  Removed:     antlib/src/java/org/apache/antlib/core Equals.java
  Log:
  Move <equals> condition across to framework, so that the framework unit
  tests can use it.  Also made it work with Object, rather than String.
  
  Revision  Changes    Path
  1.1                  jakarta-ant-myrmidon/framework/src/java/org/apache/myrmidon/framework/conditions/Equals.java
  
  Index: Equals.java
  ===================================================================
  package org.apache.myrmidon.framework.conditions;
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  
  import org.apache.myrmidon.api.TaskException;
  import org.apache.myrmidon.api.TaskContext;
  import org.apache.myrmidon.framework.conditions.Condition;
  
  /**
   * Simple String comparison condition.
   *
   * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
   * @version $Revision: 1.1 $
   *
   * @ant.type type="condition" name="equals"
   */
  public class Equals
      implements Condition
  {
      private Object m_arg1;
      private Object m_arg2;
  
      /**
       * The value to test.
       */
      public void setArg1( final Object a1 )
      {
          m_arg1 = a1;
      }
  
      /**
       * The value to test.
       */
      public void setArg2( final Object a2 )
      {
          m_arg2 = a2;
      }
  
      /**
       * Evaluates this condition.
       *
       * @param context
       *      The context to evaluate the condition in.
       */
      public boolean evaluate( final TaskContext context )
          throws TaskException
      {
          if( m_arg1 == null || m_arg2 == null )
          {
              throw new TaskException( "Both arg1 and arg2 are required in equals" );
          }
          return m_arg1.equals( m_arg2 );
      }
  }
  
  
  

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


Mime
View raw message