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.


Fields inherited from interface org.jutil.predicate.Predicate
CVS_REVISION
 
Constructor Summary
LocalDisk()
          Initialize a new LocalDisk.
LocalDisk(Predicate predicate)
          Initialize a new LocalDisk.
 
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 org.jutil.io.fileset.FilePredicate
eval
 
Methods inherited from class org.jutil.predicate.AbstractPredicate
count, equals, exists, filter, forall
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jutil.predicate.Predicate
count, equals, eval, exists, filter, forall
 
Methods inherited from interface org.jutil.java.collections.CollectionOperator
isValidElement
 

Constructor Detail

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());
Method Detail

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;