sealed trait Locals[T >: Null <: AnyRef] extends AnyRef
THIS DATASTRUCTURE IS ONLY INTENDED TO BE USED BY THE AI FRAMEWORK, DON'T USE IT OTHERWISE.
Conceptually, an array that enables random access and which is heavily optimized for small(er) collections (up to 12 elements) that are frequently compared and updated and where sharing is beneficial.
A Locals
array contains null
values for all elements that are not yet set.
Furthermore, a Locals
array is not resizable and – if used in development mode –
minimizes checks whenever possible. I.e., the user is expected to correctly use
this data structure.
Usage Scenario
For example, the median of the number of registers that are used per method is 2 (JDK and OPAL) and more then 99,5% of all methods have less than 20 elements and in particular those elements related to the parameters do not change often.
- Source
- Locals.scala
- Alphabetic
- By Inheritance
- Locals
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def apply(index: Int): T
Returns the value stored at the given index.
Returns the value stored at the given index.
- Note
If the index is not valid the result is not defined.
- abstract def foreach(f: (T) => Unit): Unit
- abstract def foreachReverse(f: (T) => Unit): Unit
- abstract def fuse(other: Locals[T], onDiff: (T, T) => T): Locals[T]
Merges this
Locals
data-structure with the givenLocals
.Merges this
Locals
data-structure with the givenLocals
. If the pairwise merge of those values that are different always results in values that are reference equal to this local's elements or the other local's elements, the return value will bethis
orother
, otherwise a new locals data structure is created.- other
Another
Locals
data-structure that has the the same number of elements as thisLocals
data-structure.
- abstract def indexOf(other: T): Option[Int]
- abstract def indexOfLastNonNullValue: Int
The index of the last value that is not
null
; if all values arenull
or if we have no locals, -1 is returned. - abstract def isEmpty: Boolean
- abstract def map[X >: Null <: AnyRef](f: (T) => X)(implicit arg0: ClassTag[X]): Locals[X]
- abstract def mapConserve(f: (T) => T): Locals[T]
Transforms the values of this locals array.
Transforms the values of this locals array. If all values are the same as before
this
is returned otherwise a new Locals object is created which contains the updated values. - abstract def mapKV[X >: Null <: AnyRef](startIndex: Int, f: (Int, T) => X)(implicit arg0: ClassTag[X]): Locals[X]
- Attributes
- protected[this]
- abstract def nonEmpty: Boolean
- abstract def set(index: Int, value: T): Unit
Sets the value at the given index to the given value.
Sets the value at the given index to the given value.
- Note
If the index is not valid the result is not defined.
- abstract def size: Int
- abstract def update(f: (T) => T): Unit
Applies the given function to all elements and updates the value stored at the respective index.
Applies the given function to all elements and updates the value stored at the respective index. Compared to
map
an in-place update is performed.- Note
For those values which are not yet set,
null
is passed tof
.
- abstract def updated(index: Int, value1: T, value2: T, value3: T): Locals[T]
Creates a new Locals object where the values stored at the given index and the two subsequent indexes are set to the given values.
- abstract def updated(index: Int, value1: T, value2: T): Locals[T]
Creates a new Locals object where the values stored at the given index and the subsequent index are set to the given values.
- abstract def updated(index: Int, value: T): Locals[T]
Creates a new Locals object where the value stored at the given index is set to the given one.
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- def contains[X >: T](o: X): Boolean
Returns
true
if the given element is already in this list,false
otherwise. - def corresponds[U >: Null <: AnyRef](other: Locals[U])(compare: (T, U) => Boolean): Boolean
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def exists[X >: T](f: (X) => Boolean): Boolean
Returns
true
if an element satisfies the given predicate,false
otherwise. - def find[X >: T](f: (X) => Boolean): Option[T]
Returns the first element that satisfies the given predicate.
- def foldLeft[B](b: B)(op: (B, T) => B): B
Performs a fold left over all elements of this set.
- def foldRight[B](b: B)(op: (B, T) => B): B
- def forall[X >: T](f: (X) => Boolean): Boolean
Returns
true
if all elements satisfy the given predicate,false
otherwise. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- Locals → AnyRef → Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iterator: Iterator[T]
- def mapKV[X >: Null <: AnyRef](f: (Int, T) => X)(implicit arg0: ClassTag[X]): Locals[X]
Maps every key-value pair to a new value.
Maps every key-value pair to a new value. Note, that the value may very well be null.
- def mapToVector[X](f: (T) => X): Vector[X]
Creates a new vector which contains the mapped values as specified by the given function
f
.Creates a new vector which contains the mapped values as specified by the given function
f
.- f
The function that converts this collection's elements.
f
has to be able to handlenull
values if this collection may containnull
values.
- def mkString(start: String, sep: String, end: String): String
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def nthValue[X >: T](f: (X) => Boolean): Int
Counts the number of non-null values that do not match the given given predicate; the index of the first element that matches the predicate is returned.
Counts the number of non-null values that do not match the given given predicate; the index of the first element that matches the predicate is returned.
If no value matches the value -1 is returned.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toSeq: Seq[T]
Creates a Scala sequence which is in reverse order! The sequence may contain
null
values. - def toString(): String
- Definition Classes
- Locals → AnyRef → Any
- final def update(index: Int, value: T): Unit
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- def zip(other: Locals[T]): Iterator[(T, T)]
- def zipWithIndex: Iterator[(T, Int)]
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated