com.phasmidsoftware.tableparser.core.util
Members list
Type members
Classlikes
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 Objecttrait Matchableclass AnyShow all
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 Objecttrait Matchableclass Any
- Self type
-
Derivation.type
Various utilities for functional programming.
Various utilities for functional programming.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FP.type
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.orNullwill passnullto Scala's base exception wheneois None). - msg
-
a descriptive error message providing details about the exception.
Attributes
- Supertypes
-
trait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
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 Objecttrait Matchableclass Any
- Known subtypes
-
class FieldNamesOf[T]
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FieldNames.type
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 Serializabletrait Producttrait Equalstrait FieldNames[T]class Objecttrait Matchableclass AnyShow all
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
Joinabletype class. - Handling exceptions during function execution and input processing.
- Providing support for "multi-line" inputs that can be joined using the
Joinablelogic.
Type parameters
- R
-
The result type produced by applying function
fto elements of typeX. - X
-
The input type of the iterator. Must have an implicit type class
Joinablethat provides methods for validation, joining, and a zero value.
Value parameters
- f
-
A function from
XtoTry[R]that is applied to each element of the iterator. - xs
-
An
Iterator[X]containing the input elements to be processed. The class extendsAbstractIterator[Try[R]]and provides these key methods:
Attributes
- Constructor
-
Creates a
FunctionIteratorthat 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
FunctionIteratormay use a mutable variableryinternally 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 Objecttrait Matchableclass AnyShow all
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 Singletontrait Producttrait Mirrortrait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
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
IteratorExhaustedExceptionwith a predefined message: "iterator exhausted". Example usage:val iterator = Iterator.empty if (!iterator.hasNext) throw IteratorExhaustedException - Supertypes
-
trait Singletontrait Producttrait Mirrortrait Producttrait Equalsclass Exceptionclass Throwabletrait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
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 Objecttrait Matchableclass Any
- Known subtypes
Companion object for the Joinable type class, providing default implementations of the Joinable behavior for specific types.
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 Objecttrait Matchableclass AnyShow all