module

package module
v4.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 5 Imported by: 23

Documentation

Overview

Package "module" defines a universal constructor for each class that is exported by this module. Each constructor delegates the actual construction process to one of the classes defined in a subpackage for this module.

For detailed documentation on this entire module refer to the wiki:

This package follows the Crater Dog Technologies™ (craterdog) Go Coding Conventions located here:

Most of the classes defined in this module utilize a notation class to handle the parsing and formatting of instances of each class using a specific notation. The default notation is Crater Dog Collection Notation™ (CDCN), but others like JSON and XML could be supported as well.

Index

Constants

View Source
const (
	LesserRank  = age.LesserRank
	EqualRank   = age.EqualRank
	GreaterRank = age.GreaterRank
)

Variables

This section is empty.

Functions

func Array

func Array[V any](arguments ...any) col.ArrayLike[V]

Array[V] returns a new instance of an array collection of values. Any of the following argument types may be passed to this function:

  • NotationLike
  • uint representing the size of the array
  • []V
  • Sequential[V]
  • string containing CDCN source code

func Association

func Association[K comparable, V any](arguments ...any) col.AssociationLike[K, V]

Association[K, V] returns a new instance of an association between a key and value pair. The key and value are passed as arguments into this function.

func Catalog

func Catalog[K comparable, V any](arguments ...any) col.CatalogLike[K, V]

Catalog[K, V] returns a new instance of a catalog collection of key-value pairs. Any of the following argument types may be passed to this function:

  • NotationLike
  • map[K]V
  • []AssociationLike[K, V]
  • Sequential[AssociationLike[K, V]]
  • string containing CDCN source code

func FormatValue added in v4.11.0

func FormatValue(value any) (source string)

FormatValue returns the CDCN formatted source string for the specified collection value.

func ImplementsAspect added in v4.12.0

func ImplementsAspect(value any, aspect any) bool

ImplementsAspect determines whether or not the specified value implements the specified aspect. Since the aspect is a Go interface it must be passed into this function as follows:

ImplementAspect(value, (*AnAspect)(nil))

This passes a nil valued argument with the aspect type as the second argument.

func IsDefined added in v4.13.0

func IsDefined(value any) bool

IsDefined determines whether of not the specified value is defined. The Go language does not provide an easy way to test this so we provide this function to make it easier. The result of the function is determined logically as:

  • The value is a pointer and not set to nil; or
  • The value is not a pointer and has a valid value.

An integer with a value of zero, for example is defined.

func IsUndefined added in v4.11.0

func IsUndefined(value any) bool

IsUndefined determines whether of not the specified value is undefined. The Go language does not provide an easy way to test this so we provide this function to make it easier. The result of the function is determined logically as:

  • The value is a pointer and set to nil; or
  • The value is not a pointer and has an invalid value.

An empty string, for example, is undefined.

func List

func List[V any](arguments ...any) col.ListLike[V]

List[V] returns a new instance of a list collection of values. Any of the following argument types may be passed to this function:

  • NotationLike
  • []V
  • Sequential[V]
  • string containing CDCN source code

func Map

func Map[K comparable, V any](arguments ...any) col.MapLike[K, V]

Map[K, V] returns a new instance of a map collection of key-value pairs. Any of the following argument types may be passed to this function:

  • NotationLike
  • map[K]V
  • []AssociationLike[K, V]
  • Sequential[AssociationLike[K, V]]
  • string containing CDCN source code

func ParseSource added in v4.11.0

func ParseSource(source string) (value any)

ParseSource parses a source string for a collection defined using CDCN. It returns the corresponding collection value.

func Queue

func Queue[V any](arguments ...any) col.QueueLike[V]

Queue[V] returns a new instance of a queue collection of values. Any of the following argument types may be passed to this function:

  • NotationLike
  • uint representing the capacity of the queue
  • []V
  • Sequential[V]
  • string containing CDCN source code

func Set

func Set[V any](arguments ...any) col.SetLike[V]

Set[V] returns a new instance of a set collection of values. Any of the following argument types may be passed to this function:

  • NotationLike
  • []V
  • Sequential[V]
  • string containing CDCN source code
  • CollatorLike for ordering the set values

func Stack

func Stack[V any](arguments ...any) col.StackLike[V]

Stack[V] returns a new instance of a stack collection of values. Any of the following argument types may be passed to this function:

  • NotationLike
  • uint representing the capacity of the stack
  • []V
  • Sequential[V]
  • string containing CDCN source code

Types

type NotationLike added in v4.1.0

type NotationLike = col.NotationLike

func CDCN

func CDCN(arguments ...any) NotationLike

CDCN returns a notation class supporting the Crater Dog Technologies™ collection notation. It allows collections to be formatted using CDCN and then parsed to reconstruct the collections.

func JSON

func JSON(arguments ...any) NotationLike

JSON returns a notation class supporting the JavaScript Object Notation. It allows collections to be formatted using JSON and then parsed to reconstruct the collections.

NOTE: This notation is not yet supported.

func XML

func XML(arguments ...any) NotationLike

XML returns a notation class supporting the eXtensible Markup Language. It allows collections to be formatted using XML and then parsed to reconstruct the collections.

NOTE: This notation is not yet supported.

type Rank added in v4.15.0

type Rank = age.Rank

Directories

Path Synopsis
Package "agent" defines a set of agents that operate on values of a generic type.
Package "agent" defines a set of agents that operate on values of a generic type.
Package "cdcn" provides a set of classes that provide an implementation of the notation-like abstract class for parsing and formatting source files containing Crater Dog Collection Notation™ (CDCN).
Package "cdcn" provides a set of classes that provide an implementation of the notation-like abstract class for parsing and formatting source files containing Crater Dog Collection Notation™ (CDCN).
Package "collection" defines a set of simple, pragmatic abstract types and interfaces for Go based collections of values.
Package "collection" defines a set of simple, pragmatic abstract types and interfaces for Go based collections of values.

Jump to

Keyboard shortcuts

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