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 a continuous value.
Type class for a continuous value.
Unlike discrete values, there is no requirement for having predecessors and successors defined. Although every digitized data structure is discrete, it is often easier to work with some data types when they are treated as continuous. For example, integer values and local dates are good candidates for being discrete where double-precision float values and local date-times are better treated as continuous.
Type parameters
- T
-
a value that has 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
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
Create
andUpdate
, the type of domain used in the interval assigned to each 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 -- DomainLike non-empty tuples.
- V
-
the value type for valid 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 -- DomainLike non-empty tuples.
- V
-
the value type for valid 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
Base for all versioned dimensional data, both mutable and immutable, in any dimension.
Base for all versioned dimensional data, both mutable and immutable, in any dimension.
Interface is similar to DimensionalBase, but it operates on an underlying 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 for intervals in the public interface -- DomainLike non-empty tuples.
- V
-
the value type for valid 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 a discrete value.
Type class for a discrete value.
Unlike continuous values, discrete values also have predecessors and successors, which are properly defined on x
: maxValue < x < minValue
. Having predecessors and successors defined this way avoids issues where the natural successor functions of the underlying types behave unexpectedly/inconsistently on the boundaries, e.g., how Int.MaxValue + 1
and Int.MinValue - 1
silently wrap around to each other, vs. how both LocalDate.MAX.plusDays(1)
and LocalDate.MIN.minusDays(1)
throw a DateTimeException
.
Type parameters
- T
-
a value that has 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 domain is based on an underlying domain value type, and is used to define the boundaries of interval. 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.
A domain is based on an underlying domain value type, and is used to define the boundaries of interval. 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 a predecessor or successor on a boundary, i.e., maxValue.rightAdjacent == Top
and 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, Top
and Bottom
are 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[T
i]
values (where i varies from 1 to n), and each T
i 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
-
Domain type, a tuple of one-dimensional domains (where each can have a different 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[T
i]
values (where i varies from 1 to n), and each T
i 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
- finite, with a max and min value (think
Double
with itsMaxValue
andMinValue
methods) - totally ordered (this type class extends the Ordering type class, requiring a compare method).
- mappable to a similarly ordered double value (potentially with collisions)
Type parameters
- T
-
a value that has 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 -- DomainLike non-empty tuples.
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.