calhoun.analysis.crf.io
Class InterleavedInputComponentBase

java.lang.Object
  extended by calhoun.analysis.crf.io.InterleavedInputComponentBase
All Implemented Interfaces:
InputComponentIO, InterleavedInputComponent, java.io.Serializable
Direct Known Subclasses:
BooleanInput, IntervalInput, IntInput, MultipleAlignmentInput, NameInput, StringInput

public abstract class InterleavedInputComponentBase
extends java.lang.Object
implements InterleavedInputComponent

base class for InterleavedInputComponents. Implements the read and write methods from InputComponentIO by calling the Reader and Writer based methods of InterleavedInputComponent. This allows an InterleavedInputComponent to implement just the reader and writer methods but be usable in any input handler.

Also implements a name field. The name is the name of the input sequence which will be read and written by the input component. This is the name that will identify the returned input sequence as part of a composite input. The name defaults to "default".

See Also:
Serialized Form

Constructor Summary
InterleavedInputComponentBase()
           
 
Method Summary
 java.util.List<java.lang.String> getComponentNames()
          returns the name of this component
 java.lang.String getName()
          the name of the input sequence read and written by this component
 void readInputSequences(java.lang.String location, java.util.List<java.util.Map<java.lang.String,InputSequence<?>>> inputs)
          reads input sequences from this location.
 void setName(java.lang.String name)
          sets the name of the input sequence read and written by this component
 void writeInputSequences(java.lang.String location, java.util.List<? extends java.util.Map<java.lang.String,? extends InputSequence<?>>> inputComponents)
          writes input sequences to this location.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface calhoun.analysis.crf.io.InterleavedInputComponent
read, write
 

Constructor Detail

InterleavedInputComponentBase

public InterleavedInputComponentBase()
Method Detail

getComponentNames

public java.util.List<java.lang.String> getComponentNames()
returns the name of this component

Specified by:
getComponentNames in interface InputComponentIO
Returns:
name of the input sequence read by this component

getName

public java.lang.String getName()
the name of the input sequence read and written by this component

Returns:
returns the name for the input sequence this component reads and writes

setName

public void setName(java.lang.String name)
sets the name of the input sequence read and written by this component

Parameters:
name - the name for the input sequence this component reads and writes

readInputSequences

public void readInputSequences(java.lang.String location,
                               java.util.List<java.util.Map<java.lang.String,InputSequence<?>>> inputs)
                        throws java.io.IOException
Description copied from interface: InputComponentIO
reads input sequences from this location. In most cases the location will be a file and this object will read in one or more components of the overall input from that file. Alist of inputs is returned. Each input consists of a set of key-value pairs, where the key is the name of the input component and the value is an (@link InputSequence) object. If this is not the first component to be loaded, this list may already contain entries for the input.

Specified by:
readInputSequences in interface InputComponentIO
Parameters:
location - the location of the data to read. Meaning of the location is implementation dependent, but will usually be a file name.
inputs - a list of input sequences. For each input sequence, a map is returned that maps component names to their associated InputSequence objects.
Throws:
java.io.IOException

writeInputSequences

public void writeInputSequences(java.lang.String location,
                                java.util.List<? extends java.util.Map<java.lang.String,? extends InputSequence<?>>> inputComponents)
                         throws java.io.IOException
Description copied from interface: InputComponentIO
writes input sequences to this location. InputComponentIO optionally can implement this function to provide the ability to write input data as well as read it. This is used by many of the data manipulation tools, such as those for subsetting and creating cross-validation sets.

Specified by:
writeInputSequences in interface InputComponentIO
Parameters:
location - the location of the data to write. Meaning of the location is implementation dependent, but will usually be a file name.
inputComponents - an iterator over input sequences. For each input sequence, a map is returned that maps component names to their associated InputSequence objects. All components of the input are passed, and this object is reponsible for knowing which components it should be writing.
Throws:
java.io.IOException