arithmetic

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package arithmetic calculates time spend on writing arithmetic expressions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metric

type Metric struct {
	// Config with weights
	Config Weights
	// contains filtered or unexported fields
}

Metric is the temporal state for calculations of metrics

func (Metric) Finish

func (m Metric) Finish() float64

Finishes calculation and returns result

func (*Metric) ParseNode

func (m *Metric) ParseNode(n ast.Node)

Parses node from ast

type Weights

type Weights struct {
	// Weight for addition
	Add float64 `xml:"add"`
	// Weight for subtraction
	Sub float64 `xml:"sub"`
	// Weight for multiplication
	Mul float64 `xml:"mul"`
	// Weight for division
	Quo float64 `xml:"quo"`
	// Weight for remainder of division
	Rem float64 `xml:"rem"`
	// Weight for addition assigned
	AddAssign float64 `xml:"add_assign"`
	// Weight for subtraction assigned
	SubAssign float64 `xml:"sub_assign"`
	// Weight for multiplication assigned
	MulAssign float64 `xml:"mul_assign"`
	// Weight for division assigned
	QuoAssign float64 `xml:"quo_assign"`
	// Weight for remainder assigned
	RemAssign float64 `xml:"rem_assign"`
	// Weight for increment by 1
	Inc float64 `xml:"inc"`
	// Weight for decrement by 1
	Dec float64 `xml:"dec"`
}

Weights is structure with weights for arithmetic metric calculator

Jump to

Keyboard shortcuts

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