Copyright 2012-02-25 Werner Randelshofer

ch.randelshofer.io
Class AcceptAllFileFilter

java.lang.Object
  extended by javax.swing.filechooser.FileFilter
      extended by ch.randelshofer.io.AcceptAllFileFilter
All Implemented Interfaces:
java.lang.Comparable

public class AcceptAllFileFilter
extends javax.swing.filechooser.FileFilter
implements java.lang.Comparable

A file filter that accepts all files.

Version:
1.0 2002-02-12
Author:
Werner Randelshofer

Constructor Summary
AcceptAllFileFilter(java.lang.String description)
          Creates a new instance of AcceptAllFileFilter.
 
Method Summary
 boolean accept(java.io.File f)
          Whether the given file is accepted by this filter.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Returns true when the given object is of the same type and its description is equal.
 java.lang.String getDescription()
          The description of this filter.
 int hashCode()
          Returns a hash code derived from the description of this file filter.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptAllFileFilter

public AcceptAllFileFilter(java.lang.String description)
Creates a new instance of AcceptAllFileFilter.

Parameters:
description - The description of the filter.
Method Detail

accept

public boolean accept(java.io.File f)
Whether the given file is accepted by this filter.

Specified by:
accept in class javax.swing.filechooser.FileFilter
Returns:
Returns allways true.

getDescription

public java.lang.String getDescription()
The description of this filter.

Specified by:
getDescription in class javax.swing.filechooser.FileFilter
See Also:
FileView.getName(java.io.File)

compareTo

public int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)

The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.

Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.

It is strongly recommended, but not strictly required that (x.compareTo(y)==0) == (x.equals(y)). Generally speaking, any class that implements the Comparable interface and violates this condition should clearly indicate this fact. The recommended language is "Note: this class has a natural ordering that is inconsistent with equals."

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this Object.

equals

public boolean equals(java.lang.Object o)
Returns true when the given object is of the same type and its description is equal.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Returns a hash code derived from the description of this file filter.

Overrides:
hashCode in class java.lang.Object

Copyright 2012-02-25 Werner Randelshofer