sofya.mutator
Class FileWriterMutationTable

java.lang.Object
  extended by sofya.mutator.MutationTable
      extended by sofya.mutator.FileWriterMutationTable

public class FileWriterMutationTable
extends MutationTable

A mutation table that writes mutations to file as they are received.

Version:
10/03/2005
Author:
Alex Kinneer

Constructor Summary
FileWriterMutationTable(java.lang.String outputName)
          Creates a new mutation table.
FileWriterMutationTable(java.lang.String outputName, StringTable st)
          Creates a new mutation table.
 
Method Summary
 boolean addMutation(Mutation m)
          Adds a mutation to this mutation table.
 void close()
          Closes the underlying file containing the mutation table; this method must be called to successfully commit the mutation table to file!
 StringTable getStringTable()
          Gets the string table that may be used to compact strings in the mutation table (optional operation).
 java.util.Iterator iterator()
          Unsupported operation.
 int size()
          Gets the size of this mutation table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileWriterMutationTable

public FileWriterMutationTable(java.lang.String outputName)
                        throws java.io.IOException
Creates a new mutation table.

Parameters:
outputName - Name of the file to which the mutation table will be written.
Throws:
java.io.IOException

FileWriterMutationTable

public FileWriterMutationTable(java.lang.String outputName,
                               StringTable st)
                        throws java.io.IOException
Creates a new mutation table.

Parameters:
outputName - Name of the file to which the mutation table will be written.
st - String table to be used/extended as the mutation table is written. This provides persistence of the string encodings if this mutation table was previously read from file.
Throws:
java.io.IOException
Method Detail

addMutation

public boolean addMutation(Mutation m)
Description copied from class: MutationTable
Adds a mutation to this mutation table.

Specified by:
addMutation in class MutationTable
Parameters:
m - Mutation to be added to this table.
Returns:
true if the mutation was successfully added to this table.

iterator

public java.util.Iterator iterator()
Unsupported operation. It is not possible to iterate over the mutations while the mutation table is still in the process of being written.

Specified by:
iterator in class MutationTable
Returns:
An iterator over the mutations in this mutation table.

size

public int size()
Description copied from class: MutationTable
Gets the size of this mutation table.

Specified by:
size in class MutationTable
Returns:
The number of mutations stored in this mutation table.

getStringTable

public StringTable getStringTable()
Description copied from class: MutationTable
Gets the string table that may be used to compact strings in the mutation table (optional operation).

In some situations, this method assists in supporting persistence between file reads and writes. Implementations that do not wish to support this functionality should return null.

Specified by:
getStringTable in class MutationTable
Returns:
The string table used to compact strings in the mutation table.

close

public void close()
           throws java.io.IOException
Closes the underlying file containing the mutation table; this method must be called to successfully commit the mutation table to file!

Throws:
java.io.IOException - If there is a stored error that was raised while attempting to write a mutation to the file.