Package space.kscience.kmath.ast.rendering

Types

Link copied to clipboard
abstract class Binary(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(operations: Collection<String>?) : Binary

Handles binary nodes by producing BinaryMinusSyntax.

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

Represents binary, infix subtraction (42 − 42).

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

Handles binary nodes by producing BinaryOperatorSyntax.

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

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

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

Handles binary nodes by producing BinaryPlusSyntax.

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

Represents binary, infix addition (42 + 42).

Link copied to clipboard
sealed class BinarySyntax : OperationSyntax

Binary node, which has only two children.

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

Handles unary nodes by producing ExponentSyntax.

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

Represents exponential function.

Link copied to clipboard

Implements MST render process with sequence of features.

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

Handles binary nodes by producing FractionSyntax.

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

Represents fraction with numerator and denominator.

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

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

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

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

Link copied to clipboard
object LatexSyntaxRenderer : SyntaxRenderer

SyntaxRenderer implementation for LaTeX.

Link copied to clipboard
object MathMLSyntaxRenderer : SyntaxRenderer

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(operations: Collection<String>?) : Binary

Handles binary nodes by producing MultiplicationSyntax.

Link copied to clipboard
data class MultiplicationSyntax(operation: String, left: OperandSyntax, right: OperandSyntax, 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(string: String) : TerminalSyntax

Represents a number.

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

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

Link copied to clipboard
sealed class OperationSyntax : MathSyntax

Node containing a certain operation.

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

Represents special typing for operator name.

Link copied to clipboard
class Power(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
class PrettyPrintPi(symbols: Set<String>) : FeaturedMathRenderer.RenderFeature

Special printing for symbols meaning Pi.

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

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

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

Represents radical syntax with index (3√x).

Link copied to clipboard

Removes unnecessary parentheses from OperandSyntax.

Link copied to clipboard
data class SpecialSymbolSyntax(kind: SpecialSymbolSyntax.Kind) : TerminalSyntax

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

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

Handles binary nodes by producing RadicalSyntax with no index.

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

Represents a syntax node with subscript (xi).

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

Represents a syntax node with superscript (x2).

Link copied to clipboard
data class SymbolSyntax(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(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(operations: Collection<String>?) : Unary

Handles binary nodes by producing UnaryMinusSyntax.

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

Represents prefix, unary minus operator (-x).

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

Handles unary nodes by producing UnaryOperatorSyntax.

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

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

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

Handles unary nodes by producing UnaryPlusSyntax.

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

Represents prefix, unary plus operator (+x).

Link copied to clipboard
sealed class UnarySyntax : OperationSyntax

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

Chooses FractionSyntax.infix depending on the context.

Link copied to clipboard

Removes unnecessary times (×) symbols from MultiplicationSyntax.

Link copied to clipboard

Prints any MST.Numeric as a NumberSyntax containing the Any.toString result of it.

Link copied to clipboard

Prints any Symbol as a SymbolSyntax containing the Symbol.identity of it.