Package org.apache.lucene.misc.util.fst
Class ListOfOutputs<T>
- java.lang.Object
-
- org.apache.lucene.util.fst.Outputs<Object>
-
- org.apache.lucene.misc.util.fst.ListOfOutputs<T>
-
public final class ListOfOutputs<T> extends Outputs<Object>
Wraps another Outputs implementation and encodes one or more of its output values. You can use this when a single input may need to map to more than one output, maintaining order: pass the same input with a different output by callingFSTCompiler.add(IntsRef,Object)multiple times. The builder will then combine the outputs using theOutputs.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
FSTCompiler.add(org.apache.lucene.util.IntsRef, T)). If your outputs are longs, and you need at most 2, then useUpToTwoPositiveIntOutputsinstead 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).
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Constructor Description ListOfOutputs(Outputs<T> outputs)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectadd(Object prefix, Object output)List<T>asList(Object output)Objectcommon(Object output1, Object output2)ObjectgetNoOutput()Objectmerge(Object first, Object second)StringoutputToString(Object output)longramBytesUsed(Object output)Objectread(DataInput in)ObjectreadFinalOutput(DataInput in)voidskipFinalOutput(DataInput in)voidskipOutput(DataInput in)Objectsubtract(Object object, Object inc)StringtoString()voidwrite(Object output, DataOutput out)voidwriteFinalOutput(Object output, DataOutput out)
-
-
-
Method Detail
-
write
public void write(Object output, DataOutput out) throws IOException
- Specified by:
writein classOutputs<Object>- Throws:
IOException
-
writeFinalOutput
public void writeFinalOutput(Object output, DataOutput out) throws IOException
- Overrides:
writeFinalOutputin classOutputs<Object>- Throws:
IOException
-
read
public Object read(DataInput in) throws IOException
- Specified by:
readin classOutputs<Object>- Throws:
IOException
-
skipOutput
public void skipOutput(DataInput in) throws IOException
- Overrides:
skipOutputin classOutputs<Object>- Throws:
IOException
-
readFinalOutput
public Object readFinalOutput(DataInput in) throws IOException
- Overrides:
readFinalOutputin classOutputs<Object>- Throws:
IOException
-
skipFinalOutput
public void skipFinalOutput(DataInput in) throws IOException
- Overrides:
skipFinalOutputin classOutputs<Object>- Throws:
IOException
-
getNoOutput
public Object getNoOutput()
- Specified by:
getNoOutputin classOutputs<Object>
-
outputToString
public String outputToString(Object output)
- Specified by:
outputToStringin classOutputs<Object>
-
ramBytesUsed
public long ramBytesUsed(Object output)
- Specified by:
ramBytesUsedin classOutputs<Object>
-
-