TreeMap Java Library

treemap.demo
Class TMFileSize

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

public class TMFileSize
extends java.lang.Object
implements TMComputeSize

The TMFileSize class implements an example of a TMComputeSize for a TMFileNode.

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

Constructor Summary
TMFileSize()
           
 
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

TMFileSize

public TMFileSize()
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 size of the file, in byte, 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 size of the file in byte 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