ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh Directory.java
Date Fri, 08 Jul 2005 13:35:50 GMT
peterreilly    2005/07/08 06:35:50

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/ssh
                        Directory.java
  Log:
  javadoc
  
  Revision  Changes    Path
  1.6       +70 -1     ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java
  
  Index: Directory.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Directory.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Directory.java	9 Feb 2004 21:05:34 -0000	1.5
  +++ Directory.java	8 Jul 2005 13:35:50 -0000	1.6
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2003-2004 The Apache Software Foundation
  + * Copyright  2003-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -22,6 +22,9 @@
   import java.util.StringTokenizer;
   import java.io.File;
   
  +/**
  + * A helper object for Scp representing a directory in a file system.
  + */
   public class Directory {
   
       private File directory;
  @@ -29,10 +32,19 @@
       private ArrayList files;
       private Directory parent;
   
  +    /**
  +     * Constructor for a Directory.
  +     * @param directory a directory.
  +     */
       public Directory(File directory) {
           this(directory,  null);
       }
   
  +    /**
  +     * Constructor for a Directory.
  +     * @param directory a directory
  +     * @param parent    a parent Directory
  +     */
       public Directory(File directory , Directory parent) {
           this.parent = parent;
           this.childDirectories = new ArrayList();
  @@ -40,36 +52,69 @@
           this.directory = directory;
       }
   
  +    /**
  +     * Add a directory to the child directories.
  +     * @param directory a Directory
  +     */
       public void addDirectory(Directory directory) {
           if (!childDirectories.contains(directory)) {
               childDirectories.add(directory);
           }
       }
   
  +    /**
  +     * Add a file to the list of files.
  +     * @param file a file to add
  +     */
       public void addFile(File file) {
           files.add(file);
       }
   
  +    /**
  +     * Get an iterator over the child Directories.
  +     * @return an iterator
  +     */
       public Iterator directoryIterator() {
           return childDirectories.iterator();
       }
   
  +    /**
  +     * Get an iterator over the files.
  +     * @return an iterator
  +     */
       public Iterator filesIterator() {
           return files.iterator();
       }
   
  +    /**
  +     * Get the parent Directory.
  +     * @return the parent Directory.
  +     */
       public Directory getParent() {
           return parent;
       }
   
  +    /**
  +     * Is this a root Directory?
  +     * @return true if there is no parent Directory
  +     */
       public boolean isRoot() {
           return parent == null;
       }
   
  +    /**
  +     * Get the directory file.
  +     * @return the directory file
  +     */
       public File getDirectory() {
           return directory;
       }
   
  +    /**
  +     * Get a child directory of this directory.
  +     * @param dir the directory to look for
  +     * @return the child directory, or null if not found
  +     */
       public Directory getChild(File dir) {
           for (int i = 0; i < childDirectories.size(); i++) {
               Directory current = (Directory) childDirectories.get(i);
  @@ -81,6 +126,12 @@
           return null;
       }
   
  +    /**
  +     * The equality method.
  +     * This checks if the directory field is the same.
  +     * @param obj the object to compare to
  +     * @return true if this object has an equal directory field as the other object
  +     */
       public boolean equals(Object obj) {
           if (obj == this) {
               return true;
  @@ -95,14 +146,28 @@
           return this.directory.equals(d.directory);
       }
   
  +    /**
  +     * The hashcode method.
  +     * @return the hash code of the directory field
  +     */
       public int hashCode() {
           return directory.hashCode();
       }
   
  +    /**
  +     * Get the path components of this directory.
  +     * @return the path components as an array of strings.
  +     */
       public String[] getPath() {
           return getPath(directory.getAbsolutePath());
       }
   
  +    /**
  +     * Convert a file path to an array of path components.
  +     * This uses File.sepatator to split the file path string.
  +     * @param thePath the file path string to convert
  +     * @return an array of path components
  +     */
       public static String[] getPath(String thePath) {
           StringTokenizer tokenizer = new StringTokenizer(thePath,
                   File.separator);
  @@ -117,6 +182,10 @@
           return path;
       }
   
  +    /**
  +     * Get the number of files in the files attribute.
  +     * @return the number of files
  +     */
       public int fileSize() {
           return files.size();
       }
  
  
  

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


Mime
View raw message