Gutenberg

Class OperatorFactory<T>

Methods to create UnaryOperator<T> and BinaryOperator<T> values.

Inheritance
Inherited Members
Declaration
public static class OperatorFactory<T>
Type Parameters
Name Description

T

The type of annotations in the document.

Methods

Infix(BinaryOperatorType, int, Document<T>)

Creates a BinaryOperator<T> representing the given symbol, with the given type and precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static BinaryOperator<T> Infix(BinaryOperatorType type, int precedence, Document<T> symbol)
Parameters
Type Name Description

BinaryOperatorType

type

The type of the BinaryOperator<T>.

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

Returns
Type Description

BinaryOperator<T>

A BinaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

Infix(BinaryOperatorType, int, Document<T>, IBracketer<T>)

Creates a BinaryOperator<T> representing the given symbol, with the given type and precedence. When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static BinaryOperator<T> Infix(BinaryOperatorType type, int precedence, Document<T> symbol, IBracketer<T> bracketer)
Parameters
Type Name Description

BinaryOperatorType

type

The type of the BinaryOperator<T>.

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

BinaryOperator<T>

A BinaryOperator<T>.

InfixL(int, Document<T>)

Creates a left-associative BinaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static BinaryOperator<T> InfixL(int precedence, Document<T> symbol)
Parameters
Type Name Description

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

Returns
Type Description

BinaryOperator<T>

A left-associative BinaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

InfixL(int, Document<T>, IBracketer<T>)

Creates a left-associative BinaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static BinaryOperator<T> InfixL(int precedence, Document<T> symbol, IBracketer<T> bracketer)
Parameters
Type Name Description

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

BinaryOperator<T>

A left-associative BinaryOperator<T>.

InfixN(int, Document<T>)

Creates a non-associative BinaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static BinaryOperator<T> InfixN(int precedence, Document<T> symbol)
Parameters
Type Name Description

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

Returns
Type Description

BinaryOperator<T>

A non-associative BinaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

InfixN(int, Document<T>, IBracketer<T>)

Creates a non-associative BinaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static BinaryOperator<T> InfixN(int precedence, Document<T> symbol, IBracketer<T> bracketer)
Parameters
Type Name Description

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

BinaryOperator<T>

A non-associative BinaryOperator<T>.

InfixR(int, Document<T>)

Creates a right-associative BinaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static BinaryOperator<T> InfixR(int precedence, Document<T> symbol)
Parameters
Type Name Description

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

Returns
Type Description

BinaryOperator<T>

A right-associative BinaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

InfixR(int, Document<T>, IBracketer<T>)

Creates a right-associative BinaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static BinaryOperator<T> InfixR(int precedence, Document<T> symbol, IBracketer<T> bracketer)
Parameters
Type Name Description

int

precedence

The precedence of the BinaryOperator<T>.

Document<T>

symbol

How to display the BinaryOperator<T>.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

BinaryOperator<T>

A right-associative BinaryOperator<T>.

Postfix(int, Document<T>, bool)

Creates a postfix UnaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static UnaryOperator<T> Postfix(int precedence, Document<T> symbol, bool chainable = false)
Parameters
Type Name Description

int

precedence

The precedence of the UnaryOperator<T>.

Document<T>

symbol

How to display the UnaryOperator<T>.

bool

chainable

Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised.

Returns
Type Description

UnaryOperator<T>

A postfix UnaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

Postfix(int, Document<T>, bool, IBracketer<T>)

Creates a postfix UnaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static UnaryOperator<T> Postfix(int precedence, Document<T> symbol, bool chainable, IBracketer<T> bracketer)
Parameters
Type Name Description

int

precedence

The precedence of the UnaryOperator<T>.

Document<T>

symbol

How to display the UnaryOperator<T>.

bool

chainable

Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

UnaryOperator<T>

A postfix UnaryOperator<T>.

Prefix(int, Document<T>, bool)

Creates a prefix UnaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static UnaryOperator<T> Prefix(int precedence, Document<T> symbol, bool chainable = false)
Parameters
Type Name Description

int

precedence

The precedence of the UnaryOperator<T>.

Document<T>

symbol

How to display the UnaryOperator<T>.

bool

chainable

Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised.

Returns
Type Description

UnaryOperator<T>

A prefix UnaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

Prefix(int, Document<T>, bool, IBracketer<T>)

Creates a prefix UnaryOperator<T> representing the given symbol, with the given precedence. When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static UnaryOperator<T> Prefix(int precedence, Document<T> symbol, bool chainable, IBracketer<T> bracketer)
Parameters
Type Name Description

int

precedence

The precedence of the UnaryOperator<T>.

Document<T>

symbol

How to display the UnaryOperator<T>.

bool

chainable

Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

UnaryOperator<T>

A prefix UnaryOperator<T>.

Unary(UnaryOperatorType, int, Document<T>, bool)

Creates a UnaryOperator<T> representing the given symbol, with the given type and precedence. When the expression needs to be surrounded by parentheses, the K&R style is used.

Declaration
public static UnaryOperator<T> Unary(UnaryOperatorType type, int precedence, Document<T> symbol, bool chainable = false)
Parameters
Type Name Description

UnaryOperatorType

type

The type of the UnaryOperator<T>.

int

precedence

The precedence of the UnaryOperator<T>.

Document<T>

symbol

How to display the UnaryOperator<T>.

bool

chainable

Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised.

Returns
Type Description

UnaryOperator<T>

A UnaryOperator<T>.

See Also
KernighanRitchieBracketer<T>

Unary(UnaryOperatorType, int, Document<T>, bool, IBracketer<T>)

Creates a UnaryOperator<T> representing the given symbol, with the given type and precedence.When the expression needs to be surrounded by parentheses, bracketer is used.

Declaration
public static UnaryOperator<T> Unary(UnaryOperatorType type, int precedence, Document<T> symbol, bool chainable, IBracketer<T> bracketer)
Parameters
Type Name Description

UnaryOperatorType

type

The type of the UnaryOperator<T>.

int

precedence

The precedence of the UnaryOperator<T>.

Document<T>

symbol

How to display the UnaryOperator<T>.

bool

chainable

Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised.

IBracketer<T>

bracketer

An IBracketer<T> which will be called when the operator needs to be parenthesised.

Returns
Type Description

UnaryOperator<T>

A UnaryOperator<T>.