Class OperatorFactory<T>
Methods to create UnaryOperator<T> and BinaryOperator<T> values.
Inheritance
- object
- OperatorFactory<T>
Inherited Members
- object.GetType()
- object.MemberwiseClone()
- object.ToString()
- object.Equals(object)
- object.Equals(object, object)
- object.ReferenceEquals(object, object)
- object.GetHashCode()
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 |
|---|---|---|
type |
The type of the BinaryOperator<T>. |
|
precedence |
The precedence of the BinaryOperator<T>. |
|
Document<T> |
symbol |
How to display the BinaryOperator<T>. |
Returns
| Type | Description |
|---|---|
See Also
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 |
|---|---|---|
type |
The type of the BinaryOperator<T>. |
|
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 |
|---|---|
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 |
|---|---|---|
precedence |
The precedence of the BinaryOperator<T>. |
|
Document<T> |
symbol |
How to display the BinaryOperator<T>. |
Returns
| Type | Description |
|---|---|
A left-associative BinaryOperator<T>. |
See Also
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 |
|---|---|---|
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 |
|---|---|
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 |
|---|---|---|
precedence |
The precedence of the BinaryOperator<T>. |
|
Document<T> |
symbol |
How to display the BinaryOperator<T>. |
Returns
| Type | Description |
|---|---|
A non-associative BinaryOperator<T>. |
See Also
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 |
|---|---|---|
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 |
|---|---|
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 |
|---|---|---|
precedence |
The precedence of the BinaryOperator<T>. |
|
Document<T> |
symbol |
How to display the BinaryOperator<T>. |
Returns
| Type | Description |
|---|---|
A right-associative BinaryOperator<T>. |
See Also
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 |
|---|---|---|
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 |
|---|---|
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 |
|---|---|---|
precedence |
The precedence of the UnaryOperator<T>. |
|
Document<T> |
symbol |
How to display the UnaryOperator<T>. |
chainable |
Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised. |
Returns
| Type | Description |
|---|---|
A postfix UnaryOperator<T>. |
See Also
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 |
|---|---|---|
precedence |
The precedence of the UnaryOperator<T>. |
|
Document<T> |
symbol |
How to display the UnaryOperator<T>. |
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 |
|---|---|
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 |
|---|---|---|
precedence |
The precedence of the UnaryOperator<T>. |
|
Document<T> |
symbol |
How to display the UnaryOperator<T>. |
chainable |
Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised. |
Returns
| Type | Description |
|---|---|
A prefix UnaryOperator<T>. |
See Also
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 |
|---|---|---|
precedence |
The precedence of the UnaryOperator<T>. |
|
Document<T> |
symbol |
How to display the UnaryOperator<T>. |
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 |
|---|---|
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 |
|---|---|---|
type |
The type of the UnaryOperator<T>. |
|
precedence |
The precedence of the UnaryOperator<T>. |
|
Document<T> |
symbol |
How to display the UnaryOperator<T>. |
chainable |
Whether the operator is chainable. If a non-chainable operator is applied multiple times, the inner expressions are parenthesised. |
Returns
| Type | Description |
|---|---|
See Also
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 |
|---|---|---|
type |
The type of the UnaryOperator<T>. |
|
precedence |
The precedence of the UnaryOperator<T>. |
|
Document<T> |
symbol |
How to display the UnaryOperator<T>. |
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 |
|---|---|