Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
NotExists.cs
1using System.Collections.Generic;
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 return Possibilities.GetEnumerator().MoveNext() ? BooleanValue.False : BooleanValue.True;
74 }
75
79 public ScriptNode ScriptNode => this;
80
88 public override bool ForAllChildNodes(ScriptNodeEventHandler Callback, object State, SearchMethod Order)
89 {
90 if (Order == SearchMethod.DepthFirst)
91 {
92 if (!this.pattern.ForAllChildNodes(Callback, State, Order))
93 return false;
94 }
95
96 if (!this.pattern.ForAll(Callback, State, Order))
97 return false;
98
99 if (Order == SearchMethod.BreadthFirst)
100 {
101 if (!this.pattern.ForAllChildNodes(Callback, State, Order))
102 return false;
103 }
104
105 return true;
106 }
107
109 public override bool Equals(object obj)
110 {
111 return obj is NotExists O &&
112 this.pattern.Equals(O.pattern) &&
113 base.Equals(obj);
114 }
115
117 public override int GetHashCode()
118 {
119 int Result = base.GetHashCode();
120 Result ^= Result << 5 ^ this.pattern.GetHashCode();
121 return Result;
122 }
123 }
124}
Class managing a script expression.
Definition: Expression.cs:39
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:88
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:20
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