interface TermFormatter: Formatter<Term>, TermVisitor<String>, Any
Methods
CompanionObject
TermFormatter
interface TermFormatter: Formatter<Term>, TermVisitor<String>, Any
A particular sort of Formatters aimed at representing terms
Methods
of
fun of(varFormat: VarFormat, opFormat: OpFormat, funcFormat: FuncFormat, numberVars: Boolean, operators: OperatorSet): TermFormatter
Parameters
Name | Description |
---|---|
varFormat: VarFormat
|
|
opFormat: OpFormat
|
|
funcFormat: FuncFormat
|
|
numberVars: Boolean
|
|
operators: OperatorSet
|
ReturnValue
Name | Description |
---|---|
TermFormatter
|
default
fun default(operators: OperatorSet): TermFormatter
Parameters
Name | Description |
---|---|
operators: OperatorSet
|
ReturnValue
Name | Description |
---|---|
TermFormatter
|
readable
fun readable(operators: OperatorSet): TermFormatter
Parameters
Name | Description |
---|---|
operators: OperatorSet
|
ReturnValue
Name | Description |
---|---|
TermFormatter
|
prettyVariables
fun prettyVariables(): TermFormatter
A TermFormatter representing terms in canonical form, except for Variables which are represented
using their simple name only, if possible.
So for instance the term A_1 + B_2
is represented as '+'(A, B)
.
Conversely, if two or more variables share the same simple name, they are represented through relative and
progressive indexes.
So for instance, the term A_3 + A_4
is represented as '+'(A1, A2)
.
ReturnValue
Name | Description |
---|---|
TermFormatter
|
prettyExpressions
fun prettyExpressions(prettyVariables: Boolean, operatorSet: OperatorSet): TermFormatter
A TermFormatter representing terms in a pretty way, i.e. by representing prefix, postfix, or infix expressions according to the provided OperatorSet. Variables may be represented either in a pretty way or through their raw representation, depending on the value of the prettyVariables.
So for instance, assuming an infix operator +
is contained in operatorSet, the term A_1 + B_2
is
would be represented as A + B
, if prettyVariables is true
, or A_1 + B_2
otherwise.
Parameters
Name | Description |
---|---|
prettyVariables: Boolean
|
|
operatorSet: OperatorSet
|
ReturnValue
Name | Description |
---|---|
TermFormatter
|
prettyExpressions
fun prettyExpressions(operatorSet: OperatorSet): TermFormatter
A TermFormatter representing terms in a pretty way, i.e. by representing prefix, postfix, or infix expressions according to the provided OperatorSet. Variables are represented in pretty way as well, similarly to what the formatter returned by prettyVariables does.
So for instance, assuming an infix operator +
is contained in operatorSet, the term A_1 + B_2
is
would be represented as A + B
.
Parameters
Name | Description |
---|---|
operatorSet: OperatorSet
|
ReturnValue
Name | Description |
---|---|
TermFormatter
|
prettyExpressions
fun prettyExpressions(prettyVariables: Boolean): TermFormatter
A TermFormatter representing terms in a pretty way, i.e. by representing prefix, postfix, or infix expressions according to the operators defined in OperatorSet.DEFAULT. Variables may be represented either in a pretty way or through their raw representation, depending on the value of the prettyVariables.
So for instance the term A_1 + B_2
is represented as A + B
, if prettyVariables is true
,
or A_1 + B_2
otherwise.
Parameters
Name | Description |
---|---|
prettyVariables: Boolean
|
ReturnValue
Name | Description |
---|---|
TermFormatter
|
prettyExpressions
fun prettyExpressions(): TermFormatter
A TermFormatter representing terms in a pretty way, i.e. by representing prefix, postfix, or infix expressions according to the operators defined in OperatorSet.DEFAULT. Variables are represented in pretty way as well, similarly to what the formatter returned by prettyVariables does.
So for instance the term A_1 + B_2
is represented as A + B
.
ReturnValue
Name | Description |
---|---|
TermFormatter
|
A particular sort of Formatters aimed at representing terms