Package org.apache.lucene.util.fst
Class 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 Builder.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 Builder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classHolds two long outputs. -
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) Decode an output value previously written withOutputs.write(Object, DataOutput).Eg subtract("foobar", "foo") -> "bar"voidwrite(Object _output, DataOutput out) Encode an output value into aDataOutput.Methods inherited from class org.apache.lucene.util.fst.Outputs
readFinalOutput, writeFinalOutput
-
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
-
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
-