git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@270384 13f79535-47bb-0310-9956-ffa450edef68master
| @@ -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 @@ import java.io.File; | |||
| */ | |||
| 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 @@ public final class DestDir extends ValidatedFileAttribute { | |||
| } | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| @@ -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 @@ import java.io.File; | |||
| */ | |||
| 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() { | |||
| @@ -85,4 +101,29 @@ public final class DestFile extends ValidatedFileAttribute { | |||
| } | |||
| 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()); | |||
| } | |||
| } | |||
| @@ -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 @@ import java.io.File; | |||
| * @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 @@ public final class SrcDir extends ValidatedFileAttribute { | |||
| } | |||
| return true; | |||
| } | |||
| } | |||
| } | |||
| @@ -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 @@ import java.io.File; | |||
| */ | |||
| 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 @@ public final class SrcFile extends ValidatedFileAttribute { | |||
| } | |||
| return true; | |||
| } | |||
| } | |||
| } | |||