From d05bb8fd8488bf667aaab06511ac61b82bcd2d16 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Mon, 2 Aug 2010 14:28:15 +0200 Subject: [PATCH] Step. --- src/fr/devinsy/util/FileIterator.java | 49 ++++++++++++++++++++-- src/fr/devinsy/util/FileIteratorState.java | 2 +- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/src/fr/devinsy/util/FileIterator.java b/src/fr/devinsy/util/FileIterator.java index 244bba0..af6e293 100644 --- a/src/fr/devinsy/util/FileIterator.java +++ b/src/fr/devinsy/util/FileIterator.java @@ -1,6 +1,7 @@ package fr.devinsy.util; import java.io.File; + import java.util.Iterator; import java.util.Vector; import java.util.regex.Pattern; @@ -240,7 +241,8 @@ public class FileIterator extends Vector implements Iterator< static public boolean isLink(File file) throws Exception { boolean result; - if (file.getCanonicalPath().equals(file.getAbsolutePath())) + + if ((file.exists()) && (file.getCanonicalPath().equals(file.getAbsolutePath()))) { result = false; } @@ -390,8 +392,7 @@ public class FileIterator extends Vector implements Iterator< int result; result = 0; - File f; - while ((f = this.next()) != null) + while (this.next() != null) { result += 1; } @@ -401,6 +402,48 @@ public class FileIterator extends Vector implements Iterator< } + /** + * + */ + public int fileFinalCountdown() + { + int result; + + result = 0; + while (this.hasNext()) + { + if (!this.next().isDirectory()) + { + result += 1; + } + } + + // + return(result); + } + + + /** + * + */ + public int directoryFinalCountdown() + { + int result; + + result = 0; + while (this.hasNext()) + { + if (this.next().isDirectory()) + { + result += 1; + } + } + + // + return(result); + } + + /** * */ diff --git a/src/fr/devinsy/util/FileIteratorState.java b/src/fr/devinsy/util/FileIteratorState.java index b3457b1..58f9b9f 100644 --- a/src/fr/devinsy/util/FileIteratorState.java +++ b/src/fr/devinsy/util/FileIteratorState.java @@ -6,7 +6,7 @@ import java.util.regex.Pattern; /** - * + * Used by FileIterator class. */ public class FileIteratorState implements Iterator {