lexorank

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2022 License: MIT Imports: 3 Imported by: 0

README

LexoRank

Package lexorank is a simple implementation of LexoRank.

LexoRank is a ranking system introduced by Atlassian JIRA. For details - https://www.youtube.com/watch?v=OjQv9xMoFbg

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LexoRankBucket0, _ = NewLexoRankBucket("0")
	LexoRankBucket1, _ = NewLexoRankBucket("1")
	LexoRankBucket2, _ = NewLexoRankBucket("2")

	LexoRankBuckets = []*LexoRankBucket{LexoRankBucket0, LexoRankBucket1, LexoRankBucket2}
)
View Source
var (
	LexoRankSystem = NewLexoNumeralSystem36()

	MinLexoRank    = NewLexoRank(LexoRankBucket0, minDecimal)
	MaxLexoRank    = NewLexoRank(LexoRankBucket0, maxDecimal)
	MidLexoRank, _ = MinLexoRank.Between(MaxLexoRank)
)
View Source
var (
	DifferentBaseErr = errors.New("expected numbers of same numeral sys")
)

Functions

This section is empty.

Types

type LexoDecimal

type LexoDecimal struct {
	// contains filtered or unexported fields
}

func LexoDecimalMake

func LexoDecimalMake(i *LexoInteger, scale int) *LexoDecimal

func LexoDecimalParse

func LexoDecimalParse(str string, system LexoNumeralSystem) (*LexoDecimal, error)

func NewLexoDecimal

func NewLexoDecimal(mag *LexoInteger, scale int) *LexoDecimal

func (*LexoDecimal) Add

func (d *LexoDecimal) Add(other *LexoDecimal) *LexoDecimal

func (*LexoDecimal) Between

func (d *LexoDecimal) Between(other *LexoDecimal) (*LexoDecimal, error)

func (*LexoDecimal) Ceil

func (d *LexoDecimal) Ceil() *LexoInteger

func (*LexoDecimal) Compare

func (d *LexoDecimal) Compare(other *LexoDecimal) int

func (*LexoDecimal) Equals

func (d *LexoDecimal) Equals(other *LexoDecimal) bool

func (*LexoDecimal) Exact

func (d *LexoDecimal) Exact() bool

func (*LexoDecimal) Floor

func (d *LexoDecimal) Floor() *LexoInteger

func (*LexoDecimal) GetScale

func (d *LexoDecimal) GetScale() int

func (*LexoDecimal) GetSystem

func (d *LexoDecimal) GetSystem() LexoNumeralSystem

func (*LexoDecimal) Multiply

func (d *LexoDecimal) Multiply(other *LexoDecimal) *LexoDecimal

func (*LexoDecimal) SetScale

func (d *LexoDecimal) SetScale(scale int) *LexoDecimal

func (*LexoDecimal) SetScaleWithCeiling

func (d *LexoDecimal) SetScaleWithCeiling(scale int) *LexoDecimal

func (*LexoDecimal) String

func (d *LexoDecimal) String() string

func (*LexoDecimal) Sub

func (d *LexoDecimal) Sub(other *LexoDecimal) *LexoDecimal

type LexoInteger

type LexoInteger struct {
	// contains filtered or unexported fields
}

func LexoIntegerParse

func LexoIntegerParse(strFull string, system LexoNumeralSystem) (*LexoInteger, error)

func NewLexoInteger

func NewLexoInteger(sys LexoNumeralSystem, sign int, mag []byte) *LexoInteger

func (*LexoInteger) Add

func (d *LexoInteger) Add(other *LexoInteger) (*LexoInteger, error)

func (*LexoInteger) Compare

func (d *LexoInteger) Compare(other *LexoInteger) int

func (*LexoInteger) Equals

func (d *LexoInteger) Equals(other *LexoInteger) bool

func (*LexoInteger) GetMag

func (d *LexoInteger) GetMag(idx int) byte

func (*LexoInteger) GetSystem

func (d *LexoInteger) GetSystem() LexoNumeralSystem

func (*LexoInteger) IsZero

func (d *LexoInteger) IsZero() bool

func (*LexoInteger) Multiply

func (d *LexoInteger) Multiply(other *LexoInteger) (*LexoInteger, error)

func (*LexoInteger) ShiftLeft

func (d *LexoInteger) ShiftLeft(times int) *LexoInteger

func (*LexoInteger) ShiftRight

func (d *LexoInteger) ShiftRight(times int) *LexoInteger

func (*LexoInteger) String

func (d *LexoInteger) String() string

func (*LexoInteger) Sub

func (d *LexoInteger) Sub(other *LexoInteger) (*LexoInteger, error)

type LexoNumeralSystem

type LexoNumeralSystem interface {
	GetBase() byte
	GetPositiveChar() byte
	GetNegativeChar() byte
	GetRadixPointChar() byte
	Digit(ch byte) (byte, error)
	Char(digit byte) byte
}

func NewLexoNumeralSystem36

func NewLexoNumeralSystem36() LexoNumeralSystem

type LexoNumeralSystem10

type LexoNumeralSystem10 struct {
}

func NewLexoNumeralSystem10

func NewLexoNumeralSystem10() *LexoNumeralSystem10

func (*LexoNumeralSystem10) Char

func (n *LexoNumeralSystem10) Char(digit byte) byte

func (*LexoNumeralSystem10) Digit

func (n *LexoNumeralSystem10) Digit(ch byte) (byte, error)

func (*LexoNumeralSystem10) GetBase

func (n *LexoNumeralSystem10) GetBase() byte

func (*LexoNumeralSystem10) GetNegativeChar

func (n *LexoNumeralSystem10) GetNegativeChar() byte

func (*LexoNumeralSystem10) GetPositiveChar

func (n *LexoNumeralSystem10) GetPositiveChar() byte

func (*LexoNumeralSystem10) GetRadixPointChar

func (n *LexoNumeralSystem10) GetRadixPointChar() byte

type LexoNumeralSystem36

type LexoNumeralSystem36 struct {
}

func (*LexoNumeralSystem36) Char

func (n *LexoNumeralSystem36) Char(digit byte) byte

func (*LexoNumeralSystem36) Digit

func (n *LexoNumeralSystem36) Digit(ch byte) (byte, error)

func (*LexoNumeralSystem36) GetBase

func (n *LexoNumeralSystem36) GetBase() byte

func (*LexoNumeralSystem36) GetNegativeChar

func (n *LexoNumeralSystem36) GetNegativeChar() byte

func (*LexoNumeralSystem36) GetPositiveChar

func (n *LexoNumeralSystem36) GetPositiveChar() byte

func (*LexoNumeralSystem36) GetRadixPointChar

func (n *LexoNumeralSystem36) GetRadixPointChar() byte

type LexoNumeralSystem64

type LexoNumeralSystem64 struct {
}

func NewLexoNumeralSystem64

func NewLexoNumeralSystem64() *LexoNumeralSystem64

func (*LexoNumeralSystem64) Char

func (n *LexoNumeralSystem64) Char(digit byte) byte

func (*LexoNumeralSystem64) Digit

func (n *LexoNumeralSystem64) Digit(ch byte) (byte, error)

func (*LexoNumeralSystem64) GetBase

func (n *LexoNumeralSystem64) GetBase() byte

func (*LexoNumeralSystem64) GetNegativeChar

func (n *LexoNumeralSystem64) GetNegativeChar() byte

func (*LexoNumeralSystem64) GetPositiveChar

func (n *LexoNumeralSystem64) GetPositiveChar() byte

func (*LexoNumeralSystem64) GetRadixPointChar

func (n *LexoNumeralSystem64) GetRadixPointChar() byte

type LexoRank

type LexoRank struct {
	// contains filtered or unexported fields
}

func LexoRankParse

func LexoRankParse(str string) (*LexoRank, error)

func NewLexoRank

func NewLexoRank(bucket *LexoRankBucket, decimal *LexoDecimal) *LexoRank

func (*LexoRank) Between

func (i *LexoRank) Between(other *LexoRank) (*LexoRank, error)

func (*LexoRank) IsMax

func (i *LexoRank) IsMax() bool

func (*LexoRank) IsMin

func (i *LexoRank) IsMin() bool

func (*LexoRank) Next

func (i *LexoRank) Next() (*LexoRank, error)

func (*LexoRank) Prev

func (i *LexoRank) Prev() (*LexoRank, error)

func (*LexoRank) String

func (i *LexoRank) String() string

type LexoRankBucket

type LexoRankBucket struct {
	// contains filtered or unexported fields
}

func NewLexoRankBucket

func NewLexoRankBucket(str string) (*LexoRankBucket, error)

func (*LexoRankBucket) Equals

func (b *LexoRankBucket) Equals(other *LexoRankBucket) bool

func (*LexoRankBucket) String

func (b *LexoRankBucket) String() string

Jump to

Keyboard shortcuts

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