collectionsfx

package
v0.0.0-...-7b96089 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindList

func BindList[Dst ModifiableObservableList[T], Src ObservableList[V], V, T any](
	dst Dst,
	src Src,
	mapper func(V) T,
) obsfx2.Binding[ObservableList[T]]

func BindListAny

func BindListAny[Dst ModifiableObservableList[T], T any](
	dst Dst,
	src BasicObservableList,
	mapper func(any) T,
) obsfx2.Binding[ObservableList[T]]

func BindListFromMap

func BindListFromMap[Dst ModifiableObservableList[T], Src ObservableMap[K, V], K comparable, V, T any](dst Dst, src Src, mapper func(K, V) T) obsfx2.Binding[ObservableList[T]]

func BindListInterface

func BindListInterface[Dst ListBindingInterface[T], Src ObservableList[V], V, T any](dst Dst, src Src, mapper func(V) T) obsfx2.Binding[ObservableList[T]]

func BindMap

func BindMap[Src ObservableMap[K, V], Dst ModifiableObservableMap[K, T], K comparable, V, T any](
	dst Dst,
	src Src,
	mapper func(K, V) T,
) obsfx.Binding[ObservableMap[K, T]]

func ObserveList

func ObserveList[Src ObservableList[T], T any](src Src, cb func(ev ListChangeEvent[T]))

func ObserveMap

func ObserveMap[Src ObservableMap[K, V], K comparable, V any](src Src, cb func(ev MapChangeEvent[K, V]))

func ObserveSet

func ObserveSet[Src ObservableSet[K], K comparable](src Src, cb func(ev SetChangeEvent[K]))

Types

type BasicListChangeEvent

type BasicListChangeEvent interface {
	BasicList() BasicObservableList

	From() int
	To() int

	AddedCount() int
	RemovedCount() int

	Permutations() []int
	GetPermutation(i int) int

	WasAdded() bool
	WasRemoved() bool
	WasReplaced() bool
	WasUpdated() bool
	WasPermutated() bool

	Next() bool
}

type BasicListListener

type BasicListListener interface {
	OnListChangedRaw(ev BasicListChangeEvent)
}

type BasicObservableList

type BasicObservableList interface {
	obsfx2.Observable

	RawGet(i int) interface{}
	Len() int
	RuntimeElementType() reflect.Type

	AddBasicListListener(listener BasicListListener)
	RemoveBasicListListener(listener BasicListListener)
}

type Comparator

type Comparator[T any] func(a, b T) int

type FilteredList

type FilteredList[T any] struct {
	ObservableListBase[T]
	// contains filtered or unexported fields
}

func NewFilteredList

func NewFilteredList[T any](src ObservableList[T], predicate Predicate[T]) *FilteredList[T]

func (*FilteredList[T]) Close

func (fl *FilteredList[T]) Close()

func (*FilteredList[T]) Contains

func (fl *FilteredList[T]) Contains(value T) bool

func (*FilteredList[T]) Get

func (fl *FilteredList[T]) Get(index int) T

func (*FilteredList[T]) GetSourceIndex

func (fl *FilteredList[T]) GetSourceIndex(index int) int

func (*FilteredList[T]) GetViewIndex

func (fl *FilteredList[T]) GetViewIndex(index int) int

func (*FilteredList[T]) IndexOf

func (fl *FilteredList[T]) IndexOf(value T) int

func (*FilteredList[T]) Iterator

func (fl *FilteredList[T]) Iterator() Iterator[T]

func (*FilteredList[T]) Len

func (fl *FilteredList[T]) Len() int

func (*FilteredList[T]) OnListChanged

func (fl *FilteredList[T]) OnListChanged(ev ListChangeEvent[T])

func (*FilteredList[T]) RawGet

func (fl *FilteredList[T]) RawGet(index int) any

func (*FilteredList[T]) Slice

func (fl *FilteredList[T]) Slice() []T

func (*FilteredList[T]) Source

func (fl *FilteredList[T]) Source() ObservableList[T]

func (*FilteredList[T]) SubSlice

func (fl *FilteredList[T]) SubSlice(from, to int) []T

type Iterable

type Iterable[E any] interface {
	Iterator() Iterator[E]
}

type Iterator

type Iterator[E any] interface {
	Item() E
	Next() bool
	Reset()
}

type KeyValuePair

type KeyValuePair[K comparable, V any] struct {
	Key   K
	Value V
}

type ListBindingInterface

type ListBindingInterface[T any] interface {
	Set(index int, value T)
	Swap(i, j int)
	InsertAll(index int, value ...T)
	RemoveCount(index int, count int)
}

type ListChangeBuilder

type ListChangeBuilder[T any] struct {
	*ObservableListBase[T]

	List ObservableList[T]
	// contains filtered or unexported fields
}

func (*ListChangeBuilder[T]) Begin

func (b *ListChangeBuilder[T]) Begin()

func (*ListChangeBuilder[T]) End

func (b *ListChangeBuilder[T]) End()

func (*ListChangeBuilder[T]) NextAdd

func (b *ListChangeBuilder[T]) NextAdd(from, to int)

func (*ListChangeBuilder[T]) NextPermutation

func (b *ListChangeBuilder[T]) NextPermutation(from, to int, perm []int)

func (*ListChangeBuilder[T]) NextRemove

func (b *ListChangeBuilder[T]) NextRemove(index int, value T)

func (*ListChangeBuilder[T]) NextRemoveRange

func (b *ListChangeBuilder[T]) NextRemoveRange(index int, removed []T)

func (*ListChangeBuilder[T]) NextReplace

func (b *ListChangeBuilder[T]) NextReplace(from, to int, removed []T)

func (*ListChangeBuilder[T]) NextSet

func (b *ListChangeBuilder[T]) NextSet(index int, removed T)

func (*ListChangeBuilder[T]) NextUpdate

func (b *ListChangeBuilder[T]) NextUpdate(index int)

type ListChangeEvent

type ListChangeEvent[T any] interface {
	BasicListChangeEvent

	List() ObservableList[T]

	RemovedSlice() []T
	AddedSlice() []T
}

type ListIterator

type ListIterator[E any] interface {
	Iterator[E]

	Index() int
}

type ListListener

type ListListener[T any] interface {
	OnListChanged(ev ListChangeEvent[T])
}

type ListTransformation

type ListTransformation[V, T any] interface {
	ObservableList[T]

	Source() ObservableList[V]

	GetSourceIndex(index int) int
	GetViewIndex(index int) int
}

type MapChangeEvent

type MapChangeEvent[K comparable, V any] struct {
	Map          ObservableMap[K, V]
	Key          K
	ValueAdded   V
	ValueRemoved V
	WasAdded     bool
	WasRemoved   bool
}

type MapIterator

type MapIterator[K comparable, V any] interface {
	Iterator[KeyValuePair[K, V]]

	Key() K
	Value() V
	Pair() (K, V)
}

type MapListener

type MapListener[K comparable, V any] interface {
	OnMapChanged(ev MapChangeEvent[K, V])
}

type ModifiableObservableList

type ModifiableObservableList[T any] interface {
	ObservableList[T]

	Add(value T) int
	AddAll(value ...T) int
	InsertAt(index int, value T) int
	InsertAll(index int, items ...T) int
	ReplaceAll(items ...T)
	Set(index int, value T)
	Swap(i, j int)
	Remove(value T) bool
	RemoveAt(index int)
	RemoveCount(index int, count int)
	Clear()

	Bind(binding obsfx2.Binding[ObservableList[T]])
	Unbind()
}

type ModifiableObservableMap

type ModifiableObservableMap[K comparable, V any] interface {
	ObservableMap[K, V]

	Set(key K, value V)
	Remove(key K) bool
	Clear()
}

type MutableMap

type MutableMap[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*MutableMap[K, V]) AddListener

func (o *MutableMap[K, V]) AddListener(listener obsfx.InvalidationListener)

func (*MutableMap[K, V]) AddMapListener

func (o *MutableMap[K, V]) AddMapListener(listener MapListener[K, V])

func (*MutableMap[K, V]) Clear

func (o *MutableMap[K, V]) Clear()

func (*MutableMap[K, V]) Get

func (o *MutableMap[K, V]) Get(key K) (V, bool)

func (*MutableMap[K, V]) Has

func (o *MutableMap[K, V]) Has(key K) bool

func (*MutableMap[K, V]) Iterator

func (o *MutableMap[K, V]) Iterator() Iterator[KeyValuePair[K, V]]

func (*MutableMap[K, V]) Keys

func (o *MutableMap[K, V]) Keys() []K

func (*MutableMap[K, V]) Len

func (o *MutableMap[K, V]) Len() int

func (*MutableMap[K, V]) Map

func (o *MutableMap[K, V]) Map() map[K]V

func (*MutableMap[K, V]) MapIterator

func (o *MutableMap[K, V]) MapIterator() MapIterator[K, V]

func (*MutableMap[K, V]) Remove

func (o *MutableMap[K, V]) Remove(key K) bool

func (*MutableMap[K, V]) RemoveListener

func (o *MutableMap[K, V]) RemoveListener(listener obsfx.InvalidationListener)

func (*MutableMap[K, V]) RemoveMapListener

func (o *MutableMap[K, V]) RemoveMapListener(listener MapListener[K, V])

func (*MutableMap[K, V]) Set

func (o *MutableMap[K, V]) Set(key K, value V)

func (*MutableMap[K, V]) Values

func (o *MutableMap[K, V]) Values() []V

type MutableSet

type MutableSet[T comparable] struct {
	ObservableSetBase[T]
	// contains filtered or unexported fields
}

func (*MutableSet[T]) Add

func (s *MutableSet[T]) Add(key T) bool

func (*MutableSet[T]) Clear

func (s *MutableSet[T]) Clear()

func (*MutableSet[T]) Has

func (s *MutableSet[T]) Has(key T) bool

func (*MutableSet[T]) Iterator

func (s *MutableSet[T]) Iterator() Iterator[T]

func (*MutableSet[T]) Len

func (s *MutableSet[T]) Len() int

func (*MutableSet[T]) Remove

func (s *MutableSet[T]) Remove(key T) bool

func (*MutableSet[T]) Slice

func (s *MutableSet[T]) Slice() []T

type MutableSlice

type MutableSlice[T any] struct {
	ObservableListBase[T]
	// contains filtered or unexported fields
}

func (*MutableSlice[T]) Add

func (o *MutableSlice[T]) Add(value T) int

func (*MutableSlice[T]) AddAll

func (o *MutableSlice[T]) AddAll(items ...T) int

func (*MutableSlice[T]) Bind

func (o *MutableSlice[T]) Bind(binding obsfx.Binding[ObservableList[T]])

func (*MutableSlice[T]) Clear

func (o *MutableSlice[T]) Clear()

func (*MutableSlice[T]) Contains

func (o *MutableSlice[T]) Contains(value T) bool

func (*MutableSlice[T]) Get

func (o *MutableSlice[T]) Get(index int) T

func (*MutableSlice[T]) IndexOf

func (o *MutableSlice[T]) IndexOf(value T) int

func (*MutableSlice[T]) InsertAll

func (o *MutableSlice[T]) InsertAll(index int, items ...T) int

func (*MutableSlice[T]) InsertAt

func (o *MutableSlice[T]) InsertAt(index int, value T) int

func (*MutableSlice[T]) Iterator

func (o *MutableSlice[T]) Iterator() Iterator[T]

func (*MutableSlice[T]) Len

func (o *MutableSlice[T]) Len() int

func (*MutableSlice[T]) ListIterator

func (o *MutableSlice[T]) ListIterator() ListIterator[T]

func (*MutableSlice[T]) RawGet

func (o *MutableSlice[T]) RawGet(index int) any

func (*MutableSlice[T]) Remove

func (o *MutableSlice[T]) Remove(value T) bool

func (*MutableSlice[T]) RemoveAt

func (o *MutableSlice[T]) RemoveAt(index int)

func (*MutableSlice[T]) RemoveCount

func (o *MutableSlice[T]) RemoveCount(index int, count int)

func (*MutableSlice[T]) ReplaceAll

func (o *MutableSlice[T]) ReplaceAll(items ...T)

func (*MutableSlice[T]) Set

func (o *MutableSlice[T]) Set(index int, value T)

func (*MutableSlice[T]) Slice

func (o *MutableSlice[T]) Slice() []T

func (*MutableSlice[T]) SubSlice

func (o *MutableSlice[T]) SubSlice(from, to int) []T

func (*MutableSlice[T]) Swap

func (o *MutableSlice[T]) Swap(i, j int)

func (*MutableSlice[T]) Unbind

func (o *MutableSlice[T]) Unbind()

type ObservableList

type ObservableList[T any] interface {
	BasicObservableList

	Iterable[T]

	Get(index int) T
	Slice() []T
	SubSlice(from, to int) []T
	Contains(value T) bool
	IndexOf(value T) int

	AddListListener(listener ListListener[T])
	RemoveListListener(listener ListListener[T])
}

type ObservableListBase

type ObservableListBase[T any] struct {
	// contains filtered or unexported fields
}

func (*ObservableListBase[T]) AddBasicListListener

func (o *ObservableListBase[T]) AddBasicListListener(listener BasicListListener)

func (*ObservableListBase[T]) AddListListener

func (o *ObservableListBase[T]) AddListListener(listener ListListener[T])

func (*ObservableListBase[T]) AddListener

func (o *ObservableListBase[T]) AddListener(listener obsfx2.InvalidationListener)

func (*ObservableListBase[T]) FireListChanged

func (o *ObservableListBase[T]) FireListChanged(ev ListChangeEvent[T])

func (*ObservableListBase[T]) RemoveBasicListListener

func (o *ObservableListBase[T]) RemoveBasicListListener(listener BasicListListener)

func (*ObservableListBase[T]) RemoveListListener

func (o *ObservableListBase[T]) RemoveListListener(listener ListListener[T])

func (*ObservableListBase[T]) RemoveListener

func (o *ObservableListBase[T]) RemoveListener(listener obsfx2.InvalidationListener)

func (*ObservableListBase[T]) RuntimeElementType

func (o *ObservableListBase[T]) RuntimeElementType() reflect.Type

type ObservableMap

type ObservableMap[K comparable, V any] interface {
	obsfx.Observable

	Iterable[KeyValuePair[K, V]]

	Has(key K) bool
	Get(key K) (V, bool)
	Map() map[K]V
	Len() int

	Keys() []K
	Values() []V

	MapIterator() MapIterator[K, V]

	AddMapListener(listener MapListener[K, V])
	RemoveMapListener(listener MapListener[K, V])
}

type ObservableSet

type ObservableSet[K comparable] interface {
	obsfx.Observable

	Iterable[K]

	Has(key K) bool
	Add(key K) bool
	Remove(key K) bool
	Slice() []K
	Len() int

	AddSetListener(listener SetListener[K])
	RemoveSetListener(listener SetListener[K])
}

type ObservableSetBase

type ObservableSetBase[T comparable] struct {
	// contains filtered or unexported fields
}

func (*ObservableSetBase[T]) AddListener

func (o *ObservableSetBase[T]) AddListener(listener obsfx.InvalidationListener)

func (*ObservableSetBase[T]) AddSetListener

func (o *ObservableSetBase[T]) AddSetListener(listener SetListener[T])

func (*ObservableSetBase[T]) FireSetChanged

func (o *ObservableSetBase[T]) FireSetChanged(ev SetChangeEvent[T])

func (*ObservableSetBase[T]) RemoveListener

func (o *ObservableSetBase[T]) RemoveListener(listener obsfx.InvalidationListener)

func (*ObservableSetBase[T]) RemoveSetListener

func (o *ObservableSetBase[T]) RemoveSetListener(listener SetListener[T])

type OnListChangedFunc

type OnListChangedFunc[T any] func(ev ListChangeEvent[T])

func (OnListChangedFunc[T]) OnListChanged

func (o OnListChangedFunc[T]) OnListChanged(ev ListChangeEvent[T])

type OnListChangedRawFunc

type OnListChangedRawFunc[T any] func(ev BasicListChangeEvent)

func (OnListChangedRawFunc[T]) OnListChanged

func (o OnListChangedRawFunc[T]) OnListChanged(ev ListChangeEvent[T])

func (OnListChangedRawFunc[T]) OnListChangedRaw

func (o OnListChangedRawFunc[T]) OnListChangedRaw(ev BasicListChangeEvent)

type OnMapChangedFunc

type OnMapChangedFunc[K comparable, V any] func(ev MapChangeEvent[K, V])

func (OnMapChangedFunc[K, V]) OnMapChanged

func (o OnMapChangedFunc[K, V]) OnMapChanged(ev MapChangeEvent[K, V])

type OnSetChangedFunc

type OnSetChangedFunc[K comparable] func(ev SetChangeEvent[K])

func (OnSetChangedFunc[K]) OnSetChanged

func (o OnSetChangedFunc[K]) OnSetChanged(ev SetChangeEvent[K])

type Predicate

type Predicate[T any] func(a T) bool

type ReflectedObservableList

type ReflectedObservableList struct {
	// contains filtered or unexported fields
}

func (*ReflectedObservableList) AddListListener

func (r *ReflectedObservableList) AddListListener(listener ListListener[any])

func (*ReflectedObservableList) AddListener

func (r *ReflectedObservableList) AddListener(listener obsfx.InvalidationListener)

func (*ReflectedObservableList) Contains

func (r *ReflectedObservableList) Contains(value any) bool

func (*ReflectedObservableList) Get

func (r *ReflectedObservableList) Get(index int) any

func (*ReflectedObservableList) IndexOf

func (r *ReflectedObservableList) IndexOf(value any) int

func (*ReflectedObservableList) Iterator

func (r *ReflectedObservableList) Iterator() Iterator[any]

func (*ReflectedObservableList) Len

func (r *ReflectedObservableList) Len() int

func (*ReflectedObservableList) RemoveListListener

func (r *ReflectedObservableList) RemoveListListener(listener ListListener[any])

func (*ReflectedObservableList) RemoveListener

func (r *ReflectedObservableList) RemoveListener(listener obsfx.InvalidationListener)

func (*ReflectedObservableList) RuntimeElementType

func (r *ReflectedObservableList) RuntimeElementType() reflect.Type

func (*ReflectedObservableList) Slice

func (r *ReflectedObservableList) Slice() []any

func (*ReflectedObservableList) SubSlice

func (r *ReflectedObservableList) SubSlice(from, to int) []any

type SetChangeEvent

type SetChangeEvent[K comparable] struct {
	Set        ObservableSet[K]
	Key        K
	WasAdded   bool
	WasRemoved bool
}

type SetListener

type SetListener[K comparable] interface {
	OnSetChanged(ev SetChangeEvent[K])
}

type SortedList

type SortedList[T any] struct {
	ObservableListBase[T]
	// contains filtered or unexported fields
}

func NewSortedList

func NewSortedList[Src ObservableList[T], T any](src Src, comparator Comparator[T]) *SortedList[T]

func (*SortedList[T]) Close

func (sl *SortedList[T]) Close()

func (*SortedList[T]) Contains

func (sl *SortedList[T]) Contains(value T) bool

func (*SortedList[T]) Get

func (sl *SortedList[T]) Get(index int) T

func (*SortedList[T]) GetSourceIndex

func (sl *SortedList[T]) GetSourceIndex(index int) int

func (*SortedList[T]) GetViewIndex

func (sl *SortedList[T]) GetViewIndex(index int) int

func (*SortedList[T]) IndexOf

func (sl *SortedList[T]) IndexOf(value T) int

func (*SortedList[T]) Iterator

func (sl *SortedList[T]) Iterator() Iterator[T]

func (*SortedList[T]) Len

func (sl *SortedList[T]) Len() int

func (*SortedList[T]) OnListChanged

func (sl *SortedList[T]) OnListChanged(ev ListChangeEvent[T])

func (*SortedList[T]) RawGet

func (sl *SortedList[T]) RawGet(index int) any

func (*SortedList[T]) SetComparator

func (sl *SortedList[T]) SetComparator(comparator Comparator[T])

func (*SortedList[T]) Slice

func (sl *SortedList[T]) Slice() []T

func (*SortedList[T]) Source

func (sl *SortedList[T]) Source() ObservableList[T]

func (*SortedList[T]) SubSlice

func (sl *SortedList[T]) SubSlice(from, to int) []T

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL