Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

samples.filefind
Class FileProperties  view FileProperties download FileProperties.java

java.lang.Object
  extended bysamples.filefind.FileProperties
All Implemented Interfaces:
java.lang.Comparable

public class FileProperties
extends java.lang.Object
implements java.lang.Comparable

Not a BasicModel because doesn't need to implement ModelChangeEventSource since immutable.

Version:
$Revision: 1.3 $ $Date: 2002/01/12 09:35:41 $

Field Summary
private  java.util.Date lastModified
           
private  long length
           
private  java.lang.String name
           
private  java.lang.String path
           
private  java.lang.String suffix
           
 
Constructor Summary
FileProperties(java.io.File f)
           
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with another, and returns a numerical result based on the comparison.
 java.util.Date getLastModified()
           
 long getLength()
           
 java.lang.String getName()
           
 java.lang.String getPath()
           
 java.lang.String getSuffix()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name

length

private long length

lastModified

private java.util.Date lastModified

suffix

private java.lang.String suffix

path

private java.lang.String path
Constructor Detail

FileProperties

public FileProperties(java.io.File f)
Method Detail

getName

public java.lang.String getName()

getLength

public long getLength()

getSuffix

public java.lang.String getSuffix()

getLastModified

public java.util.Date getLastModified()

getPath

public java.lang.String getPath()

compareTo

public int compareTo(java.lang.Object o)
Description copied from interface: java.lang.Comparable
Compares this object with another, and returns a numerical result based on the comparison. If the result is negative, this object sorts less than the other; if 0, the two are equal, and if positive, this object sorts greater than the other. To translate this into boolean, simply perform o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.

You must make sure that the comparison is mutual, ie. sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) (where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence, compareTo(null) should always throw an Exception.

You should also ensure transitivity, in two forms: x.compareTo(y) > 0 && y.compareTo(z) > 0 implies x.compareTo(z) > 0; and x.compareTo(y) == 0 implies x.compareTo(z) == y.compareTo(z).

Specified by:
compareTo in interface java.lang.Comparable