TreeMap Java Library

treemap.demo
Class TMFileSizeDate

java.lang.Object
  extended by treemap.demo.TMFileSizeDate
All Implemented Interfaces:
TMComputeSize

public class TMFileSizeDate
extends java.lang.Object
implements TMComputeSize

The TMFileSizeDate class implements an example of a TMComputeSize for a TMFileNode. It use the date of the file as a size.

Version:
2.5
Author:
Christophe Bouthier [bouthier@loria.fr]

Constructor Summary
TMFileSizeDate()
          Constructor.
 
Method Summary
 float getSize(TMNode node)
          Returns the size of the node.
 boolean isCompatibleWith(TMNode node)
          Test if this TMComputeSize could be used with the kind of TMNode passed in parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TMFileSizeDate

public TMFileSizeDate()
Constructor.

Method Detail

isCompatibleWith

public boolean isCompatibleWith(TMNode node)
Test if this TMComputeSize could be used with the kind of TMNode passed in parameter.

Specified by:
isCompatibleWith in interface TMComputeSize
Parameters:
node - the TMNode to test the compatibility with
Returns:
true if this kind of node is compatible; false otherwise

getSize

public float getSize(TMNode node)
              throws TMExceptionBadTMNodeKind
Returns the size of the node. The node should be an instance of TMFileNode. Returns 0 for a folder, and the date of the file, for a file.

Specified by:
getSize in interface TMComputeSize
Parameters:
node - we compute the size of this node; should be an instance of TMFileNode
Returns:
the size of the node; 0 for a folder; the date of the file for a file
Throws:
TMExceptionBadTMNodeKind - If the node is not an instance of TMFileNode

TreeMap Java Library

TreeMap Java Library - www.bouthier.net - treemap.sf.net - 2001