values

package
v0.0.0-...-0a688d3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: MIT Imports: 4 Imported by: 0

README

gcv (GoCalculate Value)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Type

type Type int

Type is the value type of Value

const (
	// Real is for a real value
	Real Type = iota
	// Complex is for a complex value
	Complex
)

type Value

type Value interface {
	// returns the real part of a value
	Real() float64

	// returns the imaginary part of a value
	Imag() float64

	// returns the compelx representation of a value
	Complex() complex128

	// returns the type of raw value
	Type() Type

	// returns true if the Value is equal to zero
	IsZero() bool

	// String will return the string representation of the value
	String() string
}

Value is the main return type for the GoCalculate Framework Values are immutable once created

func MakeValue

func MakeValue(val interface{}) Value

MakeValue returns a Value with value val

func RetrieveValues

func RetrieveValues(vals Values) []Value

RetrieveValues returns a copy of the []Value of vals Values

func Zero

func Zero() Value

Zero will return the zeroValue type as a Value

type Values

type Values interface {

	// Returns the index of val. If val is not in Values it returns -1.
	IndexOf(val Value) int

	// Set the Value val at index
	Set(index int, val Value)

	// Append Value val to Values
	Append(val Value)

	// Returns the Value at index
	Get(index int) Value

	// Returns a subset of Values from start to finish
	Subset(start, finish int) Values

	// Returns a copy of Values.
	Copy() Values

	// Return Length of Values
	Len() int

	// Returns the Core Type of the Values. i.e the highest ranking Type
	Type() Type
	// contains filtered or unexported methods
}

Values works as GoCalculate's main list of values

func MakeValues

func MakeValues(vals ...interface{}) Values

MakeValues returns a Values type, takes in a slice of interfaces. in an interface is not a supported type, that interface will be forced to the zero Value

func MakeValuesAlt

func MakeValuesAlt(vals []Value) Values

MakeValuesAlt returns a Values type, but requires a framework []Value slice

func NewValues

func NewValues(length int) Values

NewValues will return a new Values Type is Real

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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