public final class ListOfOutputs<T> extends Outputs<Object>
Builder.add(IntsRef,Object) multiple
times. The builder will then combine the outputs using
the Outputs.merge(Object,Object) method.
The resulting FST may not be minimal when an input has more than one output, as this requires pushing all multi-output values to a final state.
NOTE: the only way to create multiple outputs is to
add the same input to the FST multiple times in a row. This is
how the FST maps a single input to multiple outputs (e.g. you
cannot pass a List<Object> to Builder.add(org.apache.lucene.util.IntsRef, T)). If
your outputs are longs, and you need at most 2, then use
UpToTwoPositiveIntOutputs instead since it stores
the outputs more compactly (by stealing a bit from each
long value).
NOTE: this cannot wrap itself (ie you cannot make an FST with List<List<Object>> outputs using this).
| Constructor and Description |
|---|
ListOfOutputs(Outputs<T> outputs) |
| Modifier and Type | Method and Description |
|---|---|
Object |
add(Object prefix,
Object output)
Eg add("foo", "bar") -> "foobar"
|
List<T> |
asList(Object output) |
Object |
common(Object output1,
Object output2)
Eg common("foobar", "food") -> "foo"
|
Object |
getNoOutput()
NOTE: this output is compared with == so you must
ensure that all methods return the single object if
it's really no output
|
Object |
merge(Object first,
Object second) |
String |
outputToString(Object output) |
Object |
read(DataInput in)
Decode an output value previously written with
Outputs.write(Object, DataOutput). |
Object |
readFinalOutput(DataInput in)
Decode an output value previously written with
Outputs.writeFinalOutput(Object, DataOutput). |
Object |
subtract(Object object,
Object inc)
Eg subtract("foobar", "foo") -> "bar"
|
String |
toString() |
void |
write(Object output,
DataOutput out)
Encode an output value into a
DataOutput. |
void |
writeFinalOutput(Object output,
DataOutput out)
Encode an final node output value into a
DataOutput. |
public Object common(Object output1, Object output2)
Outputspublic Object subtract(Object object, Object inc)
Outputspublic Object add(Object prefix, Object output)
Outputspublic void write(Object output, DataOutput out) throws IOException
OutputsDataOutput.write in class Outputs<Object>IOExceptionpublic void writeFinalOutput(Object output, DataOutput out) throws IOException
OutputsDataOutput. By default this just calls Outputs.write(Object,
DataOutput).writeFinalOutput in class Outputs<Object>IOExceptionpublic Object read(DataInput in) throws IOException
OutputsOutputs.write(Object, DataOutput).read in class Outputs<Object>IOExceptionpublic Object readFinalOutput(DataInput in) throws IOException
OutputsOutputs.writeFinalOutput(Object, DataOutput). By default this
just calls Outputs.read(DataInput).readFinalOutput in class Outputs<Object>IOExceptionpublic Object getNoOutput()
OutputsgetNoOutput in class Outputs<Object>public String outputToString(Object output)
outputToString in class Outputs<Object>Copyright © 2010 - 2020 Adobe. All Rights Reserved