digits

package
v0.0.0-...-7b2d2ae Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AllOperations = []Operation{
		&Addition{},
		&Subtraction{},
		&Multiplication{},
		&Division{},
	}

	OpAddition       = &Addition{}
	OpSubtraction    = &Subtraction{}
	OpMultiplication = &Multiplication{}
	OpDivision       = &Division{}
)
View Source
var (
	ErrorInvalidOp = errors.New("invalid operation")
)

Functions

This section is empty.

Types

type Addition

type Addition struct{}

func (*Addition) Can

func (op *Addition) Can(a, b int) bool

func (*Addition) Op

func (op *Addition) Op(a, b int) int

func (*Addition) String

func (op *Addition) String(a, b int) string

type Division

type Division struct{}

func (*Division) Can

func (op *Division) Can(a, b int) bool

func (*Division) Op

func (op *Division) Op(a, b int) int

func (*Division) String

func (op *Division) String(a, b int) string

type Multiplication

type Multiplication struct{}

func (*Multiplication) Can

func (op *Multiplication) Can(a, b int) bool

func (*Multiplication) Op

func (op *Multiplication) Op(a, b int) int

func (*Multiplication) String

func (op *Multiplication) String(a, b int) string

type Operation

type Operation interface {
	Can(a, b int) bool
	Op(a, b int) int
	String(a, b int) string
}

type Solver

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

func New

func New(target int, digits []int) (*Solver, error)

func (*Solver) Solve

func (s *Solver) Solve() ([]string, error)

type Subtraction

type Subtraction struct{}

func (*Subtraction) Can

func (op *Subtraction) Can(a, b int) bool

func (*Subtraction) Op

func (op *Subtraction) Op(a, b int) int

func (*Subtraction) String

func (op *Subtraction) String(a, b int) string

Jump to

Keyboard shortcuts

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