Gutenberg

Class OperatorFactory<T>

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

Inheritance
Declaration
public static class OperatorFactory<T> : Object
Type Parameters
Name Description

T

Methods

Infix(BinaryOperatorType, Int32, 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>

Int32

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, Int32, 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>

Int32

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(Int32, 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

Int32

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(Int32, 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

Int32

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(Int32, 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

Int32

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(Int32, 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

Int32

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(Int32, 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

Int32

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(Int32, 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

Int32

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(Int32, Document<T>, Boolean)

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

Int32

precedence

The precedence of the UnaryOperator<T>

Document<T>

symbol

How to display the UnaryOperator<T>

Boolean

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(Int32, Document<T>, Boolean, 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

Int32

precedence

The precedence of the UnaryOperator<T>

Document<T>

symbol

How to display the UnaryOperator<T>

Boolean

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(Int32, Document<T>, Boolean)

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

Int32

precedence

The precedence of the UnaryOperator<T>

Document<T>

symbol

How to display the UnaryOperator<T>

Boolean

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(Int32, Document<T>, Boolean, 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

Int32

precedence

The precedence of the UnaryOperator<T>

Document<T>

symbol

How to display the UnaryOperator<T>

Boolean

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, Int32, Document<T>, Boolean)

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>

Int32

precedence

The precedence of the UnaryOperator<T>

Document<T>

symbol

How to display the UnaryOperator<T>

Boolean

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, Int32, Document<T>, Boolean, 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>

Int32

precedence

The precedence of the UnaryOperator<T>

Document<T>

symbol

How to display the UnaryOperator<T>

Boolean

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>.