trait _Trait[A] extends Base[A]

Generic Range

Range is defined with the following defs:

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

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

Range can be created with special built-in constructors attached to every type, see Any._library

'A' <> 'D'   // Range[Char] from 'A' to 'D'

"X" <>> "Z"  // Range[String] from "X" to "Z" exclusive

1.0 <<> 5.0  // Range[Double] from exclusive 1.0 to 5.0

1  <<>> 5    // Range[Int] from exclusive 1 to 5 exclusive

5L <>+ 3     // Range[Long] from 5 to 8

5D <>>+ 3    // Range[Double] from 5.0 to 8.0 exclusive

"abc" <>!    // Range[String] from "abc" to "abc"

"abc" <>>!   // Range[String] from "abc" to "abc" exclusive

Note. Range is implicitly converted to a filter function, returning true if an element is within Range and false otherwise

Ordering
  1. Alphabetic
Inherited
  1. Range
  2. Util.Range.Z.Base
  3. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type

  1. abstract type scalqa.Util.Range[A] <: Range[A]
    Attributes
    protected
    Definition Classes
    Base

Method

  1. def all(implicit n: Numeric[A]): ~[A]

    Stream of elements

    Stream of elements

    Elements are produced from start to end using implicit math.Numeric with value 1

    math.Numeric is universally available for:

    ('A' <> 'K').all.lp
     (2018.Year.start.day <>+ 5).all.tp
    
     // Output
     ~(A, B, C, D, E, F, G, H, I, J, K)
     ----------
     ?
     ----------
     2018-01-01
     2018-01-02
     2018-01-03
     2018-01-04
     2018-01-05
     2018-01-06
     ----------
    Definition Classes
    _Trait
  2. def allStep(step: A)(implicit n: Numeric[A]): ~[A]

    Stream of elements with step

    Stream of elements with step

    Elements are produced from start to end using implicit math.Numeric with provided step value

    If step is negative, elements piped from end to start

    math.Numeric is universally available for:

    ('A' <> 'Z').allStep(4).lp  // Prints: ~(A, E, I, M, Q, U, Y)
    
    (1 <> 20).allStep(-3).lp    // Prints: ~(20, 17, 14, 11, 8, 5, 2)
    Definition Classes
    _Trait
  3. def allStep(step: (A) ⇒ A): ~[A]

    Stream of elements with step

    Stream of elements with step

    Elements are produced from start to end using specified step function

    val dt = DayTime.make(9, 30)
    (dt <>> dt + 2.Hours).allStep(_ + 10.Minutes).lp
    
    // Output
    ~(9:30, 9:40, 9:50, 10:00, 10:10, 10:20, 10:30, 10:40, 10:50, 11:00, 11:10, 11:20)

    Note: The result depends on implicit Ordering

    Definition Classes
    _Trait
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def contains(a: A): Boolean

    Check if within

    Check if within

    Returns true if this range contains specified value

    1 <> 9 contains 3 lp // Prints: true
    Definition Classes
    _Trait
  6. def contains(that: Range[A]): Boolean

    Check if within

    Check if within

    Returns true if this range contains that range

    1 <> 9 contains 3 <> 7 lp // Prints: true
    
    1 <> 5 contains 3 <> 7 lp // Prints: false
    Definition Classes
    _Trait
  7. abstract def end: A

    To value

    To value

    End value of the range

    Definition Classes
    _Trait
  8. def endContains(v: A, x: Boolean = false): Boolean
    Attributes
    protected
    Definition Classes
    Base
  9. abstract def endExclusive: Boolean

    Exclusive check

    Exclusive check

    If true, the end value is exclusive

    10 <>> 15 contains 15 lp  // Prints: false
    
    // Exclusive 15 does not contain 15
    Definition Classes
    _Trait
  10. def equals(arg0: Any): Boolean
    Definition Classes
    Any
  11. def extendTo(a: A): scalqa.Util.Range[A]

    Expand

    Expand

    This range is extended to contain the specified value

    'A' <> 'C' extendTo 'G' lp // Prints: A <> G
    
    'A' <> 'C' extendTo 'B' lp // Prints: A <> C
    Definition Classes
    _Trait
  12. def hashCode(): Int
    Definition Classes
    Any
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. def join(that: Range[A]): scalqa.Util.Range[A]

    Union

    Union

    Returns range with out-most reaches of this and that

    'A' <> 'C' join 'X' <> 'Z'.lp  // Prints: A <> Z
    Definition Classes
    _Trait
  15. abstract def make(start: A, startIn: Boolean, end: A, endIn: Boolean): scalqa.Util.Range[A]
    Attributes
    protected
    Definition Classes
    Base
  16. def map[B](m: (A) ⇒ B)(implicit s: Ordering[B]): Range[B]

    Mapped Range

    Mapped Range

    Creates range with mapped values

    (1 <>> 5) map (_ * 100) lp  // Prints: 100 <>> 500
    Definition Classes
    _Trait
  17. abstract def ordering: Ordering[A]

    Ordering

    Ordering

    Ordering defining range

    Without Ordering cannot be defined

    Definition Classes
    _Trait
  18. def overlapOpt(that: Range[A]): Opt[scalqa.Util.Range[A]]

    Optional intersection

    Optional intersection

    Optionally returns common intersection of this and that

    1 <> 6 overlapOpt 3 <> 9 lp  // Prints: Opt(3 <>> 7)
    
    1 <> 3 overlapOpt 6 <> 9 lp  // Prints: Opt.Void
    Definition Classes
    _Trait
  19. abstract def start: A

    From value

    From value

    Start value of the range

    Definition Classes
    _Trait
  20. def startContains(v: A, x: Boolean = false): Boolean
    Attributes
    protected
    Definition Classes
    Base
  21. abstract def startExclusive: Boolean

    Exclusive check

    Exclusive check

    If true, the start value is exclusive

    10 <<> 15 contains 10 lp  // Prints: false
    
    // Exclusive 10 does not contain 10
    Definition Classes
    _Trait
  22. def thisClass: Class[_]
    Attributes
    protected
    Definition Classes
    Base
  23. def toString(): String

    String presentation

    String presentation

    ("AA" <> "BB").toString.lp  // Prints AA <> BB
    Definition Classes
    _Trait → Any

Operator

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
Linear Supertypes
Base[A], Any
Known Subclasses
Source: _Trait.scala