peersim.util
Class FileNameGenerator

java.lang.Object
  extended by peersim.util.FileNameGenerator

public class FileNameGenerator
extends java.lang.Object

Generates a series of filenames for classes that have to save e.g. snapshots regularly.


Field Summary
 java.lang.String ext
          The extension of the filename
 java.lang.String prefix
          The prefix of the filename
 
Constructor Summary
FileNameGenerator(java.lang.String prefix, java.lang.String ext)
           
 
Method Summary
 java.lang.String nextCounterName()
          Generates a name based on a counter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefix

public final java.lang.String prefix
The prefix of the filename


ext

public final java.lang.String ext
The extension of the filename

Constructor Detail

FileNameGenerator

public FileNameGenerator(java.lang.String prefix,
                         java.lang.String ext)
Parameters:
prefix - all returned names will be prefixed by this
ext - will be appended to all returned names
Method Detail

nextCounterName

public java.lang.String nextCounterName()
Generates a name based on a counter. The format of the name returned is prefix followed by an 8 digit zero padded number, followed by ext. The first number used is zero.

Returns:
the next filename after increasing the counter