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 class
Holds two long outputs. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final boolean
private static final Long
private static final UpToTwoPositiveIntOutputs
private static final UpToTwoPositiveIntOutputs
private 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 UpToTwoPositiveIntOutputs
getSingleton
(boolean doShare) outputToString
(Object output) long
Return memory usage for the provided output.Decode an output value previously written withOutputs.write(Object, DataOutput)
.Eg subtract("foobar", "foo") -> "bar"private boolean
private boolean
void
write
(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:Outputs
Eg common("foobar", "food") -> "foo" -
subtract
Description copied from class:Outputs
Eg subtract("foobar", "foo") -> "bar" -
add
Description copied from class:Outputs
Eg add("foo", "bar") -> "foobar" -
write
Description copied from class:Outputs
Encode an output value into aDataOutput
.- Specified by:
write
in classOutputs<Object>
- Throws:
IOException
-
read
Description copied from class:Outputs
Decode an output value previously written withOutputs.write(Object, DataOutput)
.- Specified by:
read
in classOutputs<Object>
- Throws:
IOException
-
valid
-
valid
-
getNoOutput
Description copied from class:Outputs
NOTE: this output is compared with == so you must ensure that all methods return the single object if it's really no output- Specified by:
getNoOutput
in classOutputs<Object>
-
outputToString
- Specified by:
outputToString
in classOutputs<Object>
-
merge
-
ramBytesUsed
Description copied from class:Outputs
Return memory usage for the provided output.- Specified by:
ramBytesUsed
in classOutputs<Object>
- See Also:
-