MST

interface MST(source)

A Mathematical Syntax Tree (MST) node for mathematical expressions.

Author

Alexander Nozik

Inheritors

Types

Link copied to clipboard
data class Binary(val operation: String, val left: MST, val right: MST) : MST

A node containing binary operation.

Link copied to clipboard
data class Numeric(val value: Number) : MST

A node containing a numeric value or scalar.

Link copied to clipboard
data class Unary(val operation: String, val value: MST) : MST

A node containing a unary operation.

Functions

Link copied to clipboard
open infix override fun MST.and(other: MST): MST

Logic 'and'

Link copied to clipboard
open operator fun MST.div(arg: MST): MST

Division of two elements.

open operator fun MST.div(k: Number): MST

Division of this element by scalar.

Link copied to clipboard
fun <T> MST.interpret(algebra: Algebra<T>, vararg arguments: Pair<Symbol, T>): T
fun <T> MST.interpret(algebra: Algebra<T>, arguments: Map<Symbol, T>): T

Interprets the MST node with this Algebra and optional arguments

Link copied to clipboard
open operator override fun MST.minus(arg: MST): MST.Binary
open operator override fun MST.minus(arg: MST): MST.Binary
open operator override fun MST.minus(arg: MST): MST.Binary
open operator override fun MST.minus(arg: MST): MST.Binary

Subtraction of two elements.

open operator fun MST.minus(other: Number): MST

Subtraction of element from number.

Link copied to clipboard
open operator override fun MST.not(): MST

Logic 'not'

Link copied to clipboard
open infix override fun MST.or(other: MST): MST

Logic 'or'

Link copied to clipboard
open operator fun MST.plus(arg: MST): MST

Addition of two elements.

open operator fun MST.plus(other: Number): MST

Addition of element and scalar.

Link copied to clipboard
open infix fun MST.pow(pow: Number): MST

Raises this value to the power pow.

Link copied to clipboard
open operator fun MST.times(arg: MST): MST

Multiplies this element by scalar.

open operator fun MST.times(k: Number): MST

Multiplication of this element by a scalar.

Link copied to clipboard
fun <T : Any> MST.toExpression(algebra: Algebra<T>): Expression<T>

Interpret this MST as expression.

Link copied to clipboard
open operator override fun MST.unaryMinus(): MST.Unary
open operator override fun MST.unaryMinus(): MST.Unary
open operator override fun MST.unaryMinus(): MST.Unary
open operator override fun MST.unaryMinus(): MST.Unary

The negation of this element.

Link copied to clipboard
open operator override fun MST.unaryPlus(): MST.Unary
open operator override fun MST.unaryPlus(): MST.Unary
open operator override fun MST.unaryPlus(): MST.Unary
open operator override fun MST.unaryPlus(): MST.Unary

Returns this value.

Link copied to clipboard
open infix override fun MST.xor(other: MST): MST

Logic 'xor'