Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NotExists.cs
2using System.Threading.Tasks;
8
10{
15 {
16 private readonly ISparqlPattern pattern;
17
26 : base(Start, Length, Expression)
27 {
28 this.pattern = Pattern;
29 }
30
35 public override bool IsAsynchronous => true;
36
43 {
44 return BooleanValue.False;
45 }
46
52 public override Task<IElement> EvaluateAsync(Variables Variables)
53 {
54 return Task.FromResult<IElement>(BooleanValue.False);
55 }
56
65 public async Task<IElement> EvaluateAsync(Variables Variables, ISemanticCube Cube,
67 {
68 IEnumerable<Possibility> Possibilities = await this.pattern.Search(Cube, Variables,
69 new Possibility[] { Possibility }, Query);
70 if (Possibilities is null)
71 return BooleanValue.True;
72
73 using (IEnumerator<Possibility> e = Possibilities.GetEnumerator())
74 {
75 return e.MoveNext() ? BooleanValue.False : BooleanValue.True;
76 }
77 }
78
82 public ScriptNode ScriptNode => this;
83
91 public override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
92 {
93 if (Order == SearchMethod.DepthFirst)
94 {
95 if (!this.pattern.ForAllChildNodes(Callback, State, Order))
96 return false;
97 }
98
99 if (!this.pattern.ForAll(Callback, State, Order))
100 return false;
101
102 if (Order == SearchMethod.BreadthFirst)
103 {
104 if (!this.pattern.ForAllChildNodes(Callback, State, Order))
105 return false;
106 }
107
108 return true;
109 }
110
112 public override bool Equals(object obj)
113 {
114 return obj is NotExists O &&
115 this.pattern.Equals(O.pattern) &&
116 base.Equals(obj);
117 }
118
120 public override int GetHashCode()
121 {
122 int Result = base.GetHashCode();
123 Result ^= Result << 5 ^ this.pattern.GetHashCode();
124 return Result;
125 }
126 }
127}
Class managing a script expression.
Definition: Expression.cs:41
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.
Checks if a pattern has at least no matches.
Definition: NotExists.cs:15
override bool IsAsynchronous
If the node (or its decendants) include asynchronous evaluation. Asynchronous nodes should be evaluat...
Definition: NotExists.cs:35
override IElement Evaluate(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: NotExists.cs:42
NotExists(ISparqlPattern Pattern, int Start, int Length, Expression Expression)
Checks if a pattern has at least no matches.
Definition: NotExists.cs:25
async Task< IElement > EvaluateAsync(Variables Variables, ISemanticCube Cube, SparqlQuery Query, Possibility Possibility)
Evaluates the node, using the variables provided in the Variables collection.
Definition: NotExists.cs:65
override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
Calls the callback method for all child nodes.
Definition: NotExists.cs:91
override Task< IElement > EvaluateAsync(Variables Variables)
Evaluates the node, using the variables provided in the Variables collection.
Definition: NotExists.cs:52
Represents a possible solution during SPARQL evaluation.
Definition: Possibility.cs:13
Collection of variables.
Definition: Variables.cs:25
Interface for semantic cubes.
Basic interface for all types of elements.
Definition: IElement.cs:21
delegate bool ScriptNodeEventHandler(ScriptNode Node, out ScriptNode NewNode, object State)
Delegate for ScriptNode callback methods.
SearchMethod
Method to traverse the expression structure
Definition: ScriptNode.cs:38