<>

abstract class <>[A] extends Able.Contain[A]

<> is Value Range

<> is defined with the following defs:

  • start
  • end,
  • and ordering, which makes the above meaningful

<> has a notion that an element can be within the range, i.e. between start and end, or outside

Note. Scala provided range structures (Range and NumericRange) are implemented more as collections and this class is designed to close this void focusing on generic range operations

Source
__.scala
trait Able.Contain[A]
class java.lang.Object
trait scala.Matchable
class Any
class Byte.G.<>[A]
class Char.G.<>[A]
class Double.G.<>[A]
class Float.G.<>[A]
class Int.G.<>[A]
class Long.G.<>[A]
class Short.G.<>[A]
class <>.X.Base[A, <>.X.Base.THIS]
class Period

Def

def contains(v: <>[A]): Boolean

Check if within

Check if within

Returns true if this range contains specified range

 (1 <> 9) contains (3 <> 7)  // Returns: true

 (1 <> 5) contains (3 <> 7)  // Returns: false
Source
__.scala
def contains(v: A): Boolean

Check if within

Check if within

Returns true if this range contains specified value

 (1 <> 9) contains 3  // Returns: true
Source
__.scala
def end: A

Make value

Make value

End value of the range

Source
__.scala
def endIsIn: Boolean

Inclusive check

Inclusive check

If true, the end value is inclusive

 (10 <>> 15) contains 15   // Returns: false

 // Exclusive 15 does not contain 15
Source
__.scala
override def equals(v: Any): Boolean
Definition Classes
Any
Source
__.scala
def isEmpty: Boolean

Empty check

Empty check

Checks if the range is able contain anything.

For empty range the start and end values are the same and the end value is not inclusive

Source
__.scala
def join(v: A): this.type

Extend to

Extend to

This range is extended to contain the specified value

 'A' <> 'C' extendTo 'G' // Returns: A <> G

 'A' <> 'C' extendTo 'B' // Returns: A <> C
Source
__.scala
def join(v: <>[A]): this.type

Union

Union

Returns range with out-most reaches of this and specified

 'A' <> 'C' join 'X' <> 'Z' // Returns: A <> Z
Source
__.scala
def ordering: scala.Ordering[A]

Ordering

Ordering

Ordering defining range

Ordering defining type elements comparison

Source
__.scala
@scala.annotation.targetName("overlap_Opt")
def overlap_?(r: <>[A]): Opt[this.type]

Optional intersection

Optional intersection

Optionally returns common intersection of this and that

 1 <> 6 overlap_? 3 <> 9  // Returns: Opt(3 <> 6)

 1 <> 3 overlap_? 6 <> 9  // Returns: Opt(\/)
Source
__.scala
def overlaps(r: <>[A]): Boolean

Overlap check

Overlap check

Returns true if two ranges overlap

Source
__.scala
inline def raw[RAW <: <>.RawType[A]](using inline s: Given.RangeTag.Raw[A, RAW]): RAW

Raw range

Raw range

Returns primitive specialized range implementation.

The method would not compile for a non specializable range.

Source
__.scala
def start: A

From value

From value

Start value of the range

Source
__.scala
def step_~(f: A => A): ~[A]

Mapped stream

Mapped stream

Returns a stream containing the first range value and the result of applying given function to this value and the produced results. The stream ends when the function result is no longer within range.

 (1 <> 10).step_~( _ + 3).tp  // Prints: ~(1, 4, 7, 10)
Source
__.scala
def step_~(step: Int)(using Able.Sequence[A]): ~[A]

Stepped stream

Stepped stream

For sequential types, the method returns a stream of values with given step.

 (1 <> 10).step_~(2).tp  // Prints: ~(1, 3, 5, 7, 9)
Source
__.scala

Extension

@scala.annotation.targetName("stream")
def ~[A](using Able.Sequence[A]): ~[A]
Source
__.scala
def convert[A](f: A => B)(using s: scala.Ordering[B]): <>[B]
Source
__.scala