public final class UpToTwoPositiveIntOutputs extends Outputs<Object>
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
.
Modifier and Type | Class and Description |
---|---|
static class |
UpToTwoPositiveIntOutputs.TwoLongs
Holds two long outputs.
|
Modifier and Type | Method and Description |
---|---|
Object |
add(Object _prefix,
Object _output) |
Long |
common(Object _output1,
Object _output2) |
Long |
get(long v) |
UpToTwoPositiveIntOutputs.TwoLongs |
get(long first,
long second) |
Object |
getNoOutput() |
static UpToTwoPositiveIntOutputs |
getSingleton(boolean doShare) |
Object |
merge(Object first,
Object second) |
String |
outputToString(Object output) |
long |
ramBytesUsed(Object o) |
Object |
read(DataInput in) |
Long |
subtract(Object _output,
Object _inc) |
void |
write(Object _output,
DataOutput out) |
readFinalOutput, skipFinalOutput, skipOutput, writeFinalOutput
public static UpToTwoPositiveIntOutputs getSingleton(boolean doShare)
public Long get(long v)
public UpToTwoPositiveIntOutputs.TwoLongs get(long first, long second)
public void write(Object _output, DataOutput out) throws IOException
write
in class Outputs<Object>
IOException
public Object read(DataInput in) throws IOException
read
in class Outputs<Object>
IOException
public Object getNoOutput()
getNoOutput
in class Outputs<Object>
public String outputToString(Object output)
outputToString
in class Outputs<Object>
public long ramBytesUsed(Object o)
ramBytesUsed
in class Outputs<Object>
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.