public final class ListOfOutputs<T> extends Outputs<java.lang.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 |
---|---|
java.lang.Object |
add(java.lang.Object prefix,
java.lang.Object output)
Eg add("foo", "bar") -> "foobar"
|
java.util.List<T> |
asList(java.lang.Object output) |
java.lang.Object |
common(java.lang.Object output1,
java.lang.Object output2)
Eg common("foobar", "food") -> "foo"
|
java.lang.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
|
java.lang.Object |
merge(java.lang.Object first,
java.lang.Object second) |
java.lang.String |
outputToString(java.lang.Object output) |
long |
ramBytesUsed(java.lang.Object output)
Return memory usage for the provided output.
|
java.lang.Object |
read(DataInput in)
Decode an output value previously written with
Outputs.write(Object, DataOutput) . |
java.lang.Object |
readFinalOutput(DataInput in)
Decode an output value previously written with
Outputs.writeFinalOutput(Object, DataOutput) . |
void |
skipFinalOutput(DataInput in)
Skip the output previously written with
Outputs.writeFinalOutput(T, org.apache.lucene.store.DataOutput) ;
defaults to just calling Outputs.readFinalOutput(org.apache.lucene.store.DataInput) and discarding
the result. |
void |
skipOutput(DataInput in)
Skip the output; defaults to just calling
Outputs.read(org.apache.lucene.store.DataInput)
and discarding the result. |
java.lang.Object |
subtract(java.lang.Object object,
java.lang.Object inc)
Eg subtract("foobar", "foo") -> "bar"
|
java.lang.String |
toString() |
void |
write(java.lang.Object output,
DataOutput out)
Encode an output value into a
DataOutput . |
void |
writeFinalOutput(java.lang.Object output,
DataOutput out)
Encode an final node output value into a
DataOutput . |
public java.lang.Object common(java.lang.Object output1, java.lang.Object output2)
Outputs
public java.lang.Object subtract(java.lang.Object object, java.lang.Object inc)
Outputs
public java.lang.Object add(java.lang.Object prefix, java.lang.Object output)
Outputs
public void write(java.lang.Object output, DataOutput out) throws java.io.IOException
Outputs
DataOutput
.public void writeFinalOutput(java.lang.Object output, DataOutput out) throws java.io.IOException
Outputs
DataOutput
. By default this just calls Outputs.write(Object,
DataOutput)
.writeFinalOutput
in class Outputs<java.lang.Object>
java.io.IOException
public java.lang.Object read(DataInput in) throws java.io.IOException
Outputs
Outputs.write(Object, DataOutput)
.public void skipOutput(DataInput in) throws java.io.IOException
Outputs
Outputs.read(org.apache.lucene.store.DataInput)
and discarding the result.skipOutput
in class Outputs<java.lang.Object>
java.io.IOException
public java.lang.Object readFinalOutput(DataInput in) throws java.io.IOException
Outputs
Outputs.writeFinalOutput(Object, DataOutput)
. By default this
just calls Outputs.read(DataInput)
.readFinalOutput
in class Outputs<java.lang.Object>
java.io.IOException
public void skipFinalOutput(DataInput in) throws java.io.IOException
Outputs
Outputs.writeFinalOutput(T, org.apache.lucene.store.DataOutput)
;
defaults to just calling Outputs.readFinalOutput(org.apache.lucene.store.DataInput)
and discarding
the result.skipFinalOutput
in class Outputs<java.lang.Object>
java.io.IOException
public java.lang.Object getNoOutput()
Outputs
getNoOutput
in class Outputs<java.lang.Object>
public java.lang.String outputToString(java.lang.Object output)
outputToString
in class Outputs<java.lang.Object>
public java.lang.Object merge(java.lang.Object first, java.lang.Object second)
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<T> asList(java.lang.Object output)
public long ramBytesUsed(java.lang.Object output)
Outputs
ramBytesUsed
in class Outputs<java.lang.Object>
Accountable
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.