ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types DestDir.java DestFile.java SrcDir.java SrcFile.java
Date Thu, 27 Dec 2001 05:25:10 GMT
stevel      01/12/26 21:25:09

  Modified:    src/main/org/apache/tools/ant/types DestDir.java
                        DestFile.java SrcDir.java SrcFile.java
  Log:
  added empty and file constructors, the latter validates as you go. Also a little IsUpToDate()
test for destdir which will should simplify dependency checking.
  
  Revision  Changes    Path
  1.2       +17 -2     jakarta-ant/src/main/org/apache/tools/ant/types/DestDir.java
  
  Index: DestDir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/DestDir.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DestDir.java	2001/12/25 19:30:26	1.1
  +++ DestDir.java	2001/12/27 05:25:09	1.2
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types;
   
   import java.io.File;
  +import org.apache.tools.ant.BuildException;
   
   /**
    * This wrapper class is used to represent Destination Directories.
  @@ -63,6 +64,20 @@
    */
   public final class DestDir extends ValidatedFileAttribute {
   
  +    /** 
  +     * empty constructor
  +     */
  +    public DestDir() {}
  +    
  +    
  +     /** 
  +     * file constructor; performs validation 
  +     * @param file the file to use
  +     */
  +    public DestDir(File file) throws BuildException {
  +        setFile(file);    
  +    }
  +    
       private String message = null;
   
       protected final String getMessage() {
  @@ -85,4 +100,4 @@
           }
           return true;
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.2       +43 -2     jakarta-ant/src/main/org/apache/tools/ant/types/DestFile.java
  
  Index: DestFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/DestFile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DestFile.java	2001/12/25 19:30:26	1.1
  +++ DestFile.java	2001/12/27 05:25:09	1.2
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types;
   
   import java.io.File;
  +import org.apache.tools.ant.BuildException;
   
   /**
    * This wrapper class is used to represent Destination Files.
  @@ -63,6 +64,21 @@
    */
   public final class DestFile extends ValidatedFileAttribute {
   
  +
  +    /** 
  +     * empty constructor
  +     */
  +    public DestFile() {}
  +    
  +    
  +     /** 
  +     * file constructor; performs validation 
  +     * @param file the file to use
  +     */
  +    public DestFile(File file) throws BuildException {
  +        setFile(file);    
  +    }
  +    
       private String message;
   
       protected final String getMessage() {
  @@ -84,5 +100,30 @@
               return false;
           }
           return true;
  +    }
  +    
  +    /**
  +     * test for the dest file being newer than the file passed in.
  +     * returns true iff the dest exists and is the same age or newer
  +     * @pre getFile()!=null && dependent!=null
  +     * @param dependent file we are dependent on
  +     * @return true iff we are up to date
  +     */
  +    public boolean isUpToDate(File dependent) {
  +      if(!getFile().exists())
  +          return false;
  +      return getFile().lastModified() >= dependent.lastModified();    
  +    }
  +    
  +    /**
  +     * test for the dest file being newer than the SrcFile passed in.
  +     * returns true iff the dest exists and is the same age or newer
  +     * @pre getFile()!=null  
  +     * @pre dependent!=null && depedent.getFile!=null;
  +     * @param dependent file we are dependent on
  +     * @return true iff we are up to date
  +     */
  +     public boolean isUpToDate(SrcFile dependent) {
  +        return isUpToDate(dependent.getFile());
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.2       +18 -3     jakarta-ant/src/main/org/apache/tools/ant/types/SrcDir.java
  
  Index: SrcDir.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/SrcDir.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SrcDir.java	2001/12/25 19:30:26	1.1
  +++ SrcDir.java	2001/12/27 05:25:09	1.2
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types;
   
   import java.io.File;
  +import org.apache.tools.ant.BuildException;
   
   /**
    * This wrapper class is used to represent Source(Origin) Directories.
  @@ -62,7 +63,21 @@
    * @author <a href="mailto:umagesh@apache.org">Magesh Umasankar</a>
    */
   public final class SrcDir extends ValidatedFileAttribute {
  -
  +    
  +    /** 
  +     * empty constructor
  +     */
  +    public SrcDir() {}
  +    
  +    
  +     /** 
  +     * file constructor; performs validation 
  +     * @param file the file to use
  +     */
  +    public SrcDir(File file) throws BuildException {
  +        setFile(file);    
  +    }
  +    
       private String message;
   
       protected final String getMessage() {
  @@ -89,4 +104,4 @@
           }
           return true;
       }
  -}
  \ No newline at end of file
  +}
  
  
  
  1.2       +17 -2     jakarta-ant/src/main/org/apache/tools/ant/types/SrcFile.java
  
  Index: SrcFile.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/SrcFile.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SrcFile.java	2001/12/25 19:30:26	1.1
  +++ SrcFile.java	2001/12/27 05:25:09	1.2
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -55,6 +55,7 @@
   package org.apache.tools.ant.types;
   
   import java.io.File;
  +import org.apache.tools.ant.BuildException;
   
   /**
    * This wrapper class is used to represent Source(Origin) Files.
  @@ -63,6 +64,20 @@
    */
   public final class SrcFile extends ValidatedFileAttribute {
   
  +    /** 
  +     * empty constructor
  +     */
  +    public SrcFile() {}
  +    
  +    
  +     /** 
  +     * file constructor; performs validation 
  +     * @param file the file to use
  +     */
  +    public SrcFile(File file) throws BuildException {
  +        setFile(file);    
  +    }
  +    
       private String message;
   
       protected final String getMessage() {
  @@ -89,4 +104,4 @@
           }
           return true;
       }
  -}
  \ No newline at end of file
  +}
  
  
  

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