org.apache.lucene.util.fst

## Class Outputs<T>

- java.lang.Object
- - org.apache.lucene.util.fst.Outputs<T>

- Direct Known Subclasses:
    ByteSequenceOutputs, CharSequenceOutputs, IntSequenceOutputs, NoOutputs, PairOutputs, PositiveIntOutputs

      public abstract class Outputs<T>
      extends 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()`.

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Outputs()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and 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 output
    `T` | `merge(T first, T second)`
    `abstract String` | `outputToString(T output)`
    `abstract long` | `ramBytesUsed(T output)` Return memory usage for the provided output.
    `abstract T` | `read(DataInput in)` Decode an output value previously written with `write(Object, DataOutput)`.
    `T` | `readFinalOutput(DataInput in)` Decode an output value previously written with `writeFinalOutput(Object, DataOutput)`.
    `void` | `skipFinalOutput(DataInput in)` Skip the output previously written with `writeFinalOutput(T, org.apache.lucene.store.DataOutput)`; defaults to just calling `readFinalOutput(org.apache.lucene.store.DataInput)` and discarding the result.
    `void` | `skipOutput(DataInput in)` Skip the output; defaults to just calling `read(org.apache.lucene.store.DataInput)` and discarding the result.
    `abstract T` | `subtract(T output, T inc)` Eg subtract("foobar", "foo") -> "bar"
    `abstract void` | `write(T output, DataOutput out)` Encode an output value into a `DataOutput`.
    `void` | `writeFinalOutput(T output, DataOutput out)` Encode an final node output value into a `DataOutput`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Outputs

          public Outputs()

  - ### Method Detail

    - #### common

          public abstract T common(T output1,
                                   T output2)

      Eg common("foobar", "food") -> "foo"

    - #### subtract

          public abstract T subtract(T output,
                                     T inc)

      Eg subtract("foobar", "foo") -> "bar"

    - #### add

          public abstract T add(T prefix,
                                T output)

      Eg add("foo", "bar") -> "foobar"

    - #### write

          public abstract void write(T output,
                                     DataOutput out)
                              throws IOException

      Encode an output value into a `DataOutput`.
      Throws:
        `IOException`

    - #### writeFinalOutput

          public void writeFinalOutput(T output,
                                       DataOutput out)
                                throws IOException

      Encode an final node output value into a `DataOutput`. By default this just calls `write(Object, DataOutput)`.
      Throws:
        `IOException`

    - #### read

          public abstract T read(DataInput in)
                          throws IOException

      Decode an output value previously written with `write(Object, DataOutput)`.
      Throws:
        `IOException`

    - #### skipOutput

          public void skipOutput(DataInput in)
                          throws IOException

      Skip the output; defaults to just calling `read(org.apache.lucene.store.DataInput)` and discarding the result.
      Throws:
        `IOException`

    - #### readFinalOutput

          public T readFinalOutput(DataInput in)
                            throws IOException

      Decode an output value previously written with `writeFinalOutput(Object, DataOutput)`. By default this just calls `read(DataInput)`.
      Throws:
        `IOException`

    - #### skipFinalOutput

          public void skipFinalOutput(DataInput in)
                               throws IOException

      Skip the output previously written with `writeFinalOutput(T, org.apache.lucene.store.DataOutput)`; defaults to just calling `readFinalOutput(org.apache.lucene.store.DataInput)` and discarding the result.
      Throws:
        `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 String outputToString(T output)

    - #### merge

          public T merge(T first,
                         T second)

    - #### ramBytesUsed

          public abstract long ramBytesUsed(T output)

      Return memory usage for the provided output.
      See Also:
        `Accountable`

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.