org.jutil.io.fileset
Class FileSet.FileVisitor

java.lang.Object
  |
  +--org.jutil.java.collections.RobustVisitor
        |
        +--org.jutil.io.fileset.FileSet.FileVisitor
All Implemented Interfaces:
CollectionOperator
Enclosing class:
FileSet

public abstract class FileSet.FileVisitor
extends RobustVisitor

A class of Visitors that operate on files, and can additionally perform a visit on all elements in its FileSet.


Inner classes inherited from class org.jutil.java.collections.RobustVisitor
RobustVisitor.Entry
 
Fields inherited from class org.jutil.java.collections.RobustVisitor
CVS_REVISION
 
Constructor Summary
FileSet.FileVisitor()
           
 
Method Summary
 void apply()
          Visit all Files in this FileSet.
 boolean isValidElement(java.lang.Object element)
          This model method is supplied to make proving the correctness of a subclass easier.
abstract  java.lang.Object visit(java.io.File file)
          Perform an action on the given File.
 java.lang.Object visit(java.lang.Object element)
          Apply visit(File) to the given object, which must be a File.
 
Methods inherited from class org.jutil.java.collections.RobustVisitor
applyTo, applyTo, applyTo, applyTo, unvisit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSet.FileVisitor

public FileSet.FileVisitor()
Method Detail

isValidElement

public boolean isValidElement(java.lang.Object element)
Description copied from interface: CollectionOperator

This model method is supplied to make proving the correctness of a subclass easier. It offers a tunnel for information the caller of methods that operate on the collection.

Most often, this information concerns the type of the elements and them not being null.

The algorithm does not use this method, so we will not force subclasses to implement it. A strengthened specification should be given to enable proving the correctness of a specific operator.

This is actually an abstract precondition as used in Eiffel.

Specifications:
     also
public behavior
ensures !(Object instanceof File) ==> (\result == false);

Specifications inherited from overridden method in interface CollectionOperator:
public behavior
ensures ( \forall Object o1; ; ( \forall Object o2; (o2 != null)&&o2.equals(o1); isValidElement(o1) == isValidElement(o2)));

visit

public final java.lang.Object visit(java.lang.Object element)
                             throws java.lang.Exception
Apply visit(File) to the given object, which must be a File.
Specifications inherited from overridden method in class RobustVisitor:
public behavior
requires isValidElement(element);
ensures (* Data which enables to undo what visit has done in unvisit is returned. *);
signals (Exception) (* Something went wrong while visiting <element>. *);

visit

public abstract java.lang.Object visit(java.io.File file)
                                throws java.lang.Exception
Perform an action on the given File.

Specifications:
public behavior
signals (Exception) !isValidElement(file);

Specifications inherited from overridden method in class RobustVisitor:
public behavior
requires isValidElement(element);
ensures (* Data which enables to undo what visit has done in unvisit is returned. *);
signals (Exception) (* Something went wrong while visiting <element>. *);

apply

public void apply()
           throws java.lang.Exception
Visit all Files in this FileSet.