Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
And.cs
1using System;
2using System.Runtime.ExceptionServices;
6
8{
13 {
22 public And(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
23 : base(Left, Right, Start, Length, Expression)
24 {
25 }
26
33 public override IElement EvaluateOptimizedResult(bool Left)
34 {
35 if (!Left)
36 return BooleanValue.False;
37 else
38 return null;
39 }
40
47 public override IElement Evaluate(bool Left, bool Right)
48 {
49 if (Left && Right)
50 return BooleanValue.True;
51 else
52 return BooleanValue.False;
53 }
54
61 public override IElement Evaluate(Exception Left, bool Right)
62 {
63 if (Right)
64 ExceptionDispatchInfo.Capture(Left).Throw();
65
66 return BooleanValue.False;
67 }
68
75 public override IElement Evaluate(bool Left, Exception Right)
76 {
77 if (Left)
78 ExceptionDispatchInfo.Capture(Right).Throw();
79
80 return BooleanValue.False;
81 }
82
89 public override IElement Evaluate(Exception Left, Exception Right)
90 {
91 ExceptionDispatchInfo.Capture(Left).Throw();
92 return ObjectValue.Null;
93 }
94
95 }
96}
Class managing a script expression.
Definition: Expression.cs:39
Base class for binary boolean operators.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Boolean-valued number.
Definition: BooleanValue.cs:12
static readonly BooleanValue False
Constant false value.
static readonly BooleanValue True
Constant true value.
static readonly ObjectValue Null
Null value.
Definition: ObjectValue.cs:86
override IElement Evaluate(bool Left, Exception Right)
Evaluates the boolean operator.
Definition: And.cs:75
override IElement Evaluate(bool Left, bool Right)
Evaluates the boolean operator.
Definition: And.cs:47
override IElement EvaluateOptimizedResult(bool Left)
Gives the operator a chance to optimize its execution if it knows the value of the left operand....
Definition: And.cs:33
override IElement Evaluate(Exception Left, bool Right)
Evaluates the boolean operator.
Definition: And.cs:61
And(ScriptNode Left, ScriptNode Right, int Start, int Length, Expression Expression)
Logical And.
Definition: And.cs:22
override IElement Evaluate(Exception Left, Exception Right)
Evaluates the boolean operator.
Definition: And.cs:89
Basic interface for all types of elements.
Definition: IElement.cs:20