input

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OperationProcessor

type OperationProcessor interface {
	ProcessOperation(operation calculator.Operation) (*string, error)
}

OperationProcessor is the interface for processing mathematical operations

type Parser

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

Parser is responsible for converting input to mathematical operations

func NewParser

func NewParser(op OperationProcessor, v ValidationHelper) *Parser

NewParser creates a ready to user parser.

func (*Parser) ProcessExpression

func (p *Parser) ProcessExpression(expr string) (*string, error)

ProcessExpression parses an expression and sends it to the calculator

type ValidationHelper

type ValidationHelper interface {
	CheckInput(operator string, operands []float64) error
}

ValidationHelper is the interface for input valeidation

type Validator

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

func NewValidator

func NewValidator(expLen int, validOps []string) *Validator

NewValidator creates a ready to use Validator instance

func (*Validator) CheckInput

func (v *Validator) CheckInput(operator string, operands []float64) error

CheckInput validates the operator and operands

Jump to

Keyboard shortcuts

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