elements

package
v0.0.0-...-d9996d1 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DaysPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerDay) // ~30.436875 days/month
View Source
const DaysPerYear float64 = float64(MillisecondsPerYear) / float64(MillisecondsPerDay) // ~365.2425 days/year
View Source
const Epoch = Moment(0)
View Source
const MillisecondsPerDay int = MillisecondsPerHour * 24
View Source
const MillisecondsPerHour int = MillisecondsPerMinute * 60
View Source
const MillisecondsPerMinute int = MillisecondsPerSecond * 60
View Source
const MillisecondsPerMonth int = MillisecondsPerYear / 12 // An average but exact value.
View Source
const MillisecondsPerSecond int = 1000
View Source
const MillisecondsPerWeek int = MillisecondsPerDay * 7
View Source
const MillisecondsPerYear int = 31556952000
View Source
const WeeksPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerWeek) // ~4.348125 weeks/month

Variables

View Source
var Angles = &angles{}

This singleton creates a unique name space for the library functions for angle elements.

View Source
var Booleans = &booleans{}

This singleton creates a unique name space for the library functions for boolean elements.

View Source
var I abs.NumberLike = Number(complex(0.0, 1.0))
View Source
var Infinity abs.NumberLike = Number(infinity)
View Source
var Moments = &moments{}

This singleton creates a unique name space for the library functions for moment elements.

View Source
var None abs.PatternLike = Pattern(`^none$`)
View Source
var Numbers = &numbers{}

This singleton creates a unique name space for the library functions for number elements.

View Source
var One abs.NumberLike = Number(complex(1.0, 0.0))
View Source
var Probabilities = &probabilities{}

This singleton creates a unique name space for the library functions for probability elements.

View Source
var Tau abs.AngleLike = Angle(tau)
View Source
var Undefined abs.NumberLike = Number(undefined)
View Source
var Zero abs.NumberLike = Number(zero)

Functions

func AngleFromFloat

func AngleFromFloat(float float64) abs.AngleLike

This constructor creates a new angle from the specified value and normalizes the value to be in the allowed range for angles [0..τ).

func DurationFromInt

func DurationFromInt(milliseconds int) abs.DurationLike

This constructor creates a new duration of time element from the specified integer number of milliseconds.

func MaximumAngle

func MaximumAngle() abs.AngleLike

This constructor returns the maximum value for an angle.

func MaximumDuration

func MaximumDuration() abs.DurationLike

This constructor returns the maximum value for a duration of time.

func MaximumInteger

func MaximumInteger() abs.IntegerLike

This constructor returns the maximum value for an integer endpoint.

func MaximumMoment

func MaximumMoment() abs.MomentLike

This constructor returns the latest value for a moment.

func MaximumNumber

func MaximumNumber() abs.NumberLike

This constructor returns the maximum value for a number.

func MaximumPercentage

func MaximumPercentage() abs.PercentageLike

This constructor returns the maximum value for a percentage.

func MaximumProbability

func MaximumProbability() abs.ProbabilityLike

This constructor returns the maximum value for a probability.

func MaximumReal

func MaximumReal() abs.RealLike

This constructor returns the maximum value for a real endpoint.

func MaximumRune

func MaximumRune() abs.RuneLike

This constructor returns the maximum value for a rune endpoint.

func MinimumAngle

func MinimumAngle() abs.AngleLike

This constructor returns the minimum value for an angle.

func MinimumDuration

func MinimumDuration() abs.DurationLike

This constructor returns the minimum value for a duration of time.

func MinimumInteger

func MinimumInteger() abs.IntegerLike

This constructor returns the minimum value for an integer endpoint.

func MinimumMoment

func MinimumMoment() abs.MomentLike

This constructor returns the earliest value for a moment.

func MinimumNumber

func MinimumNumber() abs.NumberLike

This constructor returns the minimum value for a number.

func MinimumPercentage

func MinimumPercentage() abs.PercentageLike

This constructor returns the minimum value for a percentage.

func MinimumProbability

func MinimumProbability() abs.ProbabilityLike

This constructor returns the minimum value for a probability.

func MinimumReal

func MinimumReal() abs.RealLike

This constructor returns the minimum value for a real endpoint.

func MinimumRune

func MinimumRune() abs.RuneLike

This constructor returns the minimum value for a rune endpoint.

func MomentFromInt

func MomentFromInt(milliseconds int) abs.MomentLike

This constructor creates a new moment in time element from the specified integer number of milliseconds since the UNIX Epoch in the UTC timezone.

func Now

func Now() abs.MomentLike

This constructor creates a new moment in time element for the current time in the UTC timezone.

func NumberFromComplex

func NumberFromComplex(complex_ complex128) abs.NumberLike

This constructor creates a new number that is mapped to the Riemann Sphere.

This mapping removes many of the idiosyncrasies associated with the normal complex plane. There is only one value for zero and one value for infinity. This simplifies a lot of the mathematical operations:

z + zero => z
z + infinity => infinity

z - infinity => infinity     {z != infinity}
infinity - z => infinity     {z != infinity}

z * zero => zero             {z != infinity}
z * infinity => infinity     {z != zero}

z / zero => infinity         {z != zero}
zero / z => zero             {z != zero}

z / infinity => zero         {z != infinity}
infinity / z => infinity     {z != infinity}

z ^ zero => one              {by definition}
zero ^ z => zero             {z != zero}

z ^ infinity => zero         {|z| < one}
z ^ infinity => one          {|z| = one}
z ^ infinity => infinity     {|z| > one}
infinity ^ z => infinity     {z != zero}

log(z, zero) => infinity     {zero < z < infinity}
log(zero, z) => zero         {zero < z < infinity}

log(z, one) => zero          {zero < z}
log(one, z) => zero          {zero < z}

log(z, infinity) => infinity {zero < z < infinity}
log(infinity, z) => zero     {zero < z < infinity}

This leaves only the following operations undefined:

infinity - infinity => undefined
zero * infinity => undefined
zero / zero => undefined
infinity / infinity => undefined
log(zero, zero) => undefined
log(zero, infinity) => undefined
log(infinity, zero) => undefined
log(infinity, infinity) => undefined

The resulting number system is easier to use for most applications. For numerical analysis the ANSI plus and minus zero values are often used as a crutch that leads to misleading convergence information for oscillating functions. In the case of numerical analysis it is probably better to track the course of the function as it converges than to look at the final value.

func NumberFromPolar

func NumberFromPolar(magnitude float64, phase abs.AngleLike) abs.NumberLike

func PatternFromString

func PatternFromString(string_ string) abs.PatternLike

This constructor creates a new pattern from the specified string.

func PercentageFromFloat

func PercentageFromFloat(float float64) abs.PercentageLike

This constructor creates a new percentage element from the specified float.

func PercentageFromInt

func PercentageFromInt(integer int) abs.PercentageLike

This constructor creates a new percentage element from the specified integer.

func ProbabilityFromBool

func ProbabilityFromBool(boolean bool) abs.ProbabilityLike

This constructor creates a new probability from the specified boolean value.

func ProbabilityFromFloat

func ProbabilityFromFloat(float float64) abs.ProbabilityLike

This constructor creates a new probability and constrains the value to be in the allowed range for probabilities [0..1].

func RandomProbability

func RandomProbability() abs.ProbabilityLike

This constructor creates a new random probability.

func ResourceFromString

func ResourceFromString(string_ string) abs.ResourceLike

This constructor creates a new resource from the specified universal resource identifier (URI) string.

func ResourceFromURI

func ResourceFromURI(url *uri.URL) abs.ResourceLike

This constructor creates a new resource from the specified universal resource identifier (URI) pointer.

Types

type Angle

type Angle float64

This type defines the methods associated with angle elements. It extends the native Go float64 type and represents a radian based angle in the range [0..2π).

func (Angle) AsReal

func (v Angle) AsReal() float64

This method returns a real value for this continuous element.

func (Angle) IsInfinite

func (v Angle) IsInfinite() bool

This method determines whether or not this continuous element is infinite.

func (Angle) IsUndefined

func (v Angle) IsUndefined() bool

This method determines whether or not this continuous element is undefined.

func (Angle) IsZero

func (v Angle) IsZero() bool

This method determines whether or not this continuous element is zero.

type Boolean

type Boolean bool

This type defines the methods associated with boolean elements. It extends the native Go bool type.

func (Boolean) AsBoolean

func (v Boolean) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Boolean) AsInteger

func (v Boolean) AsInteger() int

This method returns an integer value for this discrete element.

type Duration

type Duration int

This type defines the methods associated with time duration elements. It extends the native Go `int` type and its value represents the number of milliseconds for the entire duration of time. Durations can be negative.

func (Duration) AsBoolean

func (v Duration) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Duration) AsDays

func (v Duration) AsDays() float64

This method returns the total number of days in this duration.

func (Duration) AsHours

func (v Duration) AsHours() float64

This method returns the total number of hours in this duration.

func (Duration) AsInteger

func (v Duration) AsInteger() int

This method returns an integer value for this discrete element.

func (Duration) AsMilliseconds

func (v Duration) AsMilliseconds() float64

This method returns the total number of milliseconds in this duration.

func (Duration) AsMinutes

func (v Duration) AsMinutes() float64

This method returns the total number of minutes in this duration.

func (Duration) AsMonths

func (v Duration) AsMonths() float64

This method returns the total number of months in this duration.

func (Duration) AsSeconds

func (v Duration) AsSeconds() float64

This method returns the total number of seconds in this duration.

func (Duration) AsWeeks

func (v Duration) AsWeeks() float64

This method returns the total number of weeks in this duration.

func (Duration) AsYears

func (v Duration) AsYears() float64

This method returns the total number of years in this duration.

func (Duration) GetDays

func (v Duration) GetDays() int

This method returns the days part of this duration.

func (Duration) GetHours

func (v Duration) GetHours() int

This method returns the hours part of this duration.

func (Duration) GetMilliseconds

func (v Duration) GetMilliseconds() int

This method returns the milliseconds part of this duration.

func (Duration) GetMinutes

func (v Duration) GetMinutes() int

This method returns the minutes part of this duration.

func (Duration) GetMonths

func (v Duration) GetMonths() int

This method returns the months part of this duration.

func (Duration) GetSeconds

func (v Duration) GetSeconds() int

This method returns the seconds part of this duration.

func (Duration) GetWeeks

func (v Duration) GetWeeks() int

This method returns the weeks part of this duration.

func (Duration) GetYears

func (v Duration) GetYears() int

This method returns the years part of this duration.

func (Duration) IsNegative

func (v Duration) IsNegative() bool

This method determines whether or not this polarized component is negative.

type Integer

type Integer int

This type defines the methods associated with integer endpoints. It extends the native Go int type.

func (Integer) AsBoolean

func (v Integer) AsBoolean() bool

This method returns a boolean value for this rune.

func (Integer) AsInteger

func (v Integer) AsInteger() int

This method returns an integer value for this rune.

func (Integer) IsNegative

func (v Integer) IsNegative() bool

This method determines whether or not this rune is negative.

type Moment

type Moment int

This type defines the methods associated with moment in time elements. It extends the native Go int type and represents the number of milliseconds after the UNIX Epoch (Midnight, January 1, 1970 UTC) for a moment of tim. All moments are based on UTC.

func (Moment) AsBoolean

func (v Moment) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Moment) AsDays

func (v Moment) AsDays() float64

This method returns the total number of days since the UNIX Epoch in this moment.

func (Moment) AsHours

func (v Moment) AsHours() float64

This method returns the total number of hours since the UNIX Epoch in this moment.

func (Moment) AsInteger

func (v Moment) AsInteger() int

This method returns an integer value for this discrete element.

func (Moment) AsMilliseconds

func (v Moment) AsMilliseconds() float64

This method returns the total number of milliseconds since the UNIX Epoch in this moment.

func (Moment) AsMinutes

func (v Moment) AsMinutes() float64

This method returns the total number of minutes since the UNIX Epoch in this moment.

func (Moment) AsMonths

func (v Moment) AsMonths() float64

This method returns the total number of months since the UNIX Epoch in this moment.

func (Moment) AsSeconds

func (v Moment) AsSeconds() float64

This method returns the total number of seconds since the UNIX Epoch in this moment.

func (Moment) AsWeeks

func (v Moment) AsWeeks() float64

This method returns the total number of weeks since the UNIX Epoch in this moment.

func (Moment) AsYears

func (v Moment) AsYears() float64

This method returns the total number of years since the UNIX Epoch in this moment.

func (Moment) GetDays

func (v Moment) GetDays() int

This method returns the day part of this moment.

func (Moment) GetHours

func (v Moment) GetHours() int

This method returns the hour part of this moment.

func (Moment) GetMilliseconds

func (v Moment) GetMilliseconds() int

This method returns the millisecond part of this moment.

func (Moment) GetMinutes

func (v Moment) GetMinutes() int

This method returns the minute part of this moment.

func (Moment) GetMonths

func (v Moment) GetMonths() int

This method returns the month part of this moment.

func (Moment) GetSeconds

func (v Moment) GetSeconds() int

This method returns the second part of this moment.

func (Moment) GetWeeks

func (v Moment) GetWeeks() int

This method returns the week part of this moment.

func (Moment) GetYears

func (v Moment) GetYears() int

This method returns the year part of this moment.

type Number

type Number complex128

This type defines the methods associated with number elements. It extends the native Go complex128 type and may represent an integer, real, or complex number.

func (Number) AsComplex

func (v Number) AsComplex() complex128

This method returns a native complex value for this continuous component.

func (Number) AsReal

func (v Number) AsReal() float64

This method returns a real value for this continuous component.

func (Number) GetImaginary

func (v Number) GetImaginary() float64

This method returns the imaginary part of this complex component.

func (Number) GetMagnitude

func (v Number) GetMagnitude() float64

This method returns the magnitude of this complex component.

func (Number) GetPhase

func (v Number) GetPhase() abs.AngleLike

This method returns the phase angle of this complex component.

func (Number) GetReal

func (v Number) GetReal() float64

This method returns the real part of this complex component.

func (Number) IsInfinite

func (v Number) IsInfinite() bool

This method determines whether or not this number is infinite.

func (Number) IsNegative

func (v Number) IsNegative() bool

This method determines whether or not this polarized component is negative.

func (Number) IsUndefined

func (v Number) IsUndefined() bool

This method determines whether or not this number is undefined.

func (Number) IsZero

func (v Number) IsZero() bool

This method determines whether or not this number is zero.

type Pattern

type Pattern string

This type defines the methods associated with a character pattern that extends the native Go string type and represents the regular expression corresponding to that pattern.

func (Pattern) AsString

func (v Pattern) AsString() string

This method returns a string value for this lexical element.

func (Pattern) GetMatches

func (v Pattern) GetMatches(text string) []string

This method returns an array of strings containing all matching strings and substrings found in the specified text.

func (Pattern) MatchesText

func (v Pattern) MatchesText(text string) bool

This method determines whether or not this pattern matches the specified text string.

type Percentage

type Percentage float64

This type defines the methods associated with percentage elements. It extends the native Go float64 type and represents a percentage. Percentages can be negative.

func (Percentage) AsBoolean

func (v Percentage) AsBoolean() bool

This method returns a boolean value for this discrete element.

func (Percentage) AsInteger

func (v Percentage) AsInteger() int

This method returns an integer value for this discrete element.

func (Percentage) AsReal

func (v Percentage) AsReal() float64

This method returns a real value for this continuous element.

func (Percentage) IsInfinite

func (v Percentage) IsInfinite() bool

This method determines whether or not this continuous element is infinite.

func (Percentage) IsNegative

func (v Percentage) IsNegative() bool

This method determines whether or not this polarized component is negative.

func (Percentage) IsUndefined

func (v Percentage) IsUndefined() bool

This method determines whether or not this continuous element is undefined.

func (Percentage) IsZero

func (v Percentage) IsZero() bool

This method determines whether or not this continuous element is zero.

type Probability

type Probability float64

This type defines the methods associated with probability elements. It extends the native Go float64 type and represents a probability in the range [0..1].

func (Probability) AsBoolean

func (v Probability) AsBoolean() bool

This method returns a probability value for this discrete element.

func (Probability) AsInteger

func (v Probability) AsInteger() int

This method returns an integer value for this discrete element.

func (Probability) AsReal

func (v Probability) AsReal() float64

This method returns a real value for this continuous element.

func (Probability) IsInfinite

func (v Probability) IsInfinite() bool

This method determines whether or not this continuous element is infinite.

func (Probability) IsUndefined

func (v Probability) IsUndefined() bool

This method determines whether or not this continuous element is undefined.

func (Probability) IsZero

func (v Probability) IsZero() bool

This method determines whether or not this continuous element is zero.

type Real

type Real float64

This type defines the methods associated with real endpoints. It extends the native Go float64 type.

func (Real) AsReal

func (v Real) AsReal() float64

This method returns a real value for this real number.

func (Real) IsInfinite

func (v Real) IsInfinite() bool

This method determines whether or not this real number is infinite.

func (Real) IsNegative

func (v Real) IsNegative() bool

This method determines whether or not this real number is negative.

func (Real) IsUndefined

func (v Real) IsUndefined() bool

This method determines whether or not this real number is undefined.

func (Real) IsZero

func (v Real) IsZero() bool

This method determines whether or not this real number is zero.

type Resource

type Resource string

This type defines the methods associated with a web resource element that extends the native Go string type and represents the URI corresponding to that web resource.

func (Resource) AsString

func (v Resource) AsString() string

This method returns a string value for this lexical element.

func (Resource) GetAuthority

func (v Resource) GetAuthority() string

This method returns the authority part of this resource element.

func (Resource) GetFragment

func (v Resource) GetFragment() string

This method returns the fragment part of this resource element.

func (Resource) GetPath

func (v Resource) GetPath() string

This method returns the path part of this resource element.

func (Resource) GetQuery

func (v Resource) GetQuery() string

This method returns the query part of this resource element.

func (Resource) GetScheme

func (v Resource) GetScheme() string

This method returns the scheme part of this resource element.

type Rune

type Rune int32

This type defines the methods associated with rune endpoints. It extends the native Go int32 type.

func (Rune) AsBoolean

func (v Rune) AsBoolean() bool

This method returns a boolean value for this rune.

func (Rune) AsInteger

func (v Rune) AsInteger() int

This method returns an integer value for this rune.

Jump to

Keyboard shortcuts

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