c

com.phasmidsoftware.tableparser.core.parse

IndexedInputToRowsAggregator

class IndexedInputToRowsAggregator[Input, Row] extends InputAggregator[Input, Row, Try]

The IndexedInputToRowsAggregator class provides functionality to process and aggregate input data of type Input into structured rows of type Row, with support for error handling, validation, and conditional processing. It extends the abstract class InputAggregator.

The class leverages implicit Joinable behavior for Input and works with Try to handle potential failures during the transformation of input data into rows. The flexibility is further increased with options to apply a custom predicate to filter rows, enable forgiving behavior (ignoring failures), and process multi-line inputs.

Input

the type of input elements to be processed.

Row

the type of rows transformed from the input.

Linear Supertypes
InputAggregator[Input, Row, Try], InputPreprocessor[Input, Row], AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. IndexedInputToRowsAggregator
  2. InputAggregator
  3. InputPreprocessor
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new IndexedInputToRowsAggregator(f: ((Input, Int)) => Try[Row], multiline: Boolean, forgiving: Boolean, predicate: (Try[Row]) => Boolean)(implicit arg0: Joinable[Input])

    f

    a function that takes a tuple of (Input, Int) and returns a Try[Row], used to transform each input element and its index into a Row.

    multiline

    a flag indicating whether multi-line input processing is enabled.

    forgiving

    a flag indicating whether forgiving behavior is enabled (i.e., failures are logged and ignored rather than propagated).

    predicate

    a function that takes a Try[Row] and returns a boolean, used to filter processed rows based on custom validation logic.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. def mapTsToRows(xs: Iterator[Input])(multiline: Boolean)(g: ((Input, Int)) => Try[Row])(implicit ev: Joinable[(Input, Int)]): Iterator[Try[Row]]

    Processes an input iterator of type Input and maps its elements into rows of type Row while handling potential errors using a specified transformation function.

    Processes an input iterator of type Input and maps its elements into rows of type Row while handling potential errors using a specified transformation function. The function can operate in two modes: - Multiline mode: input data can span multiple lines and will be joined using the provided Joinable type class. - Single-line mode: each input element is processed independently.

    xs

    The input iterator containing elements of type Input.

    multiline

    A Boolean flag indicating whether to process input in multiline mode.

    • true: Enables multiline processing using the provided Joinable type class.
    • false: Processes each input independently.
    g

    A transformation function that takes a tuple (Input, Int), representing an input element and its index, and returns a Try[Row]. The function should encapsulate the logic for mapping input to a row, including error handling.

    ev

    An implicit instance of the Joinable[(Input, Int)] type class, which handles joining and validating input tuples during multiline mode.

    returns

    An iterator of Try[Row], where each element represents either a successfully processed row or a failure.

    • In multiline mode, elements may span across multiple lines, joined using the logic provided by the Joinable type class.
    • In single-line mode, each input element is processed individually.
    Definition Classes
    InputPreprocessor
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. def processInput(xs: Iterator[Input]): Try[Iterator[Row]]

    Processes an iterator of inputs and transforms them into a wrapped iterator of rows.

    Processes an iterator of inputs and transforms them into a wrapped iterator of rows.

    This method combines the transformation of inputs into Try[Row] through mapTsToRows and the subsequent processing of these tried rows through processTriedRows.

    xs

    an iterator of inputs of type Input to be processed.

    returns

    a Wrapper containing an iterator of rows of type Row, where the transformation and processing operations have been applied to the inputs.

    Definition Classes
    IndexedInputToRowsAggregator → InputAggregator
  16. def processTriedRows(rys: Iterator[Try[Row]]): Try[Iterator[Row]]

    Processes an iterator of Try wrapped rows, transforming it into a single Try that contains an iterator of successfully processed rows.

    Processes an iterator of Try wrapped rows, transforming it into a single Try that contains an iterator of successfully processed rows.

    NOTE this is not a simple iterator to iterator pipeline. We have to sequence the input to get the output.

    rys

    an iterator of Try[Row], where each Try represents the result of processing a single row which may either succeed or fail

    returns

    a Try[Iterator[Row]] that encapsulates either:

    • a success containing an iterator of all successfully processed rows, or
    • a failure if any of the individual rows failed during processing
    Definition Classes
    IndexedInputToRowsAggregator → InputAggregator
  17. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  18. def toString(): String
    Definition Classes
    AnyRef → Any
  19. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. implicit object JoinableTInt extends JoinableTInt[Input]

    Implicit object that provides a JoinableTInt instance for the type Input.

    Implicit object that provides a JoinableTInt instance for the type Input.

    This object extends JoinableTInt for the type parameter Input and provides an implicit Joinable instance for Input. It defines the joining behavior for tuples of type (Input, Int) while utilizing the underlying Joinable instance for Input.

    Example:
    1. Example usage:

      val joinableTIntInstance = JoinableTInt
      // use the implicit instance for operations requiring JoinableTInt[(Input, Int)]
    Note

    This object is implicitly available in the scope where required. It relies on an implicit Joinable[Input] defined elsewhere in the application.

    See also

    JoinableTInt for its detailed trait definition.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from InputAggregator[Input, Row, Try]

Inherited from InputPreprocessor[Input, Row]

Inherited from AnyRef

Inherited from Any

Ungrouped