J.Util.Proxy.Idx.OM.Base

trait Base[A] extends Idx.OM[A] with J.Util.Proxy.Idx.M.Base[A] with J.Util.Proxy.Idx.O.Base[A] with J.Util.Proxy[Idx.OM[A]]
Source
Idx.scala
trait J.Util.Proxy.Idx.O.Base[J.Util.Proxy.Idx.OM.Base.A]
trait J.Util.Proxy.Idx.M.Base[J.Util.Proxy.Idx.OM.Base.A]
trait J.Util.Proxy.Collection.M.Base[J.Util.Proxy.Idx.OM.Base.A]
trait J.Util.Proxy.Idx.Base[J.Util.Proxy.Idx.OM.Base.A]
trait J.Util.Proxy.Collection.Base[J.Util.Proxy.Idx.OM.Base.A]
trait J.Util.Proxy[Idx.ObservableMutable[J.Util.Proxy.Idx.OM.Base.A]]
trait Idx.ObservableMutable[J.Util.Proxy.Idx.OM.Base.A]
trait Collection.ObservableMutable[J.Util.Proxy.Idx.OM.Base.A]
trait Idx.Mutable[J.Util.Proxy.Idx.OM.Base.A]
trait Able.Contain[J.Util.Proxy.Idx.OM.Base.A]
trait Collection.Mutable[J.Util.Proxy.Idx.OM.Base.A]
trait Able.Add[J.Util.Proxy.Idx.OM.Base.A]
trait Idx.Observable[J.Util.Proxy.Idx.OM.Base.A]
trait Collection.Observable[J.Util.Proxy.Idx.OM.Base.A]
trait Idx[J.Util.Proxy.Idx.OM.Base.A]
trait Collection[J.Util.Proxy.Idx.OM.Base.A]
trait Able.Size
trait Able.Stream[J.Util.Proxy.Idx.OM.Base.A]
class java.lang.Object
trait scala.Matchable
class Any
class J.Util.Proxy.Idx.OM[J.Util.Proxy.Idx.OM.A]

Def

inline def ++=(v: Opt[A]): J.Util.Proxy.Idx.OM.Base[A]

Alias for addAll

Alias for addAll

Generally Opt could be added as a stream.

This overload is sligtly more efficient, but it is also required for mapped Opt expressions, where Opt type is harder to resolve and it would not compile.

Inherited from
Add
Source
Add.scala
inline def ++=(v: Stream[A]): J.Util.Proxy.Idx.OM.Base[A]

Alias for addAll

Alias for addAll

Calls addAll and returns container

 // Generic example
 val x =  Idx.M(1, 2, 3)

 x ++= (4 <> 6) ++= Stream(7, 8, 9)

 x.stream.tp // Stream(1, 2, 3, 4, 5, 6, 7, 8, 9)
Inherited from
Add
Source
Add.scala
inline def ++@=(position: Int, v: Stream[A]): J.Util.Proxy.Idx.OM.Base[A]

Alias for addAllAt

Alias for addAllAt

Adds stream elements at given position

  // Generic example
  val x = ('A' <> 'F').stream.toBuffer

  x ++@= (4, 'e' <> 'g') ++@= (1, Stream('b','c','d'))

  x.stream.tp // Prints Stream(A, b, c, d, B, C, D, e, f, g, E, F)
Inherited from
Mutable
Source
__.scala
inline def +=(v: A): J.Util.Proxy.Idx.OM.Base[A]

Alias for add

Alias for add

Calls add and returns container

 // Generic example
 val x =  Idx.M(1, 2, 3)

  x += 4 += 5 += 6

  x.stream.tp // Prints Stream(1, 2, 3, 4, 5, 6)
Inherited from
Add
Source
Add.scala
inline def +@=(position: Int, v: A): J.Util.Proxy.Idx.OM.Base[A]

Alias for addAt

Alias for addAt

Adds element at given position

  // Generic example
  val x = ('A' <> 'F').stream.toBuffer

  x +@= (3, 'd') +@= (2, 'c') +@= (1, 'b') +@= (0, 'a')

  x.stream.tp // Prints Stream(a, A, b, B, c, C, d, D, E, F)
Inherited from
Mutable
Source
__.scala

Alias for removeAll

Alias for removeAll

Removes all collection elements, which are equal to those in given stream

Returns the collection itself

Inherited from
Mutable
Source
Mutable.scala

Alias for remove

Alias for remove

Removes all collection elements, which are equal to the given value

Returns the collection itself

Inherited from
Mutable
Source
Mutable.scala
override def add(v: A): Unit

Add

Add

Adds given value to target container

 // Generic example
 val x =  Idx.M(1, 2, 3)

  x.add(4)
  x.add(5)
  x.add(6)

  x.stream.tp // Prints Stream(1, 2, 3, 4, 5, 6)
Definition Classes
Base -> Base -> Mutable -> Add
Inherited from
Base
Source
Idx.scala
override def addAll(v: Stream[A]): Unit

Add many

Add many

Adds given stream of elements to target container

 // Generic example
 val x =  Idx.M(1, 2, 3)

  x.addAll(4 <> 6)
  x.addAll( Stream(7,8,9))

  x.stream.tp // Stream(1, 2, 3, 4, 5, 6, 7, 8, 9)
Definition Classes
Base -> Base -> Mutable -> Add
Inherited from
Base
Source
Idx.scala
override def addAllAt(n: Int, e: Stream[A]): Unit

Add stream at position

Add stream at position

Adds stream elements at given position

  // Generic example
  val x = ('A' <> 'F').stream.toBuffer

  x.addAllAt(4, 'e' <> 'g')
  x.addAllAt(1, Stream('b','c','d'))

  x.stream.tp // Prints Stream(A, b, c, d, B, C, D, e, f, g, E, F)
Definition Classes
Inherited from
Base
Source
Idx.scala
override def addAt(n: Int, e: A): Unit

Add at position

Add at position

Adds element at given position

  // Generic example
  val x = ('A' <> 'F').stream.toBuffer

  x.addAt(3, 'd')
  x.addAt(2, 'c')
  x.addAt(1, 'b')
  x.addAt(0, 'a')

  x.stream.tp // Prints Stream(a, A, b, B, c, C, d, D, E, F)
Definition Classes
Inherited from
Base
Source
Idx.scala
override def apply(i: Int): A

Returns element at specified position

Returns element at specified position

 val idx: Idx[Char] = ('A' <> 'Z').stream.pack

 idx(1).tp // Prints: B

 idx(4).tp // Prints: E
Definition Classes
Inherited from
Base
Source
Idx.scala
override def clear: Unit

Remove everything

Remove everything

Discards all elements, so the colection size will become 0

Definition Classes
Inherited from
Base
Source
Idx.scala
override def contains(v: A): Boolean

Check if contains

Check if contains

Returns true if given element is contained by the implementing container

Definition Classes
Inherited from
Base
Source
Idx.scala
def modify(ch: Idx.M[A] => Unit): Unit
Source
Idx.scala
final override def onAdd[U](l: A => U): Event.Control

On element add

On element add

Subscribes given function to element add event

val co: Collection.ObservableMutable[Int] = Collection.OM[Int]()

co.onAdd("Added: "+ _ tp())

co ++= 1 <> 3

// Output
Added: 1
Added: 2
Added: 3
Definition Classes
Inherited from
Observable
Source
__.scala
override def onChange[U](l: Pack[Idx.Observable.Event[A]] => U): Event.Control

On event

On event

Subscribes given function to all element changes

val idx: Idx.OM[Int] = Idx.OM[Int]()

idx.onChange(_.stream.tp)

idx ++= 1 <> 5

idx(2) = 22

idx.removeRange(3 <> 4)

idx.stream.tp

// Output
Stream(IdxChange{type=Add,range=0 <> 4,items=[1,2,3,4,5]})
Stream(IdxChange{type=Update,range=2 <> 2,items=22,oldItems=3})
Stream(IdxChange{type=Remove,range=3 <> 4,items=[4,5]})
Stream(1, 2, 22)
Definition Classes
Inherited from
Base
Source
Idx.scala
def onObservableChange[U](l: () => U): Event.Control
Inherited from
Observable
Source
Observable.scala
final override def onRemove[U](l: A => U): Event.Control

On element remove

On element remove

Subscribes given function to element remove event

val co: Collection.ObservableMutable[Int] = Collection.OM[Int]()

co.onRemove("Removed: "+ _ tp())

co ++= 1 <> 10

co --= 5 <> 7

// Output
Removed: 7
Removed: 6
Removed: 5
Definition Classes
Inherited from
Observable
Source
__.scala
def refreshAt(i: Int): Unit

Creates a refresh event

Creates a refresh event

Refresh event is an Update event for specified elements, where old and new values are the same.

Supposedly, the elements themself are mutable and their representation has to be "refreshed"

Inherited from
ObservableMutable
Source
__.scala
def refreshRange(i: Int.Range): Unit
Source
Idx.scala
override def remove(v: A): Int

Remove element

Remove element

Removes all collection elements, which are equal to the given value

Returns count of removed elements, which can be 0, 1, or many

Definition Classes
Inherited from
Base
Source
Collection.scala
override def removeAll(s: Stream[A]): Int

Remove all streamed

Remove all streamed

Removes all collection elements, which are equal to those in given stream

Returns count of removed elements, which can be 0, 1, or many

Definition Classes
Inherited from
Base
Source
Collection.scala
override def removeAt(i: Int): Unit

Remove at position

Remove at position

Removes element at given position

 // Generic example
 val x = ('A' <> 'D').stream.toBuffer

 x.remove(2)
 x.remove(1)

 x.stream.tp // Prints Stream(A, D)
Definition Classes
Inherited from
Base
Source
Idx.scala
override def removeRange(r: Int.Range): Unit

Remove range

Remove range

Removes elements at given range

 // Generic example
 val x = (0 <> 10).stream.toBuffer

 x.remove(7 <> 8)
 x.remove(2 <> 4)

 x.stream.tp // Prints Stream(0, 1, 5, 6, 9, 10)
Definition Classes
Inherited from
Base
Source
Idx.scala
def replaceWith(v: Stream[A]): Unit

Replace everything

Replace everything

Discards all old elements and adds all provided elements

Inherited from
Mutable
Source
Mutable.scala
override def reposition(v: Idx.Permutation): Unit

Reorganizes elements

Reorganizes elements

Reorganizes elements according to the given permutation

  val im: Idx.Mutable[Int] = (0 <> 9).stream.toBuffer

  val p = Idx.Permutation.pairs(3 -> 7, 7 -> 3, 4 -> 6, 6 -> 4)

  im.stream.tp
  im.reposition(p)
  im.stream.tp

  // Output
  Stream(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
  Stream(0, 1, 2, 7, 6, 5, 4, 3, 8, 9)
Definition Classes
Inherited from
Base
Source
Idx.scala
override def size: Int
Definition Classes
Inherited from
Base
Source
Collection.scala
override def sort(using Ordering[A]): Unit

Sort elements

Sort elements

Sorts elements in this container

Definition Classes
Inherited from
Base
Source
Idx.scala
override def stream: Stream[A]

Stream elements

Stream elements

Returns a stream of all collection elements

Unless specifically defined, the order must be assumed as random

  val c = Collection(1,3,5,7)
  c.stream.tp

  // Output
  Stream(1, 3, 5, 7)
Definition Classes
Inherited from
Base
Source
Idx.scala
override def updateAllAt(i: Int, s: Stream[A]): Unit

Update many at position

Update many at position

Replaces elements starting at given position with stream values

Definition Classes
Inherited from
Base
Source
Idx.scala
override def updateAt(n: Int, a: A): Unit

Update at position

Update at position

Replaces element at given position with given value

  val im: Idx.Mutable[Int] = (0 <> 7).stream.toBuffer

  im.updateAt(7, 777)
  im.updateAt(3, 333)

  im.stream.tp // Prints Stream(0, 1, 2, 333, 4, 5, 6, 777)

  // The same can be done with Scala symplified syntax

  im(7) = 777
  im(3) = 333

Definition Classes
Inherited from
Base
Source
Idx.scala