containerTypes

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

This package serves to define the set of types that the containers will implement. These interfaces are meant to be composed together if necessary to allow for very specific sub-types of containers to be specified.

Index

Constants

View Source
const (
	// A constant that may be passed to the pop function of the [DeleteOps]
	// interface to specify popping all values.
	PopAll int = math.MaxInt
)

Variables

View Source
var Duplicate = errors.New("The container already contains the supplied value.")
View Source
var Empty = errors.New("The container is empty.")
View Source
var Full = errors.New("The container is full.")
View Source
var KeyError = errors.New("The supplied key was invalid.")
View Source
var UpdateViolation = errors.New("Attempting to update the supplied value would violate uniqueness constraints.")
View Source
var ValueError = errors.New("The supplied value was invalid.")

Functions

This section is empty.

Types

type Addressable

type Addressable interface{ IsAddressable() bool }

An interface that determines if a container is addressable or not.

type Capacity

type Capacity interface{ Capacity() int }

An interface that allows access to the containers capacity.

type Clear

type Clear interface{ Clear() }

An iterface that allows a container to be cleared, deleting all values.

type Comparisons

type Comparisons[RI any, V any] interface {
	UnorderedEq(other RI) bool
	IsSuperset(other RI) bool
	IsSubset(other RI) bool
}

An interface that defines what value-only comparisons can be performed on a container.

type ComparisonsOtherConstraint

type ComparisonsOtherConstraint[V any] interface {
	RWSyncable
	Addressable
	Length
	ReadOps[V]
}

An interface that defines what kinds of values can be passed to the methods in the Comparisons interface.

type DeleteDirectedGraphOps

type DeleteDirectedGraphOps[V any, E any] interface {
	DeleteLink(from V, to V, e E) error
	DeleteLinkPntr(from *V, to *V, e *E) error
	DeleteLinks(from V, to V) error
	DeleteLinksPntr(from *V, to *V) error
}

An interface that enforces implementaiton of delete-only, directed, graph structure, operations.

type DeleteGraphOps

type DeleteGraphOps[V any, E any] interface {
	DeleteVertex(v V) error
	DeleteVertexPntr(v *V) error
	DeleteEdge(e E) error
	DeleteEdgePntr(e *E) error
}

An interface that enforces implementaiton of delete-only, graph structure, operations.

type DeleteKeyedOps

type DeleteKeyedOps[K any, V any] interface {
	Delete(idx K) error
}

An interface that enforces implementation of delete-only, key/value, operations.

type DeleteKeyedSequentialOps

type DeleteKeyedSequentialOps[K any, V any] interface {
	DeleteSequential(start int, end int) error
}

An interface that enforces implementation of delete-only, key/value, operations.

type DeleteOps

type DeleteOps[K any, V any] interface {
	Pop(v V) int
	PopPntr(v *V) int
}

An interface that enforces implementation of delete-only, value-only, operations.

type DeleteSequentialOps

type DeleteSequentialOps[K any, V any] interface {
	PopSequential(v V, num int) int
}

An interface that enforces implementation of delete-only, value-only, sequential operations.

type FirstElemDelete

type FirstElemDelete[V any] interface {
	PopFront() (V, error)
}

An interface that enforces the implementation of delete-only first element access.

type FirstElemRead

type FirstElemRead[V any] interface {
	PeekFront() (V, error)
	PeekPntrFront() (*V, error)
}

An interface that enforces the implementation of read-only first element access.

type FirstElemWrite

type FirstElemWrite[V any] interface {
	PushFront(v ...V) error
	ForcePushFront(v ...V)
}

An interface that enforces the implementation of write-only first element access.

type GraphComparisonsConstraint

type GraphComparisonsConstraint[V any, E any] interface {
	RWSyncable
	Addressable
	ReadGraphOps[V, E]
}

An interface that defines what kinds of values can be passed to the methods in the Comparisons and KeyedComparisons interfaces.

type KeyedComparisons

type KeyedComparisons[RI any, K any, V any] interface {
	KeyedEq(other RI) bool
}

An interface that defines what key/value comparisons can be performed on a container that has keyed values.

type KeyedComparisonsOtherConstraint

type KeyedComparisonsOtherConstraint[K any, V any] interface {
	RWSyncable
	Addressable
	Length
	ReadKeyedOps[K, V]
}

An interface that defines what kinds of values can be passed to the methods in the KeyedComparisons interface.

type LastElemDelete

type LastElemDelete[V any] interface {
	PopBack() (V, error)
}

An interface that enforces the implementation of delete-only last element access.

type LastElemRead

type LastElemRead[V any] interface {
	PeekBack() (V, error)
	PeekPntrBack() (*V, error)
}

An interface that enforces the implementation of read-only last element access.

type LastElemWrite

type LastElemWrite[V any] interface {
	PushBack(v ...V) error
	ForcePushBack(v ...V)
}

An interface that enforces the implemntation of write-only last element access.

type Length

type Length interface{ Length() int }

An interface that allows access to the containers length.

type RWSyncable

type RWSyncable interface {
	Lock()
	RLock()
	Unlock()
	RUnlock()
	IsSynced() bool
}

An interface that exposes the RWMutex's interface as well as a convience function that will be used to determine if something is synced or if it simply implements this interface as a pass through.

type ReadGraphOps

type ReadGraphOps[V any, E any] interface {
	NumLinks() int
	NumEdges() int
	NumVertices() int
	Edges() iter.Iter[E]
	EdgePntrs() iter.Iter[*E]
	Vertices() iter.Iter[V]
	VerticePntrs() iter.Iter[*V]
	GetEdge(e *E) error
	GetVertex(v *V) error
	ContainsEdge(e E) bool
	ContainsEdgePntr(e *E) bool
	ContainsVertex(v V) bool
	ContainsVertexPntr(v *V) bool
	OutEdges(v V) iter.Iter[E]
	OutEdgePntrs(v *V) iter.Iter[*E]
	NumOutLinks(v V) int
	NumOutLinksPntr(v *V) int
	OutVertices(v V) iter.Iter[V]
	OutVerticePntrs(v *V) iter.Iter[*V]
	OutEdgesAndVertices(v V) iter.Iter[basic.Pair[E, V]]
	OutEdgesAndVerticePntrs(v *V) iter.Iter[basic.Pair[*E, *V]]
	EdgesBetween(from V, to V) iter.Iter[E]
	EdgesBetweenPntr(from *V, to *V) iter.Iter[*E]
	ContainsLink(from V, to V, e E) bool
	ContainsLinkPntr(from *V, to *V, e *E) bool
}

An interface that enforces implementation of read-only, graph structure, opertions.

type ReadKeyedOps

type ReadKeyedOps[K any, V any] interface {
	Get(k K) (V, error)
	GetPntr(k K) (*V, error)
	KeyOf(v V) (K, bool)
	KeyOfPntr(v *V) (K, bool)
	Keys() iter.Iter[K]
}

An interface that enforces implementation of read-only, key/value, operations.

type ReadOps

type ReadOps[V any] interface {
	Vals() iter.Iter[V]
	ValPntrs() iter.Iter[*V]
	Contains(v V) bool
	ContainsPntr(v *V) bool
}

An interface that enforces implementation of read-only, value-only, operations.

type ReadUniqueOps

type ReadUniqueOps[V any] interface {
	GetUnique(v *V) error
}

An interface that enforces implementation of read-only, value-only, operations.

type SetOperations

type SetOperations[RI any, V any] interface {
	Intersection(l RI, r RI)
	Union(l RI, r RI)
	Difference(l RI, r RI)
}

An interface that defines what set-wise operations can be performed on a container.

type StaticCapacity

type StaticCapacity interface {
	Capacity
	Full() bool
}

An interface that defines what it means to have static capacity. Note that there is no DynamicCapacity interface, meaning that all containers are considered to be dynamic by default and are only static if explicity stated so by the implementation of this interface.

type WriteDynKeyedOps

type WriteDynKeyedOps[K any, V any] interface {
	Insert(kvPairs ...basic.Pair[K, V]) error
	InsertSequential(idx K, v ...V) error
}

An interface that enforces implementation of write-only, key/value, dynamic key, operations. A dynamic key operation is an operation that allows changing the value of a key but also allows changing of multiple keys as a result of that operation.

type WriteGraphOps

type WriteGraphOps[V any, E any] interface {
	AddEdges(e ...E) error
	AddVertices(v ...V) error
	UpdateEdge(orig E, updateOp func(orig *E)) error
	UpdateVertex(orig V, updateOp func(orig *E)) error
	Link(from V, to V, e E) error
	LinkPntr(from *V, to *V, e *E) error
}

An interface that enforces implementation of write-only, graph structure, operations.

type WriteKeyedOps

type WriteKeyedOps[K any, V any] interface {
	Set(kvPairs ...basic.Pair[K, V]) error
}

An interface that enforces implementation of write-only, key/value, operations.

type WriteKeyedSequentialOps

type WriteKeyedSequentialOps[K any, V any] interface {
	SetSequential(k K, v ...V) error
}

An interface that enforces implementation of write-only, key/value, sequential operations.

type WriteOps

type WriteOps[V any] interface {
	Append(vals ...V) error
}

An interface that enforces implementation of write-only, value-only, operations.

type WriteStaticKeyedOps

type WriteStaticKeyedOps[K any, V any] interface {
	Emplace(kvPairs ...basic.Pair[K, V]) error
}

An interface that enforces implementation of write-only, key/value, static key, sequential, operations. A static key operation is an operation that allows changing the value of a key but does not allow changing of multiple keys as a result of that operation.

type WriteStaticKeyedSequentialOps

type WriteStaticKeyedSequentialOps[K any, V any] interface {
	EmplaceSequential(idk K, v ...V) error
}

An interface that enforces implementation of write-only, key/value, static key, operations. A static key operation is an operation that allows changing the value of a key but does not allow changing of multiple keys as a result of that operation.

type WriteUniqueKeyedOps

type WriteUniqueKeyedOps[K any, V any] interface {
	EmplaceUnique(idx K, v V) error
}

An interface that enforces implementation of write-only, key/value, unique valued, operations.

type WriteUniqueOps

type WriteUniqueOps[K any, V any] interface {
	AppendUnique(vals ...V) error
	UpdateUnique(orig V, updateOp func(orig *V)) error
}

An interface that enforces implementation of write-only, value-only, unique valued, operations.

Jump to

Keyboard shortcuts

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