Package com.jetbrains.rd.util.reactive

Types

Link copied to clipboard
enum AddRemove : Enum<AddRemove>

A type of change in a collection.

Link copied to clipboard
class ConcurrentViewableSet<T> : IViewableConcurrentSet<T>
Link copied to clipboard
interface IAppendOnlyViewableConcurrentSet<T> : Iterable<T>
Link copied to clipboard
interface IAsyncSignal<T> : ISignal<T> , IAsyncSource<T>
Link copied to clipboard
interface IAsyncSource<out T> : ISource<T>

An object that allows to subscribe to events of type T and to handle them on a different thread.

Link copied to clipboard
interface IAsyncViewableMap<K : Any, V : Any> : IViewableMap<K, V> , IAsyncSource<IViewableMap.Event<K, V>>
Link copied to clipboard
typealias IAsyncVoidSignal = IAsyncSignal<Unit>
Link copied to clipboard
interface IMutablePropertyBase<T> : IPropertyBase<T>
Link copied to clipboard
interface IMutableViewableList<V : Any> : MutableList<V> , IViewableList<V>
Link copied to clipboard
interface IMutableViewableMap<K : Any, V : Any> : MutableMap<K, V> , IViewableMap<K, V>
Link copied to clipboard
interface IMutableViewableSet<T : Any> : MutableSet<T> , IViewableSet<T>
Link copied to clipboard
interface IOptProperty<T : Any> : IOptPropertyView<T> , IMutablePropertyBase<T>

A mutable property that is created in an uninitialized state.

Link copied to clipboard
interface IOptPropertyView<out T : Any> : IPropertyBase<T>

A read-only property that is created in an uninitialized state and can be observed.

Link copied to clipboard
interface IProperty<T> : IPropertyView<T> , IMutablePropertyBase<T>

A mutable property.

Link copied to clipboard
interface IPropertyBase<out T> : ISource<T> , IViewable<T>

Common base class of optional and non-optional properties. Shouldn't be used in client code.

Link copied to clipboard
interface IPropertyView<out T> : IPropertyBase<T>

A read-only property that can be observed.

Link copied to clipboard
interface IScheduler

Allows to queue the execution of actions on a different thread.

Link copied to clipboard
interface ISchedulerWithBackground : IScheduler
Link copied to clipboard
interface ISignal<T> : ISource<T>

An object which has a collection of event listeners and can broadcast an event to the listeners.

Link copied to clipboard
interface ISource<out T>

An object that allows to subscribe to events of type T.

Link copied to clipboard
interface IViewable<out T>

An object that allows to subscribe to changes of its contents.

Link copied to clipboard
interface IViewableConcurrentSet<T> : IAppendOnlyViewableConcurrentSet<T>
Link copied to clipboard
interface IViewableList<out V : Any> : List<V> , IViewable<Pair<Int, V>> , ISource<IViewableList.Event<V>>

A list allowing its contents to be observed.

Link copied to clipboard
interface IViewableMap<K : Any, out V : Any> : Map<K, V> , IViewable<Map.Entry<K, V>> , ISource<IViewableMap.Event<K, V>>

A map allowing its contents to be observed.

Link copied to clipboard
interface IViewableSet<T : Any> : Set<T> , IViewable<T> , ISource<IViewableSet.Event<T>>

A set allowing its contents to be observed.

Link copied to clipboard
typealias IVoidSignal = ISignal<Unit>
Link copied to clipboard
typealias IVoidSource = ISource<Unit>
Link copied to clipboard
data class KeyValuePair<K, V>(val key: K, val value: V) : Map.Entry<K, V>
Link copied to clipboard
open class OptProperty<T : Any> : IOptProperty<T>
Link copied to clipboard
class Property<T>(defaultValue: T) : IProperty<T>
Link copied to clipboard
class Pump(val pumpAction: () -> Unit, val pumpPauseMs: Long)
Link copied to clipboard
class RdFault(    val reasonTypeFqn: String,     val reasonMessage: String,     val reasonAsText: String,     reason: Throwable? = null) : ExecutionException
Link copied to clipboard
open class Signal<T> : ISignal<T>
Link copied to clipboard
sealed class TaskResult<out T>
Link copied to clipboard
class ViewableList<T : Any>(storage: MutableList<T> = mutableListOf()) : IMutableViewableList<T>
Link copied to clipboard
class ViewableMap<K : Any, V : Any>(map: MutableMap<K, V> = LinkedHashMap()) : IMutableViewableMap<K, V>
Link copied to clipboard
class ViewableSet<T : Any>(set: MutableSet<T> = LinkedHashSet<T>()) : IMutableViewableSet<T>
Link copied to clipboard
class WriteOnceProperty<T : Any> : IOptProperty<T>

Functions

Link copied to clipboard
fun IVoidSource.advise(lifetime: Lifetime, handler: () -> Unit)
Link copied to clipboard
fun <T> ISource<T>.adviseEternal(handler: (T) -> Unit)

Adds an event subscription that never gets removed.

Link copied to clipboard
fun <T : Any> ISource<T?>.adviseNotNull(lifetime: Lifetime, handler: (T) -> Unit)

Adds an event subscription that filters out null values.

Link copied to clipboard
fun <T : Any> ISource<T?>.adviseNotNullOnce(lifetime: Lifetime, handler: (T) -> Unit): LifetimeDefinition

Executes handler exactly once when the source fires an event with a non-null value, then terminates the subscription

Link copied to clipboard
fun IAsyncSource<Unit>.adviseOn(    lifetime: Lifetime,     scheduler: IScheduler,     handler: () -> Unit)
Link copied to clipboard
fun <T> ISource<T>.adviseOnce(lifetime: Lifetime, handler: (T) -> Unit)

Executes handler exactly once then terminates the subscription

Link copied to clipboard
fun <T> ISource<T>.adviseUntil(lifetime: Lifetime, handler: (T) -> Boolean)

Holds subscription until handler returns true or lifetime is terminated

Link copied to clipboard
fun <T> ISource<T>.adviseWithPrev(lifetime: Lifetime, handler: (prev: Maybe<T>, cur: T) -> Unit)
Link copied to clipboard
fun IOptPropertyView<Boolean>.and(other: IOptPropertyView<Boolean>): IOptPropertyView<Boolean>
fun IPropertyView<Boolean>.and(other: IPropertyView<Boolean>): IPropertyView<Boolean>
Link copied to clipboard
fun <T : Any> IOptPropertyView<T>.asNullable(): IPropertyView<T?>

Converts an optional property to a non-optional property with a nullable value type.

Link copied to clipboard
fun <T> IMutablePropertyBase<T>.bind(    lifetime: Lifetime,     setValue: (value: T) -> Unit,     valueUpdated: ((value: T) -> Unit) -> Unit)
Link copied to clipboard
fun <T1 : Any, T2 : Any, TRes : Any> IOptPropertyView<T1>.compose(other: IOptPropertyView<T2>, composer: (T1, T2) -> TRes): IOptPropertyView<TRes>
fun <T1, T2, TRes> IPropertyView<T1>.compose(other: IPropertyView<T2>, composer: (T1, T2) -> TRes): IPropertyView<TRes>
Link copied to clipboard
fun <K : Any, V : Any> IViewableMap<K, V>.createIsEmpty(): IPropertyView<Boolean>
fun <T : Any> IViewableSet<T>.createIsEmpty(): IPropertyView<Boolean>
fun <K : Any, V : Any> IViewableMap<K, V>.createIsEmpty(lifetime: Lifetime): IPropertyView<Boolean>
fun <T : Any> IViewableSet<T>.createIsEmpty(lifetime: Lifetime): IPropertyView<Boolean>
Link copied to clipboard
fun <K : Any, V : Any> IViewableMap<K, V>.createIsNotEmpty(): IPropertyView<Boolean>
fun <T : Any> IViewableSet<T>.createIsNotEmpty(): IPropertyView<Boolean>
fun <K : Any, V : Any> IViewableMap<K, V>.createIsNotEmpty(lifetime: Lifetime): IPropertyView<Boolean>
fun <T : Any> IViewableSet<T>.createIsNotEmpty(lifetime: Lifetime): IPropertyView<Boolean>
Link copied to clipboard
fun <T> ISource<T>.distinct(): ISource<T>
Link copied to clipboard
fun <T> ISource<T>.filter(f: (T) -> Boolean): ISource<T>
Link copied to clipboard
fun IVoidSignal.fire()
Link copied to clipboard
fun <TSrc> ISource<TSrc>.flowInto(lifetime: Lifetime, target: IMutablePropertyBase<TSrc>)
fun <TSrc : Any, TDst : Any> ISource<IViewableList.Event<TSrc>>.flowInto(    lifetime: Lifetime,     target: IMutableViewableList<TDst>,     tf: (TSrc) -> TDst)
fun <TKey : Any, TValue : Any> ISource<IViewableMap.Event<TKey, TValue>>.flowInto(    lifetime: Lifetime,     target: IMutableViewableMap<TKey, TValue>,     tf: (TValue) -> TValue)
fun <TSrc : Any, TDst : Any> ISource<IViewableSet.Event<TSrc>>.flowInto(    lifetime: Lifetime,     target: IMutableViewableSet<TDst>,     tf: (TSrc) -> TDst)

fun <T> ISource<T>.flowInto(lifetime: Lifetime, target: ISignal<T>)

Whenever a change happens in this source, fires a change in the target signal of the same type.

fun <TSrc, TDst> ISource<TSrc>.flowInto(    lifetime: Lifetime,     target: IMutablePropertyBase<TDst>,     tf: (TSrc) -> TDst)

Whenever a change happens in this source, changes the target property of the same type.

fun <TSource, TTarget> ISource<TSource>.flowInto(    lifetime: Lifetime,     target: ISignal<TTarget>,     tf: (TSource) -> TTarget)

Whenever a change happens in this source, fires a change in the target signal obtained by running the given tf function.

Link copied to clipboard
fun <TSource, TResult : Any> Iterable<IPropertyView<TSource>>.fold(    lifetime: Lifetime,     initial: TResult,     func: (TResult, TSource) -> TResult): OptProperty<TResult>
Link copied to clipboard
fun <TSource : Any, TResult : Any> Iterable<IOptPropertyView<TSource>>.foldOpt(    lifetime: Lifetime,     initial: TResult,     func: (TResult, TSource) -> TResult): OptProperty<TResult>
Link copied to clipboard
fun <TSource, TResult : Any> List<IPropertyView<TSource>>.foldRight(    lifetime: Lifetime,     initial: TResult,     func: (TSource, TResult) -> TResult): OptProperty<TResult>
Link copied to clipboard
fun <TSource : Any, TResult : Any> List<IOptPropertyView<TSource>>.foldRightOpt(    lifetime: Lifetime,     initial: TResult,     func: (TSource, TResult) -> TResult): OptProperty<TResult>
Link copied to clipboard
fun <T : Any, R : Any> IOptPropertyView<T>.map(f: (T) -> R): IOptPropertyView<R>
fun <T, R> IPropertyView<T>.map(f: (T) -> R): IPropertyView<R>

fun <T, R> ISource<T>.map(f: (T) -> R): ISource<R>

Returns a new source which remaps events happening in this source using the given function f.

Link copied to clipboard
fun IOptPropertyView<Boolean>.not(): IOptPropertyView<Boolean>
fun IPropertyView<Boolean>.not(): IPropertyView<Boolean>
Link copied to clipboard
fun IOptPropertyView<Boolean>.or(other: IOptPropertyView<Boolean>): IOptPropertyView<Boolean>
fun IPropertyView<Boolean>.or(other: IPropertyView<Boolean>): IPropertyView<Boolean>
Link copied to clipboard
fun <T> IProperty<T?>.setValue(lifetime: Lifetime, value: T?)

Sets the property value to the given value for the duration of the lifetime, and resets it to null when the lifetime is terminated.

Link copied to clipboard
fun <T, K> IPropertyView<T>.switchMap(f: (T) -> IPropertyView<K>): IPropertyView<K>
Link copied to clipboard
fun <K : Any, V : Any, T : Any> IMutableViewableMap<K, V>.toViewableList(lifetime: Lifetime, converter: (Lifetime, V) -> T): ViewableList<T>

Converts a viewable map to a viewable list of values, where the converter function is used to convert each map value to a list value.

Link copied to clipboard
fun <T : Any> IOptProperty<T>.valueOrDefault(default: T): T

Returns the value of the property, or the given default value if the property was not initialized.

Link copied to clipboard
fun <T : Any> IViewableList<T>.viewableTail(): IPropertyView<T?>

Returns a property which evaluates to the last element of the list and is updated as elements are added to the list or removed from it.

Link copied to clipboard
fun <T : Any> IViewable<T?>.viewNotNull(lifetime: Lifetime, handler: (Lifetime, T) -> Unit)

Adds a subscription to changes to this viewable's contents and filters out null values. The subscription is removed when the given lifetime expires.

Link copied to clipboard
fun IViewable<Boolean>.whenFalse(lifetime: Lifetime, action: (Lifetime) -> Unit)

Executes the given action every time the value of the property changes to false.

Link copied to clipboard
fun IViewable<Boolean>.whenTrue(lifetime: Lifetime, action: (Lifetime) -> Unit)

Executes the given action every time the value of the property changes to true.

Properties

Link copied to clipboard
val IOptPropertyView<Boolean>.hasTrueValue: Boolean
Link copied to clipboard
val <T : Any> IOptPropertyView<T>.hasValue: Boolean

Evaluates to true if the property has an initialized value.

Link copied to clipboard
val <T : Any> IOptPropertyView<T>.valueOrThrow: T

Returns the value of the property, or throws an exception if it was not initialized.