ListOfOutputs (Lucene 10.5.1 misc API)
Description: declaration: package: org.apache.lucene.misc.util.fst, class: ListOfOutputs

Package org.apache.lucene.misc.util.fst

# Class ListOfOutputs<T>

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

public final class ListOfOutputs<T> extends Outputs<Object>
Wraps another Outputs implementation and encodes one or more of its output values. You can use this when a single input may need to map to more than one output, maintaining order: pass the same input with a different output by calling `FSTCompiler.add(IntsRef,Object)` multiple times. The builder will then combine the outputs using the `Outputs.merge(Object,Object)` method.

The resulting FST may not be minimal when an input has more than one output, as this requires pushing all multi-output values to a final state.

NOTE: the only way to create multiple outputs is to add the same input to the FST multiple times in a row. This is how the FST maps a single input to multiple outputs (e.g. you cannot pass a List<Object> to `FSTCompiler.add(org.apache.lucene.util.IntsRef, T)`). If your outputs are longs, and you need at most 2, then use `UpToTwoPositiveIntOutputs` instead since it stores the outputs more compactly (by stealing a bit from each long value).

NOTE: this cannot wrap itself (ie you cannot make an FST with List<List<Object>> outputs using this).

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ListOfOutputs(Outputs<T> outputs)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `add(Object prefix, Object output)`
  `List<T>`
  `asList(Object output)`
  `Object`
  `common(Object output1, Object output2)`
  `Object`
  `getNoOutput()`
  `Object`
  `merge(Object first, Object second)`
  `String`
  `outputToString(Object output)`
  `long`
  `ramBytesUsed(Object output)`
  `Object`
  `read(DataInput in)`
  `Object`
  `readFinalOutput(DataInput in)`
  `void`
  `skipFinalOutput(DataInput in)`
  `void`
  `skipOutput(DataInput in)`
  `Object`
  `subtract(Object object, Object inc)`
  `String`
  `toString()`
  `void`
  `write(Object output, DataOutput out)`
  `void`
  `writeFinalOutput(Object output, DataOutput out)`

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

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

- ## Constructor Details

  - ### ListOfOutputs

    public ListOfOutputs(Outputs<T> outputs)

- ## Method Details

  - ### common

    public Object common(Object output1, Object output2)
    Specified by:
      `common` in class `Outputs<Object>`

  - ### subtract

    public Object subtract(Object object, Object inc)
    Specified by:
      `subtract` in class `Outputs<Object>`

  - ### add

    public Object add(Object prefix, Object output)
    Specified by:
      `add` in class `Outputs<Object>`

  - ### write

    public void write(Object output, DataOutput out) throws IOException
    Specified by:
      `write` in class `Outputs<Object>`
    Throws:
      `IOException`

  - ### writeFinalOutput

    public void writeFinalOutput(Object output, DataOutput out) throws IOException
    Overrides:
      `writeFinalOutput` in class `Outputs<Object>`
    Throws:
      `IOException`

  - ### read

    public Object read(DataInput in) throws IOException
    Specified by:
      `read` in class `Outputs<Object>`
    Throws:
      `IOException`

  - ### skipOutput

    public void skipOutput(DataInput in) throws IOException
    Overrides:
      `skipOutput` in class `Outputs<Object>`
    Throws:
      `IOException`

  - ### readFinalOutput

    public Object readFinalOutput(DataInput in) throws IOException
    Overrides:
      `readFinalOutput` in class `Outputs<Object>`
    Throws:
      `IOException`

  - ### skipFinalOutput

    public void skipFinalOutput(DataInput in) throws IOException
    Overrides:
      `skipFinalOutput` in class `Outputs<Object>`
    Throws:
      `IOException`

  - ### getNoOutput

    public Object getNoOutput()
    Specified by:
      `getNoOutput` in class `Outputs<Object>`

  - ### outputToString

    public String outputToString(Object output)
    Specified by:
      `outputToString` in class `Outputs<Object>`

  - ### merge

    public Object merge(Object first, Object second)
    Overrides:
      `merge` in class `Outputs<Object>`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### asList

    public List<T> asList(Object output)

  - ### ramBytesUsed

    public long ramBytesUsed(Object output)
    Specified by:
      `ramBytesUsed` in class `Outputs<Object>`