com.phasmidsoftware.tableparser.core.util

Members list

Type members

Classlikes

class DebugIterator[X](xs: Iterator[X]) extends Iterator[X]

TESTME

TESTME

Type parameters

X

the underlying type of the iterator.

Value parameters

xs

an iterator on X.

Attributes

Supertypes
trait Iterator[X]
trait IterableOnceOps[X, Iterator, Iterator[X]]
trait IterableOnce[X]
class Object
trait Matchable
class Any
Show all
object Derivation

Helpers for the type classes that are derived from a case class's Mirror (CellParser, CsvRenderer, CsvGenerator, CsvProduct and HierarchicalRenderer).

Helpers for the type classes that are derived from a case class's Mirror (CellParser, CsvRenderer, CsvGenerator, CsvProduct and HierarchicalRenderer).

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
Derivation.type
object FP

Various utilities for functional programming.

Various utilities for functional programming.

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
FP.type
case class FPException(msg: String, eo: Option[Throwable] = ...) extends Exception

A simple case class representing a custom exception for functional programming-related errors.

A simple case class representing a custom exception for functional programming-related errors.

Value parameters

eo

an optional underlying Throwable that might have caused this exception. Defaults to None if not provided. This class extends Exception, taking advantage of its constructor to include a message (msg) and optionally a cause (eo.orNull will pass null to Scala's base exception when eo is None).

msg

a descriptive error message providing details about the exception.

Attributes

Supertypes
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
trait FieldNames[T]

Type class giving the names of the fields of a case class T, in declaration order. An instance is derived (from T's Mirror) wherever T is a known case class. Generic code which needs the field names of its type parameter (e.g. to make a Header) asks for a FieldNames[T]; this replaces 1.x's use of a ClassTag[T] and reflection.

Type class giving the names of the fields of a case class T, in declaration order. An instance is derived (from T's Mirror) wherever T is a known case class. Generic code which needs the field names of its type parameter (e.g. to make a Header) asks for a FieldNames[T]; this replaces 1.x's use of a ClassTag[T] and reflection.

Type parameters

T

the case class.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class FieldNamesOf[T]
object FieldNames

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
FieldNames.type
case class FieldNamesOf[T](names: List[String]) extends FieldNames[T]

A FieldNames[T] with the given names.

A FieldNames[T] with the given names.

Type parameters

T

the case class.

Value parameters

names

the field names.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait FieldNames[T]
class Object
trait Matchable
class Any
Show all
class FunctionIterator[X, R](f: X => Try[R])(xs: Iterator[X])(using evidence$1: Joinable[X]) extends AbstractIterator[Try[R]]

The FunctionIterator class wraps an existing iterator to apply a function f to its elements, returning an iterator that yields Try[R], where R is the result type of the function application.

The FunctionIterator class wraps an existing iterator to apply a function f to its elements, returning an iterator that yields Try[R], where R is the result type of the function application.

This class processes elements from a given iterator of type X and handles various scenarios such as:

  • Validating inputs against a custom Joinable type class.
  • Handling exceptions during function execution and input processing.
  • Providing support for "multi-line" inputs that can be joined using the Joinable logic.

Type parameters

R

The result type produced by applying function f to elements of type X.

X

The input type of the iterator. Must have an implicit type class Joinable that provides methods for validation, joining, and a zero value.

Value parameters

f

A function from X to Try[R] that is applied to each element of the iterator.

xs

An Iterator[X] containing the input elements to be processed. The class extends AbstractIterator[Try[R]] and provides these key methods:

Attributes

Constructor

Creates a FunctionIterator that wraps the input iterator and applies the given function to its elements. Usage example:

implicit object StringJoinable extends Joinable[String] {
 def join(t1: String, t2: String): String = t1 + t2
 val zero: String = ""
 def valid(t: String): Boolean = t.nonEmpty
}
val inputs = Iterator("abc", "123", "")
val function: String => Try[Int] = str => Try(str.toInt)
val functionIterator = new FunctionIterator(function)(inputs)
while (functionIterator.hasNext) {
 println(functionIterator.next())
}
Note

The FunctionIterator may use a mutable variable ry internally to store the result of the last element processed.

Supertypes
class AbstractIterator[Try[R]]
trait Iterator[Try[R]]
trait IterableOnceOps[Try[R], Iterator, Iterator[Try[R]]]
trait IterableOnce[Try[R]]
class Object
trait Matchable
class Any
Show all
case object InvalidInputException extends Exception

The InvalidInputException is a case object that extends the base Exception class. It represents an exception that is thrown when an invalid input is encountered.

The InvalidInputException is a case object that extends the base Exception class. It represents an exception that is thrown when an invalid input is encountered.

Attributes

Constructor

This exception is initialized with a default error message: "invalid input". Usage example:

if (input.isInvalid) {
 throw InvalidInputException
}
        This exception can be used in scenarios where there is a need to signal
        that the provided input data is not valid or does not meet the required criteria.
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
case object IteratorExhaustedException extends Exception

IteratorExhaustedException is a case object that represents an exception to be thrown when an attempt is made to access an element from an iterator that has been fully traversed.

IteratorExhaustedException is a case object that represents an exception to be thrown when an attempt is made to access an element from an iterator that has been fully traversed.

This exception helps signal that the iterator is exhausted, meaning no more elements are available for consumption.

Attributes

Constructor

Creates a new IteratorExhaustedException with a predefined message: "iterator exhausted". Example usage:

val iterator = Iterator.empty
if (!iterator.hasNext) throw IteratorExhaustedException
Supertypes
trait Singleton
trait Product
trait Mirror
trait Product
trait Equals
class Exception
class Throwable
trait Serializable
class Object
trait Matchable
class Any
Show all
Self type
trait Joinable[T]

Type class to define behavior of a type that can be joined.

Type class to define behavior of a type that can be joined.

Type parameters

T

the joinable type.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Joinable

Companion object for the Joinable type class, providing default implementations of the Joinable behavior for specific types.

Companion object for the Joinable type class, providing default implementations of the Joinable behavior for specific types.

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Joinable.type
class TeeIterator[X](n: Int)(xs: Iterator[X]) extends Iterator[X]

This iterator gets its input from a Iterator[X], which is essentially a parameterless function. The first n elements of the iterator can be passed to the caller of tee.

This iterator gets its input from a Iterator[X], which is essentially a parameterless function. The first n elements of the iterator can be passed to the caller of tee.

NOTE: this is an odd name for the class. Its purpose appears to be to drop the first n elements of an iterator and make them available via tee.

CONSIDER passing the parameter n to the tee method instead of the constructor.

Type parameters

X

the underlying type.

Value parameters

n

the number of elements to detach.

xs

the input iterator.

Attributes

Supertypes
trait Iterator[X]
trait IterableOnceOps[X, Iterator, Iterator[X]]
trait IterableOnce[X]
class Object
trait Matchable
class Any
Show all
object TryUsing

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
TryUsing.type