diff options
author | Christopher Speller <crspeller@gmail.com> | 2017-09-29 12:46:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 12:46:30 -0700 |
commit | b84736e9b6401df0c6eeab9950bef09458a6aefd (patch) | |
tree | d9175208de3236db75a33879750a57b3000ba096 /vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go | |
parent | 8b9dbb86133ff0fd6002a391268383d1593918ca (diff) | |
download | chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.gz chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.tar.bz2 chat-b84736e9b6401df0c6eeab9950bef09458a6aefd.zip |
Updating server dependancies. (#7538)
Diffstat (limited to 'vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go')
-rw-r--r-- | vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go b/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go index 877bcc89d..49ee7dc7c 100644 --- a/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go +++ b/vendor/github.com/nicksnyder/go-i18n/i18n/language/operands.go @@ -7,7 +7,7 @@ import ( ) // http://unicode.org/reports/tr35/tr35-numbers.html#Operands -type operands struct { +type Operands struct { N float64 // absolute value of the source number (integer and decimals) I int64 // integer digits of n V int64 // number of visible fraction digits in n, with trailing zeros @@ -17,7 +17,7 @@ type operands struct { } // NmodEqualAny returns true if o represents an integer equal to any of the arguments. -func (o *operands) NequalsAny(any ...int64) bool { +func (o *Operands) NequalsAny(any ...int64) bool { for _, i := range any { if o.I == i && o.T == 0 { return true @@ -27,7 +27,7 @@ func (o *operands) NequalsAny(any ...int64) bool { } // NmodEqualAny returns true if o represents an integer equal to any of the arguments modulo mod. -func (o *operands) NmodEqualsAny(mod int64, any ...int64) bool { +func (o *Operands) NmodEqualsAny(mod int64, any ...int64) bool { modI := o.I % mod for _, i := range any { if modI == i && o.T == 0 { @@ -38,17 +38,17 @@ func (o *operands) NmodEqualsAny(mod int64, any ...int64) bool { } // NmodInRange returns true if o represents an integer in the closed interval [from, to]. -func (o *operands) NinRange(from, to int64) bool { +func (o *Operands) NinRange(from, to int64) bool { return o.T == 0 && from <= o.I && o.I <= to } // NmodInRange returns true if o represents an integer in the closed interval [from, to] modulo mod. -func (o *operands) NmodInRange(mod, from, to int64) bool { +func (o *Operands) NmodInRange(mod, from, to int64) bool { modI := o.I % mod return o.T == 0 && from <= modI && modI <= to } -func newOperands(v interface{}) (*operands, error) { +func newOperands(v interface{}) (*Operands, error) { switch v := v.(type) { case int: return newOperandsInt64(int64(v)), nil @@ -69,14 +69,14 @@ func newOperands(v interface{}) (*operands, error) { } } -func newOperandsInt64(i int64) *operands { +func newOperandsInt64(i int64) *Operands { if i < 0 { i = -i } - return &operands{float64(i), i, 0, 0, 0, 0} + return &Operands{float64(i), i, 0, 0, 0, 0} } -func newOperandsString(s string) (*operands, error) { +func newOperandsString(s string) (*Operands, error) { if s[0] == '-' { s = s[1:] } @@ -84,7 +84,7 @@ func newOperandsString(s string) (*operands, error) { if err != nil { return nil, err } - ops := &operands{N: n} + ops := &Operands{N: n} parts := strings.SplitN(s, ".", 2) ops.I, err = strconv.ParseInt(parts[0], 10, 64) if err != nil { |