Skip to main content
. 2021 Nov 30;21(23):8013. doi: 10.3390/s21238013
Algorithm 2 Event Stabbing (e)
1  Input: Event //Tested event with its attributes;
2  Output: List<String> //Result of Event evaluation;
   /* Copy the input into Working Memory queue */
3  mainWM.pushEvent(Event);
  /* stab the event */
4  If (IsNotEmpty(mainWM)) {
  /* Define the entity hash */
5  List<Node*> stabbed;
6  While (ScalarNode != NULL) {
7   If (ScalarNode[i].test(Event)) {
8    stabbed.push(ScalarNode-i);
9   }
10  }
11  EntityHash = EntityNodeList[stabbed];
12  EntityNode.pushEvent(Event);
  /* spatial node stabbing */
13  *SpatialTree = SpatialIndex[EntityHash];
14  *root = *SpatialTree;
15  EventLocation<int, int> = {Event.Latitude, Event.Longitude};
16  List<Node*> stabbedCQ;
17  While (*root != NULL) {
18   If (IsALeaf(*root)) {
19    stabbedCQ.push(*root);
20    *root = NULL;
21   }
22   Else {
23    For (auto *leaf in *root.leaf) {
24      If (Intersects(EventLocation, *leaf) == true) {
25       *root = *leaf;
26       break;
27      }
28     }
29   }
   /* collect the result in a list of string */
30   List<string> res;
31   For (auto s in stabbedCQ) {
32    s.push(Event);
33    res.Append(Node.evaluate());
34   }
35   return res;
36  }
37 }
38 Else {
39  continue;
40 }