org.pz.platypus
Class FileList

java.lang.Object
  extended by org.pz.platypus.FileList

public class FileList
extends java.lang.Object

A simple treemap containing the name of the input files that were read. This is useful in situations where the principal Platypus file includes other files (via the [include:filename] command. In certain listings, we refer to the files by their number for brevity. This FileList is the list of those files, their number is the key in the tree, their name the value. 0 is always null, so that the first file in the tree is numbered 1.

Author:
alb

Field Summary
private  java.util.TreeMap<java.lang.Integer,java.lang.String> filenames
          the array containing the filenames
private  int next
          the next number of a file
 
Constructor Summary
FileList()
           
 
Method Summary
 int addFilename(java.lang.String newFilename)
          Add the filename to the table.
 java.lang.String getFilename(int fileNumber)
          Find the file name based on the number it was assigned
 int getFileNumber(java.lang.String filename)
          Find the file number based on the name
 int getSize()
          get number of files stored
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filenames

private final java.util.TreeMap<java.lang.Integer,java.lang.String> filenames
the array containing the filenames


next

private int next
the next number of a file

Constructor Detail

FileList

public FileList()
Method Detail

addFilename

public int addFilename(java.lang.String newFilename)
                throws FilenameLookupException
Add the filename to the table. First check that it's not null; and that the filename is not already in the list Then add the filename.

Parameters:
newFilename - name of file to add
Returns:
the filenumber, or Status.INVALID_FILENAME if an error occurs
Throws:
FilenameLookupException - technically, this routine cannot throw this exception

getFilename

public java.lang.String getFilename(int fileNumber)
                             throws FilenameLookupException
Find the file name based on the number it was assigned

Parameters:
fileNumber - the number of the file in the array
Returns:
the filename
Throws:
FilenameLookupException - if the fileNumber does not correspond to a filename

getFileNumber

public int getFileNumber(java.lang.String filename)
                  throws FilenameLookupException
Find the file number based on the name

Parameters:
filename - to get the number for in the tree
Returns:
the number
Throws:
FilenameLookupException - if filename is not in list

getSize

public int getSize()
get number of files stored

Returns:
the number of files stored in the tree


Copyright © 2008-10 Pacific Data Works LLC