org.jutil.io.fileset
Class LocalDisk
java.lang.Object
|
+--org.jutil.predicate.AbstractPredicate
|
+--org.jutil.io.fileset.FilePredicate
|
+--org.jutil.io.fileset.LocalDisk
- All Implemented Interfaces:
- CollectionOperator, FileSetPredicate, Predicate
- public class LocalDisk
- extends FilePredicate
- implements FileSetPredicate
A file predicate that includes all files on local disks.
Think twice before using this, traversing the entire filesystem
isn't worlds most efficient operation.
|
Method Summary |
boolean |
enterDirectory(java.io.File directory)
Check whether or not the given directory can contain
files which make this predicate evaluate to true. |
boolean |
evalFile(java.io.File file)
|
Predicate |
getPredicate()
|
java.util.List |
getSubPredicates()
Return the subpredicates of this Predicate. |
int |
nbSubPredicates()
Return the size of this Predicate. |
java.util.List |
suggestDirectories()
Suggest a list of directories which can contain files that
will evaluate to true for this FilePredicate.
All files that can make this FilePredicate true will
be in one of the returned directories. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LocalDisk
public LocalDisk()
- Initialize a new LocalDisk.
- Specifications:
-
public behavior
ensures getPredicate().equals(new True());
LocalDisk
public LocalDisk(Predicate predicate)
- Initialize a new LocalDisk.
- Specifications:
-
public behavior
ensures getPredicate().equals(new True());
evalFile
public boolean evalFile(java.io.File file)
- Specifications:
- also
-
public behavior
ensures \result == (file != null);
- Specifications inherited from overridden method in class FilePredicate:
-
public behavior
requires file != null;
ensures \result == true|\result == false;
suggestDirectories
public java.util.List suggestDirectories()
- Description copied from interface:
FileSetPredicate
Suggest a list of directories which can contain files that
will evaluate to true for this FilePredicate.
All files that can make this FilePredicate true will
be in one of the returned directories.
- Specifications:
- also
-
public behavior
ensures \fresh(\result );
ensures ( \forall Object o; \result .contains(o); o instanceof File);
ensures \result .size() == Arrays.asList(File.listRoots()).size();
ensures \result .containsAll(Arrays.asList(File.listRoots()));
- Specifications inherited from overridden method in interface FileSetPredicate:
-
public behavior
ensures \result != null;
ensures ( \forall Object o; Collections.containsExplicitly(\result ,o); (o instanceof File)&&((File)o).isDirectory());
enterDirectory
public boolean enterDirectory(java.io.File directory)
- Description copied from interface:
FileSetPredicate
- Check whether or not the given directory can contain
files which make this predicate evaluate to
true.
- Specifications:
- also
-
public behavior
ensures \result == true;
- Specifications inherited from overridden method in interface FileSetPredicate:
-
public behavior
requires directory != null;
ensures \result == true|\result == false;
nbSubPredicates
public int nbSubPredicates()
- Description copied from interface:
Predicate
- Return the size of this Predicate.
- Specifications:
- also
-
public behavior
ensures \result == 1;
- Specifications inherited from overridden method in class AbstractPredicate:
--- None ---
- Specifications inherited from overridden method in interface Predicate:
-
public behavior
ensures \result == getSubPredicates().size();
getSubPredicates
public java.util.List getSubPredicates()
- Description copied from interface:
Predicate
- Return the subpredicates of this Predicate.
- Specifications:
- also
-
public behavior
ensures \result .contains(getPredicate());
ensures \result .size() == 1;
- Specifications inherited from overridden method in interface Predicate:
-
public behavior
ensures \result != null;
ensures !\result .contains(null);
ensures !\result .contains(this);
getPredicate
public Predicate getPredicate()
- Specifications:
-
public behavior
ensures \result != null;