intervalidus
Intervalidus is a Scala library with zero dependencies for representing data as valid only in discrete or continuous intervals of arbitrary dimensions (tests cover up to four-dimensional data). It answers the question "In what intervals are your data valid?"
This top-level package includes Intervalidus's main traits, classes, and other members:
- Type classes for common discrete and continuous domain values.
- Foundational case classes, type classes, and enums for multidimensional domains, intervals, diff actions, and valid data.
- Base traits for dimensional data, including versioned and multivalued data.
Attributes
Members list
Packages
Intervalidus's main traits and classes for defining immutable dimensional data, including versioned and multivalued data:
Intervalidus's main traits and classes for defining immutable dimensional data, including versioned and multivalued data:
- Base trait for all immutable dimensional data.
- Classes defining immutable data in multidimensional intervals.
Attributes
Intervalidus's main traits and classes for defining mutable dimensional data, including versioned and multivalued data:
Intervalidus's main traits and classes for defining mutable dimensional data, including versioned and multivalued data:
- Base trait for all mutable dimensional data.
- Classes defining mutable data in multidimensional intervals.
Attributes
Type members
Classlikes
Type class for continuous values, which are:
Type class for continuous values, which are:
- bounded, with both a lower bound (minValue) and an upper bound (maxValue)
- totally ordered (extends Ordering, requiring a compare method)
- mappable to a weakly monotonic double value (requires an orderedHashOf method that may have "collisions")
Unlike a DiscreteValue, a continuous value is not necessarily well-ordered. That is, there is no requirement for having predecessors and successors defined. Although one can say that every digitized data structure is, by its very nature, discrete, it is often easier to reason about some data types when treated as continuous. For example, integer values and local dates are good candidates for being treated as discrete where double-precision float values and local date-times are often better treated as continuous.
See https://en.wikipedia.org/wiki/Bounded_set, https://en.wikipedia.org/wiki/Maximum_and_minimum, https://en.wikipedia.org/wiki/Total_order, https://en.wikipedia.org/wiki/Monotonic_function, and https://en.wikipedia.org/wiki/Well-order.
Type parameters
- T
-
a type with continuous value behavior (e.g.,
Double)
Attributes
- Companion
- object
- Supertypes
-
trait DomainValueLike[T]trait Ordering[T]trait PartialOrdering[T]trait Equiv[T]trait Serializabletrait Comparator[T]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object DoubleContinuousValueobject IntContinuousValueobject LocalDateContinuousValueobject LocalDateTimeContinuousValueobject LongContinuousValue
Default continuous value type classes for common data types.
Default continuous value type classes for common data types.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
ContinuousValue.type
Type class for getting the current datetime.
Type class for getting the current datetime.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object given_CurrentDateTime
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CurrentDateTime.type
Create/update/delete actions (like CQRS mutation commands). Used when extrapolating or applying event source-style information.
Create/update/delete actions (like CQRS mutation commands). Used when extrapolating or applying event source-style information.
Type parameters
- D
-
for
CreateandUpdate, the type of domain used in the interval assigned to the valid value, and forDelete, the type of domain used as the key. - V
-
the type of the value managed as data (not used in
Delete).
Attributes
- Note
-
intervalidus does not have event-sourced data structures, and the history of mutations is not maintained.
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Attributes
- Companion
- enum
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DiffAction.type
Common definitions used in all dimensional data.
Common definitions used in all dimensional data.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DimensionalBase.type
Base for all dimensional data, both mutable and immutable, of arbitrary dimensions.
Base for all dimensional data, both mutable and immutable, of arbitrary dimensions.
Type parameters
- D
-
the domain type -- a non-empty tuple that is DomainLike.
- V
-
the type of the value managed as data.
Attributes
- Companion
- object
- Supertypes
-
trait PartialFunction[D, V]trait D => Vclass Objecttrait Matchableclass Any
- Known subtypes
-
Show all
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
Common definitions used in all dimensional multivalued data.
Common definitions used in all dimensional multivalued data.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DimensionalMultiBase.type
Data that may have multiple values (managed as sets of values) in different intervals.
Data that may have multiple values (managed as sets of values) in different intervals.
Type parameters
- D
-
the domain type -- a non-empty tuple that is DomainLike.
- V
-
the type of the value managed as data.
Attributes
- Companion
- object
- Supertypes
-
trait PartialFunction[D, Set[V]]trait D => Set[V]class Objecttrait Matchableclass AnyShow all
- Known subtypes
Constructs multivalued data in multidimensional intervals.
Constructs multivalued data in multidimensional intervals.
Attributes
- Supertypes
- Known subtypes
Common definitions used in all versioned dimensional data (with a hidden version dimension).
Common definitions used in all versioned dimensional data (with a hidden version dimension).
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
Interface is similar to DimensionalBase, but it operates on an underlying intervalidus.mutable.Data using an extra integer-valued head dimension to version data. One use case would be versioned data that are valid in two dimensions of time, so the underlying data actually vary in terms of version and two dimensions of time (three dimensions). Most methods require some generic version selection criteria rather than specific integer intervals, therefore this does not extend DimensionalBase.
Interface is similar to DimensionalBase, but it operates on an underlying intervalidus.mutable.Data using an extra integer-valued head dimension to version data. One use case would be versioned data that are valid in two dimensions of time, so the underlying data actually vary in terms of version and two dimensions of time (three dimensions). Most methods require some generic version selection criteria rather than specific integer intervals, therefore this does not extend DimensionalBase.
The "current" version is managed as state (a var). Versioning also separates notions of approved vs. unapproved data (unapproved data are pushed up to start at version maxValue). When getting data, by default, we return "current" version data (a.k.a., approved). When updating data, by default, we don't rewrite history, so mutations start with the "current" version too.
Type parameters
- D
-
the domain type -- a non-empty tuple that is DomainLike.
- V
-
the type of the value managed as data.
Attributes
- Note
-
Updates starting with "current" also update unapproved changes (since intervalFrom goes to the Top).
- Companion
- object
- Supertypes
- Known subtypes
-
Constructs data in multidimensional intervals that are also versioned (hidden extra dimension).
Constructs data in multidimensional intervals that are also versioned (hidden extra dimension).
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Known subtypes
-
object DataVersionedobject DataVersioned
Type class for discrete values, which are:
Type class for discrete values, which are:
- bounded, with both a lower bound (minValue) and an upper bound (maxValue)
- totally ordered (extends Ordering, requiring a compare method)
- mappable to a weakly monotonic double value (requires an orderedHashOf method that may have "collisions")
- well ordered, having both a predecessorOf and successorOf function (unlike a ContinuousValue).
The predecessor must only be defined for values strictly greater than minValue and the successor only for values strictly less than maxValue. Having the predecessor and successor definitions limited in this way avoids issues where related methods of the underlying data types behave unexpectedly/inconsistently on the boundaries. For example, Int.MaxValue + 1 and Int.MinValue - 1 silently wrap around to each other, whereas both LocalDate.MAX.plusDays(1) and LocalDate.MIN.minusDays(1) throw a DateTimeException.
See https://en.wikipedia.org/wiki/Bounded_set, https://en.wikipedia.org/wiki/Maximum_and_minimum, https://en.wikipedia.org/wiki/Total_order, https://en.wikipedia.org/wiki/Monotonic_function, and https://en.wikipedia.org/wiki/Well-order.
Type parameters
- T
-
a type with discrete value behavior (e.g.,
Int)
Attributes
- Companion
- object
- Supertypes
-
trait DomainValueLike[T]trait Ordering[T]trait PartialOrdering[T]trait Equiv[T]trait Serializabletrait Comparator[T]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
object BigIntegerDiscreteValueobject IntDiscreteValueobject LocalDateDiscreteValueobject LongDiscreteValue
Default discrete value type classes for common data types.
Default discrete value type classes for common data types.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DiscreteValue.type
A one-dimensional domain based on an underlying domain value type. One-dimensional domains are used to define the boundaries of one-dimensional intervals, and tuples of one-dimensional domains are used to define the boundaries of multidimensional intervals. It describes specific data points in the domain value range as well as the special Bottom and Top cases which conceptually lie below and above this finite range of data points (logically below and above minValue and maxValue respectively). Domains can be based on domain values that are discrete or continuous. When continuous, a boundary point can either be open or closed, where discrete points must always be closed.
A one-dimensional domain based on an underlying domain value type. One-dimensional domains are used to define the boundaries of one-dimensional intervals, and tuples of one-dimensional domains are used to define the boundaries of multidimensional intervals. It describes specific data points in the domain value range as well as the special Bottom and Top cases which conceptually lie below and above this finite range of data points (logically below and above minValue and maxValue respectively). Domains can be based on domain values that are discrete or continuous. When continuous, a boundary point can either be open or closed, where discrete points must always be closed.
This also gives a way to completely describe adjacency.
-
When domain values are discrete, the left and right adjacent domains of a point are the respective predecessors and successors of the domain value. This also gives us a way to accommodate having predecessors/successors on the boundaries, i.e.,
domain(maxValue).rightAdjacent == Topanddomain(minValue).leftAdjacent == Bottom. -
When domain values are continuous, the left and right adjacent domains are always the same: open if the point is closed and closed if the point is open.
-
In both discrete and continuous domains,
TopandBottomare considered self-adjacent.
Type parameters
- T
-
expected to be a domain value (i.e.,
DomainValueLike[T]should be given).
Attributes
- Companion
- object
- Supertypes
-
trait Enumtrait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
- Known subtypes
Type class with operations on a domain with multiple discrete and/or continuous dimensions.
Type class with operations on a domain with multiple discrete and/or continuous dimensions.
An n-dimensional domain is represented by a tuple of Domain1D[Ti] values (where i varies from 1 to n), and each Ti is a (potentially different) domain value type that is DomainValueLike.
An n-dimensional domain is used in defining the boundaries of an n-dimensional interval. Generally, you will not need to use these methods directly -- they are here primarily to support methods on Interval and ValidData.
Type parameters
- D
-
the domain type -- a non-empty tuple of one-dimensional domains, where each can have its own domain value type.
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DomainLike.type
Type class for operating on domains and related structures of arbitrary dimension.
Type class for operating on domains and related structures of arbitrary dimension.
An n-dimensional domain is represented by a tuple of Domain1D[Ti] values (where i varies from 1 to n), and each Ti is a (potentially different) domain value type that is DomainValueLike.
This makes extensive use of Scala 3's generic programming techniques on tuples (for more information, see https://www.scala-lang.org/2021/02/26/tuples-bring-generic-programming-to-scala-3.html). These operations are meant to support DomainLike type classes and should not need to be called directly.
Type parameters
- D
-
Tuple of domain one-dimensional domains of various domain value types
Attributes
- Companion
- object
- Supertypes
-
class Objecttrait Matchableclass Any
Use recursive decomposition of tuples to provide domain-like capabilities to tuples.
Use recursive decomposition of tuples to provide domain-like capabilities to tuples.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DomainLikeTupleOps.type
A domain value is at least
A domain value is at least
- bounded, with both a lower bound (minValue) and an upper bound (maxValue)
- totally ordered (extends Ordering, requiring a compare method)
- mappable to a weakly monotonic double value (requires an orderedHashOf method that may have "collisions")
See https://en.wikipedia.org/wiki/Bounded_set, https://en.wikipedia.org/wiki/Maximum_and_minimum, https://en.wikipedia.org/wiki/Total_order, and https://en.wikipedia.org/wiki/Monotonic_function.
Type parameters
- T
-
a type with continuous or discrete value behavior (e.g.,
Double)
Attributes
- Supertypes
-
trait Ordering[T]trait PartialOrdering[T]trait Equiv[T]trait Serializabletrait Comparator[T]class Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait ContinuousValue[T]object DoubleContinuousValueobject IntContinuousValueobject LocalDateContinuousValueobject LocalDateTimeContinuousValueobject LongContinuousValuetrait DiscreteValue[T]object BigIntegerDiscreteValueobject IntDiscreteValueobject LocalDateDiscreteValueobject LongDiscreteValueShow all
Gets the values field from an enum (i.e., from the companion of the sealed trait) to retrieve all enums values.
Gets the values field from an enum (i.e., from the companion of the sealed trait) to retrieve all enums values.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
EnumMacro.type
Constructs experimental feature configurations.
Constructs experimental feature configurations.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Experimental.type
An interval in multiple dimensions over a contiguous set of domain values in D. See https://en.wikipedia.org/wiki/Interval_(mathematics) for more information.
An interval in multiple dimensions over a contiguous set of domain values in D. See https://en.wikipedia.org/wiki/Interval_(mathematics) for more information.
Type parameters
- D
-
the domain type -- a non-empty tuple that is DomainLike.
Value parameters
- end
-
the "supremum", i.e., the right (and/or above and/or front, depending on dimensions and context) boundary of the interval -- must be greater than or equal to the start in all dimensions
- start
-
the "infimum", i.e., the left (and/or below and/or back, depending on dimensions and context) boundary of the interval
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
A one-dimensional interval over a contiguous set of domain values in T. See https://en.wikipedia.org/wiki/Interval_(mathematics) for more information.
A one-dimensional interval over a contiguous set of domain values in T. See https://en.wikipedia.org/wiki/Interval_(mathematics) for more information.
Type parameters
- T
-
a domain value type for this interval's domain (e.g., Int, LocalDate) -- boundaries of the interval are defined in terms of
Domain1D[T]given the type classDomainValueLike[T].
Value parameters
- end
-
the "supremum", i.e., the right boundary of the interval -- must be greater than or equal to the start
- start
-
the "infimum", i.e., the left boundary of the interval
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalsclass Objecttrait Matchableclass AnyShow all
Companion for the one-dimensional interval used in defining and operating on valid data.
Companion for the one-dimensional interval used in defining and operating on valid data.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Interval1D.type
A value that is valid in an interval of arbitrary dimensions. Conceptually, this defines a partial function where all domain elements that are part of the interval map to the value.
A value that is valid in an interval of arbitrary dimensions. Conceptually, this defines a partial function where all domain elements that are part of the interval map to the value.
Type parameters
- D
-
the domain type -- DomainLike non-empty tuples.
- V
-
the type of the value managed as data (the codomain).
Value parameters
- interval
-
the interval in which the value is valid.
- value
-
value that is valid in this interval.
Attributes
- Companion
- object
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait PartialFunction[D, V]trait D => Vclass Objecttrait Matchableclass AnyShow all
Types
Enables/disables experimental features.
Enables/disables experimental features.