Package org.apache.lucene.util.fst
Class Outputs<T>
- java.lang.Object
-
- org.apache.lucene.util.fst.Outputs<T>
-
- Direct Known Subclasses:
ByteSequenceOutputs
,CharSequenceOutputs
,IntSequenceOutputs
,ListOfOutputs
,NoOutputs
,PairOutputs
,PositiveIntOutputs
,UpToTwoPositiveIntOutputs
public abstract class Outputs<T> extends java.lang.Object
Represents the outputs for an FST, providing the basic algebra required for building and traversing the FST.Note that any operation that returns NO_OUTPUT must return the same singleton object from
getNoOutput()
.
-
-
Constructor Summary
Constructors Constructor Description Outputs()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
add(T prefix, T output)
Eg add("foo", "bar") -> "foobar"abstract T
common(T output1, T output2)
Eg common("foobar", "food") -> "foo"abstract T
getNoOutput()
NOTE: this output is compared with == so you must ensure that all methods return the single object if it's really no outputT
merge(T first, T second)
abstract java.lang.String
outputToString(T output)
abstract T
read(DataInput in)
Decode an output value previously written withwrite(Object, DataOutput)
.T
readFinalOutput(DataInput in)
Decode an output value previously written withwriteFinalOutput(Object, DataOutput)
.abstract T
subtract(T output, T inc)
Eg subtract("foobar", "foo") -> "bar"abstract void
write(T output, DataOutput out)
Encode an output value into aDataOutput
.void
writeFinalOutput(T output, DataOutput out)
Encode an final node output value into aDataOutput
.
-
-
-
Method Detail
-
write
public abstract void write(T output, DataOutput out) throws java.io.IOException
Encode an output value into aDataOutput
.- Throws:
java.io.IOException
-
writeFinalOutput
public void writeFinalOutput(T output, DataOutput out) throws java.io.IOException
Encode an final node output value into aDataOutput
. By default this just callswrite(Object, DataOutput)
.- Throws:
java.io.IOException
-
read
public abstract T read(DataInput in) throws java.io.IOException
Decode an output value previously written withwrite(Object, DataOutput)
.- Throws:
java.io.IOException
-
readFinalOutput
public T readFinalOutput(DataInput in) throws java.io.IOException
Decode an output value previously written withwriteFinalOutput(Object, DataOutput)
. By default this just callsread(DataInput)
.- Throws:
java.io.IOException
-
getNoOutput
public abstract T getNoOutput()
NOTE: this output is compared with == so you must ensure that all methods return the single object if it's really no output
-
outputToString
public abstract java.lang.String outputToString(T output)
-
-