Class UnaryExpression
- Namespace
- xFunc.Maths.Expressions
- Assembly
- xFunc.Maths.dll
The abstract base class that represents the unary operation.
public abstract class UnaryExpression : IExpression
- Inheritance
-
UnaryExpression
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
UnaryExpression(ImmutableArray<IExpression>)
Initializes a new instance of the UnaryExpression class.
protected UnaryExpression(ImmutableArray<IExpression> arguments)
Parameters
arguments
ImmutableArray<IExpression>The list of arguments.
Exceptions
- ArgumentNullException
arguments
isnull
.- ParseException
The
arguments
collection should have only one argument.
UnaryExpression(IExpression)
Initializes a new instance of the UnaryExpression class.
protected UnaryExpression(IExpression argument)
Parameters
argument
IExpressionThe expression.
Exceptions
- ArgumentNullException
argument
isnull
.
Properties
Argument
Gets the expression.
public IExpression Argument { get; }
Property Value
Methods
AnalyzeInternal<TResult>(IAnalyzer<TResult>)
Analyzes the current expression.
protected abstract TResult AnalyzeInternal<TResult>(IAnalyzer<TResult> analyzer)
Parameters
analyzer
IAnalyzer<TResult>The analyzer.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
AnalyzeInternal<TResult, TContext>(IAnalyzer<TResult, TContext>, TContext)
Analyzes the current expression.
protected abstract TResult AnalyzeInternal<TResult, TContext>(IAnalyzer<TResult, TContext> analyzer, TContext context)
Parameters
analyzer
IAnalyzer<TResult, TContext>The analyzer.
context
TContextThe context.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
TContext
The type of additional parameter for analyzer.
Analyze<TResult>(IAnalyzer<TResult>)
Analyzes the current expression.
public TResult Analyze<TResult>(IAnalyzer<TResult> analyzer)
Parameters
analyzer
IAnalyzer<TResult>The analyzer.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
Exceptions
- ArgumentNullException
analyzer
isnull
.
Analyze<TResult, TContext>(IAnalyzer<TResult, TContext>, TContext)
Analyzes the current expression.
public TResult Analyze<TResult, TContext>(IAnalyzer<TResult, TContext> analyzer, TContext context)
Parameters
analyzer
IAnalyzer<TResult, TContext>The analyzer.
context
TContextThe context.
Returns
- TResult
The analysis result.
Type Parameters
TResult
The type of the result.
TContext
The type of additional parameter for analyzer.
Exceptions
- ArgumentNullException
analyzer
isnull
.
Clone(IExpression?)
Clones this instance of the IExpression.
public abstract IExpression Clone(IExpression? argument = null)
Parameters
argument
IExpressionThe argument of new expression.
Returns
- IExpression
Returns the new instance of IExpression that is a clone of this instance.
Deconstruct(out IExpression)
Deconstructs UnaryExpression.
public void Deconstruct(out IExpression argument)
Parameters
argument
IExpressionThe argument.
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
Execute()
Executes this expression. Don't use this method if your expression has variables or user-functions.
public object Execute()
Returns
- object
A result of the execution.
Exceptions
- ExecutionException
The result of argument evaluation is not supported by this expression.
Execute(ExpressionParameters?)
Executes this expression.
public abstract object Execute(ExpressionParameters? parameters)
Parameters
parameters
ExpressionParametersAn object that contains all parameters and functions for expressions.
Returns
- object
A result of the execution.
Exceptions
- ExecutionException
The result of argument evaluation is not supported by this expression.
- See Also
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(IFormatter)
Returns a string that represents this instance.
public string ToString(IFormatter formatter)
Parameters
formatter
IFormatterThe formatter.