Package-level declarations

Types

Link copied to clipboard
abstract class Binary(val operations: Collection<String>?) : FeaturedMathRenderer.RenderFeature

Abstract printing of unary operations that discards MST if their operation is not in operations or its type is not MST.Binary.

Link copied to clipboard
class BinaryMinus(val operations: Collection<String>?) : Binary

Handles binary nodes by producing BinaryMinusSyntax.

Link copied to clipboard
data class BinaryMinusSyntax(val operation: String, val left: OperandSyntax, val right: OperandSyntax) : BinarySyntax

Represents binary, infix subtraction (42 − 42).

Link copied to clipboard
class BinaryOperator(val operations: Collection<String>?) : Binary

Handles binary nodes by producing BinaryOperatorSyntax.

Link copied to clipboard
data class BinaryOperatorSyntax(val operation: String, var prefix: MathSyntax, val left: MathSyntax, val right: MathSyntax) : BinarySyntax

Represents binary, prefix operator syntax (like f(a, b)).

Link copied to clipboard
class BinaryPlus(val operations: Collection<String>?) : Binary

Handles binary nodes by producing BinaryPlusSyntax.

Link copied to clipboard
data class BinaryPlusSyntax(val operation: String, val left: OperandSyntax, val right: OperandSyntax) : BinarySyntax

Represents binary, infix addition (42 + 42).

Link copied to clipboard

Binary node, which has only two children.

Link copied to clipboard
class Exponent(val operations: Collection<String>?) : Unary

Handles unary nodes by producing ExponentSyntax.

Link copied to clipboard
data class ExponentSyntax(val operation: String, val operand: OperandSyntax, var useOperatorForm: Boolean) : UnarySyntax

Represents exponential function.

Link copied to clipboard

Implements MST render process with sequence of features.

Link copied to clipboard
class Fraction(val operations: Collection<String>?) : Binary

Handles binary nodes by producing FractionSyntax.

Link copied to clipboard
data class FractionSyntax(val operation: String, val left: OperandSyntax, val right: OperandSyntax, var infix: Boolean) : BinarySyntax

Represents fraction with numerator and denominator.

Link copied to clipboard

Handles binary nodes by producing inverse UnaryOperatorSyntax with ar prefix instead of a.

Link copied to clipboard

Handles binary nodes by producing inverse UnaryOperatorSyntax with arc prefix instead of a.

Link copied to clipboard

SyntaxRenderer implementation for LaTeX.

Link copied to clipboard

SyntaxRenderer implementation for MathML.

Link copied to clipboard
fun interface MathRenderer

Renders MST to MathSyntax.

Link copied to clipboard
sealed class MathSyntax

Syntax node for mathematical typography.

Link copied to clipboard
class Multiplication(val operations: Collection<String>?) : Binary

Handles binary nodes by producing MultiplicationSyntax.

Link copied to clipboard
data class MultiplicationSyntax(val operation: String, val left: OperandSyntax, val right: OperandSyntax, var times: Boolean) : BinarySyntax

Represents binary, infix multiplication in the form of coefficient (2 x) or with operator (x × 2).

Link copied to clipboard
data class NumberSyntax(var string: String) : TerminalSyntax

Represents a number.

Link copied to clipboard
data class OperandSyntax(val operand: MathSyntax, var parentheses: Boolean) : MathSyntax

Represents operand of a certain operator wrapped with parentheses or not.

Link copied to clipboard

Node containing a certain operation.

Link copied to clipboard
data class OperatorNameSyntax(var name: String) : TerminalSyntax

Represents special typing for operator name.

Link copied to clipboard
class Power(val operations: Collection<String>?) : Binary

Handles binary nodes by producing SuperscriptSyntax.

Link copied to clipboard

Special printing for numeric types that are printed in form of ('-'? (DIGIT+ ('.' DIGIT+)? ('E' '-'? DIGIT+)? | 'Infinity')) | 'NaN'.

Link copied to clipboard

Special printing for numeric types that are printed in form of '-'? DIGIT+.

Link copied to clipboard

Special printing for symbols meaning Pi.

Link copied to clipboard
data class RadicalSyntax(val operation: String, val operand: MathSyntax) : UnarySyntax

Represents radical with a node inside it (√x).

Link copied to clipboard
data class RadicalWithIndexSyntax(val operation: String, val left: MathSyntax, val right: MathSyntax) : BinarySyntax

Represents radical syntax with index (3√x).

Link copied to clipboard

Removes unnecessary parentheses from OperandSyntax.

Link copied to clipboard

Represents a usage of special symbols (e.g., ).

Link copied to clipboard
class SquareRoot(val operations: Collection<String>?) : Unary

Handles binary nodes by producing RadicalSyntax with no index.

Link copied to clipboard
data class SubscriptSyntax(val operation: String, val left: MathSyntax, val right: MathSyntax) : BinarySyntax

Represents a syntax node with subscript (xi).

Link copied to clipboard
data class SuperscriptSyntax(val operation: String, val left: MathSyntax, val right: MathSyntax) : BinarySyntax

Represents a syntax node with superscript (x2).

Link copied to clipboard
data class SymbolSyntax(var string: String) : TerminalSyntax

Represents a symbol.

Link copied to clipboard
fun interface SyntaxRenderer

Abstraction of writing MathSyntax as a string of an actual markup language. Typical implementation should involve traversal of MathSyntax with handling each subtype.

Link copied to clipboard
sealed class TerminalSyntax : MathSyntax

Terminal node, which should not have any children nodes.

Link copied to clipboard
abstract class Unary(val operations: Collection<String>?) : FeaturedMathRenderer.RenderFeature

Abstract printing of unary operations that discards MST if their operation is not in operations or its type is not MST.Unary.

Link copied to clipboard
class UnaryMinus(val operations: Collection<String>?) : Unary

Handles binary nodes by producing UnaryMinusSyntax.

Link copied to clipboard
data class UnaryMinusSyntax(val operation: String, val operand: OperandSyntax) : UnarySyntax

Represents prefix, unary minus operator (-x).

Link copied to clipboard
class UnaryOperator(val operations: Collection<String>?) : Unary

Handles unary nodes by producing UnaryOperatorSyntax.

Link copied to clipboard
data class UnaryOperatorSyntax(val operation: String, var prefix: MathSyntax, val operand: OperandSyntax) : UnarySyntax

Represents unary, prefix operator syntax (like f(x)).

Link copied to clipboard
class UnaryPlus(val operations: Collection<String>?) : Unary

Handles unary nodes by producing UnaryPlusSyntax.

Link copied to clipboard
data class UnaryPlusSyntax(val operation: String, val operand: OperandSyntax) : UnarySyntax

Represents prefix, unary plus operator (+x).

Link copied to clipboard

Unary node, which has only one child.

Functions

Link copied to clipboard

Calls SyntaxRenderer.render with given node and a new StringBuilder instance, and returns its content.

Properties

Link copied to clipboard

Applies ExponentSyntax.useOperatorForm to ExponentSyntax when the operand contains a fraction, a superscript or a subscript to improve readability.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard