calhoun.analysis.crf.io
Interface InputSequence<A>

All Known Implementing Classes:
InputSequenceBoolean, InputSequenceCharacter, InputSequenceComposite, InputSequenceInt, InputSequenceObject, IntervalInputSequence, MultipleAlignmentInputSequence, NameInputSequence, TrainingSequence

public interface InputSequence<A>

represents the observed inputs. Contains a sequence of inputs, and allows them to be retrieved by position.

An input sequence may be made up of different components. If it contains components the getComponent(java.lang.String) and listComponents() functions must be implemented. Otherwise they can just trhow UnsupportedOperationException.

In some cases, the input may not be a sequence. It may be a single input value that is returned for all positions. In this case, the length value can return -1 and the getX(int) function can return the same object at each position.


Method Summary
 InputSequence<?> getComponent(java.lang.String name)
          For input sequences that are a composite of several different input objects, returns a particular component of the input.
 A getX(int x)
          retrieves the input value at a position in the input sequence.
 int length()
          Returns the length of this sequence
 java.util.Collection<java.lang.String> listComponents()
          For input sequences that are a composite of several different input objects, returns a list of the names of the components in this input sequence.
 InputSequence<A> subSequence(int start, int end)
          tTakes a subinterval of the input sequence with given start-end coordinates which are relative coordinates, 1-based, and inclusive.
 

Method Detail

getX

A getX(int x)
retrieves the input value at a position in the input sequence.

Parameters:
x - the index position at which to get the input. This is a zero-based index.
Returns:
the object at this position in the input.

length

int length()
Returns the length of this sequence

Returns:
length

subSequence

InputSequence<A> subSequence(int start,
                             int end)
tTakes a subinterval of the input sequence with given start-end coordinates which are relative coordinates, 1-based, and inclusive. Thus 1-10 will mean returning a new InputSequence which is the first 10 positions of the current one.

An implementation that does not support subsetting should throw an UnsupportedOperationException

Parameters:
start - the 1-based index of the first position of the input to retrieve.
end - the 1-based index of the last position of the input to retrieve.
Returns:
an input sequence which is a sbusequence of the original sequence.

getComponent

InputSequence<?> getComponent(java.lang.String name)
For input sequences that are a composite of several different input objects, returns a particular component of the input. For simple input sequences that just return an object, this method should throw UnsupportedOperationException.

Parameters:
name - the name of the input component to return
Returns:
the input sequence representing this component

listComponents

java.util.Collection<java.lang.String> listComponents()
For input sequences that are a composite of several different input objects, returns a list of the names of the components in this input sequence. For simple input sequences that just return an object, this method should throw UnsupportedOperationException.

Returns:
a collection containing the component names