InputType - The type for the input object in the pair.OutputType - The type for the output object in the pair.public class DefaultInputOutputPair<InputType,OutputType> extends AbstractInputOutputPair<InputType,OutputType>
InputOutputPair interface. It stores
a pointer to the input and output objects that make up the pair.| Constructor and Description |
|---|
DefaultInputOutputPair()
Creates a new
DefaultInputOutputPair with both the input and
output as null. |
DefaultInputOutputPair(InputType input,
OutputType output)
Creates a new
DefaultInputOutputPair with the given input and
output. |
DefaultInputOutputPair(Pair<? extends InputType,? extends OutputType> pair)
Creates a new
DefaultInputOutputPair using the first element of
the given pair as the input and the second element of the given pair as
the output. |
| Modifier and Type | Method and Description |
|---|---|
static <InputType,OutputType> |
create()
Convenience method to create a new
DefaultInputOutputPair. |
static <InputType,OutputType> |
create(InputType input,
OutputType output)
Convenience method to create a new
DefaultInputOutputPair. |
InputType |
getInput()
Gets the input.
|
OutputType |
getOutput()
Gets the output.
|
static <InputType,OutputType> |
labelCollection(java.util.Collection<InputType> inputs,
OutputType output)
Takes a collection of input values and a single output value and creates
a new collection of default input output pairs with each of the given
inputs and the given output.
|
static <InputType,OutputType> |
mergeCollections(java.util.Collection<InputType> inputs,
java.util.Collection<OutputType> outputs)
Takes two collections of data of equal size and creates a single
ArrayList of InputOutputPairs out of them.
|
void |
setInput(InputType input)
Sets the input.
|
void |
setOutput(OutputType output)
Sets the output.
|
getFirst, getSecond, toStringclonepublic DefaultInputOutputPair()
DefaultInputOutputPair with both the input and
output as null.public DefaultInputOutputPair(InputType input, OutputType output)
DefaultInputOutputPair with the given input and
output.input - The input to store.output - The output to store.public DefaultInputOutputPair(Pair<? extends InputType,? extends OutputType> pair)
DefaultInputOutputPair using the first element of
the given pair as the input and the second element of the given pair as
the output.pair - The pair to get the input and output from.public InputType getInput()
InputOutputPairpublic void setInput(InputType input)
input - The new input.public OutputType getOutput()
InputOutputPairpublic void setOutput(OutputType output)
output - The new output.public static <InputType,OutputType> DefaultInputOutputPair<InputType,OutputType> create()
DefaultInputOutputPair.InputType - The type for the input object in the pair.OutputType - The type for the output object in the pair.public static <InputType,OutputType> DefaultInputOutputPair<InputType,OutputType> create(InputType input, OutputType output)
DefaultInputOutputPair.InputType - The type for the input object in the pair.OutputType - The type for the output object in the pair.input - The input.output - The output.public static <InputType,OutputType> java.util.ArrayList<DefaultInputOutputPair<InputType,OutputType>> mergeCollections(java.util.Collection<InputType> inputs, java.util.Collection<OutputType> outputs)
InputType - The type of the input.OutputType - The type of the output.inputs - A collection of the data to transform into the input element of the
pair. Must have the same number of elements as outputs.outputs - A collection of data to transform into the output element of the
pair. Must have the same number of elements as inputs.ArrayList<InputOutputPair> of the same size as the
two given collections where the input is from the first collection
and output is from the second.public static <InputType,OutputType> java.util.ArrayList<DefaultInputOutputPair<InputType,OutputType>> labelCollection(java.util.Collection<InputType> inputs, OutputType output)
InputType - The type of the input.OutputType - The type of the output.inputs - A collection of the data to transform into the input element of the
pair.output - The value to use as the output element of the pair. (The label)ArrayList<InputOutputPair> of the same size as the
input collection where the inputs are from the given collection and
outputs are all the given value.