Package org.apache.lucene.util.fst
Class UpToTwoPositiveIntOutputs
- java.lang.Object
 - 
- org.apache.lucene.util.fst.Outputs<java.lang.Object>
 - 
- org.apache.lucene.util.fst.UpToTwoPositiveIntOutputs
 
 
 
- 
public final class UpToTwoPositiveIntOutputs extends Outputs<java.lang.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
Builder.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
Builder. 
- 
- 
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 java.lang.Objectadd(java.lang.Object _prefix, java.lang.Object _output)Eg add("foo", "bar") -> "foobar"java.lang.Longcommon(java.lang.Object _output1, java.lang.Object _output2)Eg common("foobar", "food") -> "foo"java.lang.Longget(long v)UpToTwoPositiveIntOutputs.TwoLongsget(long first, long second)java.lang.ObjectgetNoOutput()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)java.lang.Objectmerge(java.lang.Object first, java.lang.Object second)java.lang.StringoutputToString(java.lang.Object output)java.lang.Objectread(DataInput in)Decode an output value previously written withOutputs.write(Object, DataOutput).java.lang.Longsubtract(java.lang.Object _output, java.lang.Object _inc)Eg subtract("foobar", "foo") -> "bar"voidwrite(java.lang.Object _output, DataOutput out)Encode an output value into aDataOutput.- 
Methods inherited from class org.apache.lucene.util.fst.Outputs
readFinalOutput, writeFinalOutput 
 - 
 
 - 
 
- 
- 
Method Detail
- 
getSingleton
public static UpToTwoPositiveIntOutputs getSingleton(boolean doShare)
 
- 
get
public java.lang.Long get(long v)
 
- 
get
public UpToTwoPositiveIntOutputs.TwoLongs get(long first, long second)
 
- 
common
public java.lang.Long common(java.lang.Object _output1, java.lang.Object _output2)Description copied from class:OutputsEg common("foobar", "food") -> "foo" 
- 
subtract
public java.lang.Long subtract(java.lang.Object _output, java.lang.Object _inc)Description copied from class:OutputsEg subtract("foobar", "foo") -> "bar" 
- 
add
public java.lang.Object add(java.lang.Object _prefix, java.lang.Object _output)Description copied from class:OutputsEg add("foo", "bar") -> "foobar" 
- 
write
public void write(java.lang.Object _output, DataOutput out) throws java.io.IOExceptionDescription copied from class:OutputsEncode an output value into aDataOutput. 
- 
read
public java.lang.Object read(DataInput in) throws java.io.IOException
Description copied from class:OutputsDecode an output value previously written withOutputs.write(Object, DataOutput). 
- 
getNoOutput
public java.lang.Object 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<java.lang.Object>
 
- 
outputToString
public java.lang.String outputToString(java.lang.Object output)
- Specified by:
 outputToStringin classOutputs<java.lang.Object>
 
 - 
 
 -