class Selection<K> : Iterable

Known direct subclasses
MutableSelection

Subclass of Selection exposing public support for mutating the underlying selection data.


Object representing a "primary" selection and a "provisional" selection.

This class tracks selected items by managing two sets:

Primary Selection

Primary selection consists of items selected by a user. This represents the selection "at rest", as the selection does not contains items that are in a "provisional" selected state created by way of an ongoing gesture or band operation.

Provisional Selection

Provisional selections are selections which are interim in nature.

Provisional selection exists to address issues where a transitory selection might momentarily intersect with a previously established selection resulting in a some or all of the established selection being erased. Such situations may arise when band selection is being performed in "additive" mode (e.g. SHIFT or CTRL is pressed on the keyboard prior to mouse down), or when there's an active gesture selection (which can be initiated by long pressing an unselected item while there is an existing selection).

Parameters
<K>

Selection key type. @see StorageStrategy for supported types.

See also
MutableSelection

Summary

Public functions

Boolean
contains(key: K?)
Boolean
equals(other: Any!)
Int
Boolean
(Mutable)Iterator<K!>

Returns an Iterator that iterators over the selection, *excluding* any provisional selection.

Int
String!

Inherited functions

From java.lang.Iterable
Unit
forEach(action: Consumer<T!>!)
Spliterator<T!>!

Public functions

contains

Added in 1.0.0
fun contains(key: K?): Boolean
Returns
Boolean

true if the position is currently selected.

equals

fun equals(other: Any!): Boolean

hashCode

fun hashCode(): Int

isEmpty

Added in 1.0.0
fun isEmpty(): Boolean
Returns
Boolean

true if the selection is empty.

iterator

Added in 1.0.0
fun iterator(): (Mutable)Iterator<K!>

Returns an Iterator that iterators over the selection, *excluding* any provisional selection.

size

Added in 1.0.0
fun size(): Int
Returns
Int

size of the selection including both final and provisional selected items.

toString

fun toString(): String!