Package org.apache.lucene.misc.util.fst
Class UpToTwoPositiveIntOutputs
- java.lang.Object
-
- org.apache.lucene.util.fst.Outputs<Object>
-
- org.apache.lucene.misc.util.fst.UpToTwoPositiveIntOutputs
-
public final class UpToTwoPositiveIntOutputs extends Outputs<Object>
An FSTOutputsimplementation where each output is one or two non-negative long values. If it's a single output, Long is returned; else, TwoLongs. Order is preserved in the TwoLongs case, ie .first is the first input/output added to Builder, and .second is the second. You cannot store 0 output with this (that's reserved to mean "no output")!NOTE: the only way to create a TwoLongs output is to add the same input to the FST twice in a row. This is how the FST maps a single input to two outputs (e.g. you cannot pass a TwoLongs to
FSTCompiler.add(org.apache.lucene.util.IntsRef, T). If you need more than two then useListOfOutputs, but if you only have at most 2 then this implementation will require fewer bytes as it steals one bit from each long value.NOTE: the resulting FST is not guaranteed to be minimal! See
FSTCompiler.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUpToTwoPositiveIntOutputs.TwoLongsHolds two long outputs.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectadd(Object _prefix, Object _output)Longcommon(Object _output1, Object _output2)Longget(long v)UpToTwoPositiveIntOutputs.TwoLongsget(long first, long second)ObjectgetNoOutput()static UpToTwoPositiveIntOutputsgetSingleton(boolean doShare)Objectmerge(Object first, Object second)StringoutputToString(Object output)longramBytesUsed(Object o)Objectread(DataInput in)Longsubtract(Object _output, Object _inc)voidwrite(Object _output, DataOutput out)-
Methods inherited from class org.apache.lucene.util.fst.Outputs
readFinalOutput, skipFinalOutput, skipOutput, writeFinalOutput
-
-
-
-
Method Detail
-
getSingleton
public static UpToTwoPositiveIntOutputs getSingleton(boolean doShare)
-
get
public Long get(long v)
-
get
public UpToTwoPositiveIntOutputs.TwoLongs get(long first, long second)
-
write
public void write(Object _output, DataOutput out) throws IOException
- Specified by:
writein classOutputs<Object>- Throws:
IOException
-
read
public Object read(DataInput in) throws IOException
- Specified by:
readin 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 o)
- Specified by:
ramBytesUsedin classOutputs<Object>
-
-