Documentation / dataflow-async / com.femastudios.dataflow.async
Go to reference

Package com.femastudios.dataflow.async

Types

Attribute

An Attribute is an object that holds either Loaded value (of type T), a Loading state, or an Error state. These states are all represented by a the sealed class AttributeData.

interface Attribute<out T>

AttributeData

This class represents the content of an Attribute. It is empty and cannot be directly instantiated. This is a sealed class, that has only to descendants: Loaded and NotLoaded.

sealed class AttributeData<out T>

AttributeWrapper

This special implementation of Attribute works similarly to a FieldWrapper, but for attributes.

interface AttributeWrapper<T> : Attribute<T>

Error

This class is one of the extensions of the NotLoaded status, and is used to represent a data whose loading di not succeed. It contains some data that can help inform the user. The class is open and can be extended to add custom data.

open class Error<out T> : NotLoaded<T>

FlowStrategy

This sealed enum-like class defines how the AttributeData of an attribute is calculated.

sealed class FlowStrategy

Loaded

This class is one of the extensions of AttributeData and is used to represent a loaded state.

data class Loaded<out T> : AttributeData<T>

Loading

This class is one of the extensions of the NotLoaded status, and is used to represent a data that is loading. The class is open and can be extended to add custom data.

open class Loading<out T> : NotLoaded<T>

NotLoaded

This class is one of the extensions of AttributeData and is used to represent any state that is not loaded. This is also a sealed class and cannot be directly instantiated. The only two descendants are Error and Loading.

sealed class NotLoaded<out T> : AttributeData<T>

RecomputableAttribute

A special implementation of Attribute that knows how its value was calculated and therefore is able to recompute its value upon request (using the recompute function).

interface RecomputableAttribute<T> : Attribute<T>

TimeShiftedAttribute

This interface represents a Attribute whose value is the value of another Attribute in a previous point in time.

interface TimeShiftedAttribute<out T> : Attribute<T>

TimeShiftedField

This interface represents a Field whose value is the value of another Field in a previous point in time.

interface TimeShiftedField<out T> : Field<T>

WeakWorstStatusWrapper

This Field contains the worst status between all the provided attributes.

interface WeakWorstStatusWrapper : Field<AttributeData<Nothing?>>, AutoCloseable

WorkContext

This class is the receiver of any attribute computation. It provides a way to set the attribute state to something other than Loaded.

abstract class WorkContext

Exceptions

FlowException

Exception that must be thrown only from a WorkContext when calculating an attribute.

class FlowException : RuntimeException

Functions

attributeListener

Utility method to create a FieldListener<AttributeData> from a lambda

fun <T> attributeListener(listener: (Field<AttributeData<T>>, AttributeData<T>) -> Unit): FieldListener<AttributeData<T>>

simpleAttributeListener

Utility method to create a FieldListener<AttributeData> from a lambda

fun <T> simpleAttributeListener(listener: (AttributeData<T>) -> Unit): FieldListener<AttributeData<T>>