com.phasmidsoftware.visitor.misc

Members list

Type members

Classlikes

abstract class AbstractMapJournal[K, V](map: Map[K, V]) extends Journal[(K, V)]

An abstract class representing a map-based implementation of a Journal. This class provides mechanisms to manage key-value pairs immutably in a journal-like structure. It extends the Journal trait, implementing appendable and iterable behaviors.

An abstract class representing a map-based implementation of a Journal. This class provides mechanisms to manage key-value pairs immutably in a journal-like structure. It extends the Journal trait, implementing appendable and iterable behaviors.

The AbstractMapJournal relies on an underlying immutable Map to store key-value pairs, allowing retrieval, iteration, and the addition of elements in a functional style.

Type parameters

K

the type of keys maintained by this journal

V

the type of values associated with keys in this journal

Value parameters

map

the underlying immutable map containing the journal entries

Attributes

Constructor

Initializes the journal with an immutable map of key-value pairs

Supertypes
trait Journal[(K, V)]
trait Appendable[(K, V)]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Known subtypes
class FunctionMapJournal[K, V]
class MapJournal[K, V]

Companion object for AppendableWriter providing factory methods for creating instances.

Companion object for AppendableWriter providing factory methods for creating instances.

The AppendableWriter allows for efficient and convenient appending of string data to files or other writable resources via a BufferedWriter. The factory methods in the companion object ensure flexibility by enabling creation from file names, File instances, FileWriter objects, or directly from BufferedWriter instances.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
case class AppendableWriter(writer: Writer)(closeable: Option[AutoCloseable]) extends Appendable[String]

AppendableWriter is a case class that wraps a Writer instance, enabling string appending functionality along with proper resource management.

AppendableWriter is a case class that wraps a Writer instance, enabling string appending functionality along with proper resource management.

This class implements the Appendable trait specialized for String, providing an efficient way to append strings to an underlying writer.

The closeable parameter is an optional resource that will be closed when the close method is invoked, ensuring that any additional resources associated with the writer are properly released.

Value parameters

closeable

an optional AutoCloseable resource that will be closed along with the writer

writer

the underlying Writer instance to which strings are appended

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait Appendable[String]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
case class FunctionMapJournal[K, V](xs: Map[K, V])(f: K => V) extends AbstractMapJournal[K, V], FunctionMappedJournal[K, V]

FunctionMapJournal is a case class that represents a specialized implementation of AbstractMapJournal, which maintains a journal of key-value pairs along with a function that can derive values based on keys. It extends both AbstractMapJournal and FunctionMappedJournal, providing a combination of stateful journal behavior and functional operations.

FunctionMapJournal is a case class that represents a specialized implementation of AbstractMapJournal, which maintains a journal of key-value pairs along with a function that can derive values based on keys. It extends both AbstractMapJournal and FunctionMappedJournal, providing a combination of stateful journal behavior and functional operations.

Type parameters

K

the type of the keys in the journal

V

the type of the values in the journal

Value parameters

f

a function that, given a key, computes its corresponding value

xs

a map containing the initial key-value pairs in the journal

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait FunctionMappedJournal[K, V]
trait K => V
class AbstractMapJournal[K, V]
trait Journal[(K, V)]
trait Appendable[(K, V)]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

An implementation of a journal backed by a map and a key-value computing function.

An implementation of a journal backed by a map and a key-value computing function.

The FunctionMapJournal stores a map of keys and their associated values, as well as a function f that computes the value for a given key. It provides methods to compute values, append to the journal by applying the function f to a key, and create new instances with updated maps.

This class is designed to be used in scenarios where values for keys need to be dynamically generated or updated using a predefined function.

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
trait FunctionMappedJournal[X, Y] extends Journal[(X, Y)], X => Y

A trait that combines the behavior of a function and a journal.

A trait that combines the behavior of a function and a journal.

FunctionMappedJournal extends both a function (X => Y) and Journal[(X, Y)]. This allows it to act as a function that maps input of type X to output of type Y, while also maintaining a journal of past inputs and outputs in the form of (X, Y) pairs.

The journal functionality provides the capability to keep track of operations performed by the function, making it suitable for scenarios like auditing, logging, or building histories of function calls and results.

Type parameters

X

the type of input to the function

Y

the type of output from the function

Attributes

Supertypes
trait X => Y
trait Journal[(X, Y)]
trait Appendable[(X, Y)]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Known subtypes
class FunctionMapJournal[K, V]
trait IterableJournal[X] extends Journal[X], Iterable[X]

A trait that represents an iterable journal, combining the functionalities of both the Journal and Iterable traits.

A trait that represents an iterable journal, combining the functionalities of both the Journal and Iterable traits.

IterableJournal is intended to maintain a collection of elements of type X that can be both appended (as supported by Journal) and iterated over (as supported by Iterable).

This abstraction is useful for scenarios where a sequence of log-like entries or journaled elements is required, while also enabling iteration for traversal, filtering, mapping, or other higher-order functions.

Type parameters

X

the type of elements contained in the iterable journal

Attributes

Supertypes
trait Iterable[X]
trait IterableFactoryDefaults[X, Iterable]
trait IterableOps[X, Iterable, Iterable[X]]
trait IterableOnceOps[X, Iterable, Iterable[X]]
trait IterableOnce[X]
trait Journal[X]
trait Appendable[X]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
Known subtypes
class ListJournal[X]
class QueueJournal[X]
case class ListJournal[X](list: List[X]) extends IterableJournal[X]

Represents a journal implemented as a list of elements of type X.

Represents a journal implemented as a list of elements of type X.

ListJournal is an immutable data structure that extends the Journal trait. It provides functionality to append elements and to iterate over the stored elements.

Type parameters

X

the type of elements stored in the journal

Value parameters

list

the list of elements in the journal

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait IterableJournal[X]
trait Iterable[X]
trait IterableFactoryDefaults[X, Iterable]
trait IterableOps[X, Iterable, Iterable[X]]
trait IterableOnceOps[X, Iterable, Iterable[X]]
trait IterableOnce[X]
trait Journal[X]
trait Appendable[X]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
object ListJournal

Companion object for the ListJournal class, providing factory methods for creating instances of ListJournal.

Companion object for the ListJournal class, providing factory methods for creating instances of ListJournal.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
case class MapJournal[K, V](map: Map[K, V]) extends AbstractMapJournal[K, V]

A MapJournal is a concrete implementation of the Journal trait that maintains a collection of elements represented as key-value pairs using a Map.

A MapJournal is a concrete implementation of the Journal trait that maintains a collection of elements represented as key-value pairs using a Map.

This class provides functionality to append new elements, retrieve elements by key, and iterate over the contents of the journal. It ensures immutability by returning a new instance when modifications, such as appending, are performed.

Type parameters

K

the type of keys maintained by the map

V

the type of values associated with the keys

Value parameters

map

the underlying map storing the key-value pairs of the journal

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class AbstractMapJournal[K, V]
trait Journal[(K, V)]
trait Appendable[(K, V)]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
object MapJournal

Companion object for the MapJournal class.

Companion object for the MapJournal class.

Provides utility methods related to the MapJournal data structure, which represents a journal implemented as a map of key-value pairs.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
MapJournal.type
case class NonAppendable[X](f: X => Unit) extends Appendable[X]

A case class implementation of the Appendable trait which executes a provided function when an element is appended.

A case class implementation of the Appendable trait which executes a provided function when an element is appended.

The NonAppendable class takes a function f as a parameter, which is invoked with the appended element whenever the append method is called. This implementation is a simple wrapper that enables side effects or custom handling of appended elements without retaining any internal state.

Type parameters

X

the type of elements that can be appended to this Appendable

Value parameters

f

a function to be executed with each appended element

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
trait Appendable[X]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
case class QueueJournal[X](queue: Queue[X]) extends IterableJournal[X]

Represents a journal implemented as a list of elements of type X.

Represents a journal implemented as a list of elements of type X.

ListJournal is an immutable data structure that extends the Journal trait. It provides functionality to append elements and to iterate over the stored elements.

Type parameters

X

the type of elements stored in the journal

Value parameters

queue

the list of elements in the journal

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait IterableJournal[X]
trait Iterable[X]
trait IterableFactoryDefaults[X, Iterable]
trait IterableOps[X, Iterable, Iterable[X]]
trait IterableOnceOps[X, Iterable, Iterable[X]]
trait IterableOnce[X]
trait Journal[X]
trait Appendable[X]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all
object QueueJournal

Companion object for the QueueJournal class, providing factory methods for creating instances of QueueJournal.

Companion object for the QueueJournal class, providing factory methods for creating instances of QueueJournal.

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type