final class _Class extends AnyVal with Range[Int]

Idx.Range is a highly efficient extension of Range[Int]

It is a value class built around Long primitive and in most usage cases the object instance is not even created

Idx.Range has start and exclusive end

It has size which is equal to end minus start

In general programming there are several common ways to specify Int ranges:

  • start plus size
  • start plus end position
  • start plus end position exclusive

All three options are reduced in Scalqa to single unambiguous Idx.Range

"abcdef".substring(2, 5)  // Java way

"abcdef".copy(2 <>> 5)    // Scalqa way
Ordering
  1. Alphabetic
Inherited
  1. Range
  2. Range
  3. Util.Range.Z.Base
  4. scala.AnyVal
  5. scala.Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type

  1. type Range.this_type = Idx.Range
    Attributes
    protected
    Definition Classes
    _Class → Base

Constant

  1. val value: Long
    Attributes
    protected
    Definition Classes
    _Class

Method

  1. def all(implicit is: Numeric[Int]): ~[Int]

    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
    _Class_Trait
  2. def allStep(step: Int)(implicit is: Numeric[Int]): ~[Int]

    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
    _Class_Trait
  3. def allStep(step: (Int) ⇒ Int): ~[Int]

    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: Int): 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[Int]): 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. def end: Int

    To value

    To value

    End value of the range

    Definition Classes
    _Class_Trait
  8. def endContains(i: Int, x: Boolean = false): Boolean
    Attributes
    protected
    Definition Classes
    _Class → Base
  9. 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
    _Class_Trait
  10. def extendTo(a: Int): Range.this_type

    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
  11. def ilk: Any.Ilk
    Attributes
    protected
    Definition Classes
    _Class
  12. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  13. def join(that: Range[Int]): Range.this_type

    Union

    Union

    Returns range with out-most reaches of this and that

    'A' <> 'C' join 'X' <> 'Z'.lp  // Prints: A <> Z
    Definition Classes
    _Trait
  14. def make(start: Int, startExcl: Boolean, end: Int, endExcl: Boolean): Range
    Attributes
    protected
    Definition Classes
    _Class → Base
  15. def map[B](m: (Int) ⇒ 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
  16. def move(positions: Int): Range

    Range move

    Range move

    Creates a new Range, where elements of this are shifted by positions

    (0 <> 1) move 2 lp  // Prints: 2 <>> 4
    
    (5 <> 7) move -1 lp // Prints: 3 <>> 6
    Definition Classes
    _Class
  17. def ordering: Int.type

    Ordering

    Ordering

    Ordering defining range

    Without Ordering cannot be defined

    Definition Classes
    _Class_Trait
  18. def overlapOpt(that: Range[Int]): Opt[Range.this_type]

    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. def resizeBy(change: Int): Range

    Resize

    Resize

    Creates a new Range with changed size

    (0 <> 1) resizeBy 2 lp  // Prints: 0 <>> 4
    
    (1 <> 7) resizeBy -2 lp // Prints: 1 <>> 6
    Definition Classes
    _Class
  20. def size: Int

    Size

    Size

    Returns range size, which is equal to end - start

    (2 <>> 5).size lp  // Prints: 3
    Definition Classes
    _Class
  21. def start: Int

    From value

    From value

    Start value of the range

    Definition Classes
    _Class_Trait
  22. def startContains(i: Int, x: Boolean = false): Boolean
    Attributes
    protected
    Definition Classes
    _Class → Base
  23. 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
    _Class_Trait
  24. def thisClass: Class[_]
    Attributes
    protected
    Definition Classes
    _Class → Base
  25. def toArray: scala.Array[Int]

    Array of indexes

    Array of indexes

    Returns all indexes belonging to the range as Array[Int]

    (5 <> 10).toArray.all lp // Prints: ~(5, 6, 7, 8, 9, 10)
    Definition Classes
    _Class
  26. def toInts: Ints

    Convert to Ints

    Convert to Ints

    Returns all indexes belonging to the range as Ints

    (3 <>> 9).toInts.all lp // Prints: ~(3, 4, 5, 6, 7, 8)
    Definition Classes
    _Class
  27. 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
Range[Int], Base[Int], AnyVal, Any
Source: _Class.scala