ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types NameEntry.java FileSet.java PatternSet.java
Date Sun, 13 Jan 2002 05:38:01 GMT
donaldp     02/01/12 21:38:01

  Modified:    proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs
                        MatchingTask.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide
                        VAJExport.java
               proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix
                        Chmod.java
               proposal/myrmidon/src/main/org/apache/tools/ant/types
                        FileSet.java PatternSet.java
  Added:       proposal/myrmidon/src/main/org/apache/tools/ant/types
                        NameEntry.java
  Log:
  Made NameEntry a top level class rather than an inner class of PatternSet
  
  Revision  Changes    Path
  1.10      +7 -6      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java
  
  Index: MatchingTask.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- MatchingTask.java	13 Jan 2002 00:00:15 -0000	1.9
  +++ MatchingTask.java	13 Jan 2002 05:38:01 -0000	1.10
  @@ -13,6 +13,7 @@
   import org.apache.tools.ant.Task;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.PatternSet;
  +import org.apache.tools.ant.types.NameEntry;
   
   /**
    * This is an abstract task that should be used by all those tasks that require
  @@ -26,9 +27,9 @@
    * @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a>
    */
   
  -public abstract class MatchingTask extends Task
  +public abstract class MatchingTask
  +    extends Task
   {
  -
       protected boolean useDefaultExcludes = true;
       protected FileSet fileset = new FileSet();
   
  @@ -96,7 +97,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createExclude()
  +    public NameEntry createExclude()
           throws TaskException
       {
           return fileset.createExclude();
  @@ -107,7 +108,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createExcludesFile()
  +    public NameEntry createExcludesFile()
           throws TaskException
       {
           return fileset.createExcludesFile();
  @@ -118,7 +119,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createInclude()
  +    public NameEntry createInclude()
           throws TaskException
       {
           return fileset.createInclude();
  @@ -129,7 +130,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createIncludesFile()
  +    public NameEntry createIncludesFile()
           throws TaskException
       {
           return fileset.createIncludesFile();
  
  
  
  1.5       +3 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java
  
  Index: VAJExport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/optional/ide/VAJExport.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- VAJExport.java	13 Jan 2002 00:01:42 -0000	1.4
  +++ VAJExport.java	13 Jan 2002 05:38:01 -0000	1.5
  @@ -10,6 +10,7 @@
   import java.io.File;
   import org.apache.myrmidon.api.TaskException;
   import org.apache.tools.ant.types.PatternSet;
  +import org.apache.tools.ant.types.NameEntry;
   
   /**
    * Export packages from the Visual Age for Java workspace. The packages are
  @@ -143,7 +144,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createExclude()
  +    public NameEntry createExclude()
       {
           return patternSet.createExclude();
       }
  @@ -153,7 +154,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createInclude()
  +    public NameEntry createInclude()
       {
           return patternSet.createInclude();
       }
  
  
  
  1.8       +3 -2      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java
  
  Index: Chmod.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/taskdefs/unix/Chmod.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Chmod.java	12 Jan 2002 23:41:40 -0000	1.7
  +++ Chmod.java	13 Jan 2002 05:38:01 -0000	1.8
  @@ -15,6 +15,7 @@
   import org.apache.tools.ant.taskdefs.exec.Execute;
   import org.apache.tools.ant.types.FileSet;
   import org.apache.tools.ant.types.PatternSet;
  +import org.apache.tools.ant.types.NameEntry;
   
   /**
    * Chmod equivalent for unix-like environments.
  @@ -118,7 +119,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createExclude()
  +    public NameEntry createExclude()
           throws TaskException
       {
           defaultSetDefined = true;
  @@ -130,7 +131,7 @@
        *
        * @return Description of the Returned Value
        */
  -    public PatternSet.NameEntry createInclude()
  +    public NameEntry createInclude()
           throws TaskException
       {
           defaultSetDefined = true;
  
  
  
  1.14      +4 -4      jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java
  
  Index: FileSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/FileSet.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- FileSet.java	12 Jan 2002 23:56:33 -0000	1.13
  +++ FileSet.java	13 Jan 2002 05:38:01 -0000	1.14
  @@ -167,7 +167,7 @@
       /**
        * add a name entry on the exclude list
        */
  -    public PatternSet.NameEntry createExclude()
  +    public NameEntry createExclude()
       {
           return m_defaultPatterns.createExclude();
       }
  @@ -175,7 +175,7 @@
       /**
        * add a name entry on the include files list
        */
  -    public PatternSet.NameEntry createExcludesFile()
  +    public NameEntry createExcludesFile()
       {
           return m_defaultPatterns.createExcludesFile();
       }
  @@ -183,7 +183,7 @@
       /**
        * add a name entry on the include list
        */
  -    public PatternSet.NameEntry createInclude()
  +    public NameEntry createInclude()
       {
           return m_defaultPatterns.createInclude();
       }
  @@ -191,7 +191,7 @@
       /**
        * add a name entry on the include files list
        */
  -    public PatternSet.NameEntry createIncludesFile()
  +    public NameEntry createIncludesFile()
       {
           return m_defaultPatterns.createIncludesFile();
       }
  
  
  
  1.10      +1 -75     jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/PatternSet.java
  
  Index: PatternSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/PatternSet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- PatternSet.java	4 Jan 2002 09:26:42 -0000	1.9
  +++ PatternSet.java	13 Jan 2002 05:38:01 -0000	1.10
  @@ -206,7 +206,7 @@
        */
       private NameEntry addPatternToList( final ArrayList list )
       {
  -        final NameEntry result = new NameEntry();
  +        final NameEntry result = new NameEntry( this );
           list.add( result );
           return result;
       }
  @@ -338,78 +338,4 @@
           }
       }
   
  -    /**
  -     * inner class to hold a name on list. "If" and "Unless" attributes may be
  -     * used to invalidate the entry based on the existence of a property
  -     * (typically set thru the use of the Available task).
  -     */
  -    public class NameEntry
  -    {
  -        private String ifCond;
  -        private String name;
  -        private String unlessCond;
  -
  -        public void setIf( String cond )
  -        {
  -            ifCond = cond;
  -        }
  -
  -        public void setName( String name )
  -        {
  -            this.name = name;
  -        }
  -
  -        public void setUnless( String cond )
  -        {
  -            unlessCond = cond;
  -        }
  -
  -        public String getName()
  -        {
  -            return name;
  -        }
  -
  -        public String evalName( Project p )
  -        {
  -            return valid( p ) ? name : null;
  -        }
  -
  -        public String toString()
  -        {
  -            StringBuffer buf = new StringBuffer( name );
  -            if( ( ifCond != null ) || ( unlessCond != null ) )
  -            {
  -                buf.append( ":" );
  -                String connector = "";
  -
  -                if( ifCond != null )
  -                {
  -                    buf.append( "if->" );
  -                    buf.append( ifCond );
  -                    connector = ";";
  -                }
  -                if( unlessCond != null )
  -                {
  -                    buf.append( connector );
  -                    buf.append( "unless->" );
  -                    buf.append( unlessCond );
  -                }
  -            }
  -
  -            return buf.toString();
  -        }
  -
  -        private boolean valid( Project p )
  -        {
  -            if( ifCond != null && p.getProperty( ifCond ) == null )
  -            {
  -                return false;
  -            }
  -            else if( unlessCond != null && p.getProperty( unlessCond ) != null
)
  -            {
  -                return false;
  -            }
  -            return true;
  -        }
  -    }
   }
  
  
  
  1.1                  jakarta-ant/proposal/myrmidon/src/main/org/apache/tools/ant/types/NameEntry.java
  
  Index: NameEntry.java
  ===================================================================
  /*
   * 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.
   */
  package org.apache.tools.ant.types;
  
  import org.apache.tools.ant.Project;
  
  /**
   * inner class to hold a name on list. "If" and "Unless" attributes may be
   * used to invalidate the entry based on the existence of a property
   * (typically set thru the use of the Available task).
   */
  public class NameEntry
  {
      private String m_if;
      private String m_name;
      private String m_unless;
      private PatternSet m_set;
  
      public NameEntry( final PatternSet set )
      {
          m_set = set;
      }
  
      public void setIf( final String ifCondition )
      {
          m_if = ifCondition;
      }
  
      public void setName( final String name )
      {
          m_name = name;
      }
  
      public void setUnless( final String unlessCondition )
      {
          m_unless = unlessCondition;
      }
  
      public String evalName( Project p )
      {
          return valid( p ) ? m_name : null;
      }
  
      public String toString()
      {
          StringBuffer buf = new StringBuffer( m_name );
          if( ( m_if != null ) || ( m_unless != null ) )
          {
              buf.append( ":" );
              String connector = "";
  
              if( m_if != null )
              {
                  buf.append( "if->" );
                  buf.append( m_if );
                  connector = ";";
              }
              if( m_unless != null )
              {
                  buf.append( connector );
                  buf.append( "unless->" );
                  buf.append( m_unless );
              }
          }
  
          return buf.toString();
      }
  
      private boolean valid( Project p )
      {
          if( m_if != null && p.getProperty( m_if ) == null )
          {
              return false;
          }
          else if( m_unless != null && p.getProperty( m_unless ) != null )
          {
              return false;
          }
          else
          {
              return true;
          }
      }
  }
  
  
  

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