Documentation ¶
Index ¶
- Constants
- Variables
- func AngleFromFloat(float float64) abs.AngleLike
- func DurationFromInt(milliseconds int) abs.DurationLike
- func MaximumAngle() abs.AngleLike
- func MaximumCharacter() abs.CharacterLike
- func MaximumDuration() abs.DurationLike
- func MaximumInteger() abs.IntegerLike
- func MaximumMoment() abs.MomentLike
- func MaximumNumber() abs.NumberLike
- func MaximumPercentage() abs.PercentageLike
- func MaximumProbability() abs.ProbabilityLike
- func MaximumReal() abs.RealLike
- func MinimumAngle() abs.AngleLike
- func MinimumCharacter() abs.CharacterLike
- func MinimumDuration() abs.DurationLike
- func MinimumInteger() abs.IntegerLike
- func MinimumMoment() abs.MomentLike
- func MinimumNumber() abs.NumberLike
- func MinimumPercentage() abs.PercentageLike
- func MinimumProbability() abs.ProbabilityLike
- func MinimumReal() abs.RealLike
- func MomentFromInt(milliseconds int) abs.MomentLike
- func Now() abs.MomentLike
- func NumberFromComplex(complex_ complex128) abs.NumberLike
- func NumberFromPolar(magnitude float64, phase abs.AngleLike) abs.NumberLike
- func PatternFromString(string_ string) abs.PatternLike
- func PercentageFromFloat(float float64) abs.PercentageLike
- func PercentageFromInt(integer int) abs.PercentageLike
- func ProbabilityFromBool(boolean bool) abs.ProbabilityLike
- func ProbabilityFromFloat(float float64) abs.ProbabilityLike
- func RandomProbability() abs.ProbabilityLike
- func ResourceFromString(string_ string) abs.ResourceLike
- func ResourceFromURI(url *uri.URL) abs.ResourceLike
- type Angle
- type Boolean
- type Character
- type Duration
- func (v Duration) AsBoolean() bool
- func (v Duration) AsDays() float64
- func (v Duration) AsHours() float64
- func (v Duration) AsInteger() int
- func (v Duration) AsMilliseconds() float64
- func (v Duration) AsMinutes() float64
- func (v Duration) AsMonths() float64
- func (v Duration) AsSeconds() float64
- func (v Duration) AsWeeks() float64
- func (v Duration) AsYears() float64
- func (v Duration) GetDays() int
- func (v Duration) GetHours() int
- func (v Duration) GetMilliseconds() int
- func (v Duration) GetMinutes() int
- func (v Duration) GetMonths() int
- func (v Duration) GetSeconds() int
- func (v Duration) GetWeeks() int
- func (v Duration) GetYears() int
- func (v Duration) IsNegative() bool
- type Integer
- type Moment
- func (v Moment) AsBoolean() bool
- func (v Moment) AsDays() float64
- func (v Moment) AsHours() float64
- func (v Moment) AsInteger() int
- func (v Moment) AsMilliseconds() float64
- func (v Moment) AsMinutes() float64
- func (v Moment) AsMonths() float64
- func (v Moment) AsSeconds() float64
- func (v Moment) AsWeeks() float64
- func (v Moment) AsYears() float64
- func (v Moment) GetDays() int
- func (v Moment) GetHours() int
- func (v Moment) GetMilliseconds() int
- func (v Moment) GetMinutes() int
- func (v Moment) GetMonths() int
- func (v Moment) GetSeconds() int
- func (v Moment) GetWeeks() int
- func (v Moment) GetYears() int
- type Number
- func (v Number) AsComplex() complex128
- func (v Number) AsReal() float64
- func (v Number) GetImaginary() float64
- func (v Number) GetMagnitude() float64
- func (v Number) GetPhase() abs.AngleLike
- func (v Number) GetReal() float64
- func (v Number) IsInfinite() bool
- func (v Number) IsNegative() bool
- func (v Number) IsUndefined() bool
- func (v Number) IsZero() bool
- type Pattern
- type Percentage
- type Probability
- type Real
- type Resource
Constants ¶
const DaysPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerDay) // ~30.436875 days/month
const DaysPerYear float64 = float64(MillisecondsPerYear) / float64(MillisecondsPerDay) // ~365.2425 days/year
const Epoch = Moment(0)
const MillisecondsPerDay int = MillisecondsPerHour * 24
const MillisecondsPerHour int = MillisecondsPerMinute * 60
const MillisecondsPerMinute int = MillisecondsPerSecond * 60
const MillisecondsPerMonth int = MillisecondsPerYear / 12 // An average but exact value.
const MillisecondsPerSecond int = 1000
const MillisecondsPerWeek int = MillisecondsPerDay * 7
const MillisecondsPerYear int = 31556952000
const WeeksPerMonth float64 = float64(MillisecondsPerMonth) / float64(MillisecondsPerWeek) // ~4.348125 weeks/month
Variables ¶
var Angles = &angles{}
This singleton creates a unique name space for the library functions for angle elements.
var Any abs.PatternLike = Pattern(`.*`)
var Booleans = &booleans{}
This singleton creates a unique name space for the library functions for boolean elements.
var False abs.BooleanLike = Boolean(false)
var I abs.NumberLike = Number(complex(0.0, 1.0))
var Infinity abs.NumberLike = Number(infinity)
var Moments = &moments{}
This singleton creates a unique name space for the library functions for moment elements.
var None abs.PatternLike = Pattern(`^none$`)
var Numbers = &numbers{}
This singleton creates a unique name space for the library functions for number elements.
var One abs.NumberLike = Number(complex(1.0, 0.0))
var Phi abs.NumberLike = Number(complex(mat.Phi, 0.0))
var Probabilities = &probabilities{}
This singleton creates a unique name space for the library functions for probability elements.
var Tau abs.AngleLike = Angle(tau)
var True abs.BooleanLike = Boolean(true)
var Undefined abs.NumberLike = Number(undefined)
var Zero abs.NumberLike = Number(zero)
Functions ¶
func AngleFromFloat ¶
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 ¶
This constructor returns the maximum value for an angle.
func MaximumCharacter ¶ added in v2.1.0
func MaximumCharacter() abs.CharacterLike
This constructor returns the maximum value for a character endpoint.
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 ¶
This constructor returns the maximum value for a real endpoint.
func MinimumAngle ¶
This constructor returns the minimum value for an angle.
func MinimumCharacter ¶ added in v2.1.0
func MinimumCharacter() abs.CharacterLike
This constructor returns the minimum value for a character endpoint.
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 ¶
This constructor returns the minimum value for a real 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) IsInfinite ¶
This method determines whether or not this continuous element is infinite.
func (Angle) IsUndefined ¶
This method determines whether or not this continuous element is undefined.
type Boolean ¶
type Boolean bool
This type defines the methods associated with boolean elements. It extends the native Go bool type.
type Character ¶ added in v2.1.0
type Character int32
This type defines the methods associated with character endpoints. It extends the native Go int32 type.
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) AsMilliseconds ¶
This method returns the total number of milliseconds in this duration.
func (Duration) GetMilliseconds ¶
This method returns the milliseconds part of this duration.
func (Duration) GetMinutes ¶
This method returns the minutes part of this duration.
func (Duration) GetSeconds ¶
This method returns the seconds part of this duration.
func (Duration) IsNegative ¶
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) IsNegative ¶
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) AsDays ¶
This method returns the total number of days since the UNIX Epoch in this moment.
func (Moment) AsHours ¶
This method returns the total number of hours since the UNIX Epoch in this moment.
func (Moment) AsMilliseconds ¶
This method returns the total number of milliseconds since the UNIX Epoch in this moment.
func (Moment) AsMinutes ¶
This method returns the total number of minutes since the UNIX Epoch in this moment.
func (Moment) AsMonths ¶
This method returns the total number of months since the UNIX Epoch in this moment.
func (Moment) AsSeconds ¶
This method returns the total number of seconds since the UNIX Epoch in this moment.
func (Moment) AsWeeks ¶
This method returns the total number of weeks since the UNIX Epoch in this moment.
func (Moment) AsYears ¶
This method returns the total number of years since the UNIX Epoch in this moment.
func (Moment) GetMilliseconds ¶
This method returns the millisecond part of this moment.
func (Moment) GetMinutes ¶
This method returns the minute part of this moment.
func (Moment) GetSeconds ¶
This method returns the second 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) GetImaginary ¶
This method returns the imaginary part of this complex component.
func (Number) GetMagnitude ¶
This method returns the magnitude of this complex component.
func (Number) IsInfinite ¶
This method determines whether or not this number is infinite.
func (Number) IsNegative ¶
This method determines whether or not this polarized component is negative.
func (Number) IsUndefined ¶
This method determines whether or not this number is undefined.
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) GetMatches ¶
This method returns an array of strings containing all matching strings and substrings found in the specified text.
func (Pattern) MatchesText ¶
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) IsInfinite ¶
This method determines whether or not this real number is infinite.
func (Real) IsNegative ¶
This method determines whether or not this real number is negative.
func (Real) IsUndefined ¶
This method determines whether or not this real number is undefined.
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) GetAuthority ¶
This method returns the authority part of this resource element.
func (Resource) GetFragment ¶
This method returns the fragment part of this resource element.