Module org.apache.lucene.misc
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
An FST
Outputs implementation 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 use ListOfOutputs, 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHolds two long outputs. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanprivate static final Longprivate static final UpToTwoPositiveIntOutputsprivate static final UpToTwoPositiveIntOutputsprivate static final long -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEg add("foo", "bar") -> "foobar"Eg common("foobar", "food") -> "foo"get(long v) get(long first, long second) NOTE: this output is compared with == so you must ensure that all methods return the single object if it's really no outputstatic UpToTwoPositiveIntOutputsgetSingleton(boolean doShare) outputToString(Object output) longReturn memory usage for the provided output.Decode an output value previously written withOutputs.write(Object, DataOutput).Eg subtract("foobar", "foo") -> "bar"private booleanprivate booleanvoidwrite(Object _output, DataOutput out) Encode an output value into aDataOutput.Methods inherited from class org.apache.lucene.util.fst.Outputs
readFinalOutput, skipFinalOutput, skipOutput, writeFinalOutput
-
Field Details
-
NO_OUTPUT
-
TWO_LONGS_NUM_BYTES
private static final long TWO_LONGS_NUM_BYTES
-
-
Constructor Details
-
UpToTwoPositiveIntOutputs
private UpToTwoPositiveIntOutputs(boolean doShare)
-
-
Method Details
-
getSingleton
-
get
-
get
-
common
Description copied from class:OutputsEg common("foobar", "food") -> "foo" -
subtract
Description copied from class:OutputsEg subtract("foobar", "foo") -> "bar" -
add
Description copied from class:OutputsEg add("foo", "bar") -> "foobar" -
write
Description copied from class:OutputsEncode an output value into aDataOutput.- Specified by:
writein classOutputs<Object>- Throws:
IOException
-
read
Description copied from class:OutputsDecode an output value previously written withOutputs.write(Object, DataOutput).- Specified by:
readin classOutputs<Object>- Throws:
IOException
-
valid
-
valid
-
getNoOutput
Description copied from class:OutputsNOTE: this output is compared with == so you must ensure that all methods return the single object if it's really no output- Specified by:
getNoOutputin classOutputs<Object>
-
outputToString
- Specified by:
outputToStringin classOutputs<Object>
-
merge
-
ramBytesUsed
Description copied from class:OutputsReturn memory usage for the provided output.- Specified by:
ramBytesUsedin classOutputs<Object>- See Also:
-