Project

General

Profile

Create Context » History » Version 62

Tomislav Pleše, 09/29/2025 01:53 PM

1 1 Tomislav Pleše
# Create Context
2 2 Tomislav Pleše
3
4
|- T-001: Shard-01 
5
|  |- T-004: Point
6
|  |- T-015: Point
7
|- T-001: Shard-02
8
|  |- T-016: Point
9 3 Tomislav Pleše
|  |- T-017: Point
10 2 Tomislav Pleše
|  |- T-005: Shard-01 
11
|  |  |- T-006: Point
12
|  |  |- T-014: Point
13
|  |  |- T-007: Shard-01 
14
|  |  |  |- T-010: Point
15
|  |  |  |- T-013: Point 
16
|  |  |- T-007: Shard-02 
17
|  |  |  |- T-011: Point
18
|  |  |  |- T-012: Point  <-- starting point
19
|  |  |- T-007: Shard-03 
20
|  |  |- T-008: Point
21
|  |- T-005: Shard-02 
22
|  |  |- T-018: Point
23
|  |- T-005: Shard-03 
24
|  |- T-009: Point
25
|- T-001: Shard-03 
26
|- T-002: Point
27 3 Tomislav Pleše
|- T-003: Point
28 2 Tomislav Pleše
29 1 Tomislav Pleše
30 2 Tomislav Pleše
31 3 Tomislav Pleše
Context: [012, 011, 007(S01+S02), 014, 006, 005(S01), 017, 016, 001(S01+S02) ]
32 2 Tomislav Pleše
33 1 Tomislav Pleše
34 2 Tomislav Pleše
35 3 Tomislav Pleše
36 2 Tomislav Pleše
|     PointId                                                                                                |     012                                                |     007                                                                          |     005                                                                          |     001                                                                                                            |
37
|------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
38
|     StartingPoint   [in code]                                                                              |     012                                                |     012                                                                          |     012                                                                          |     012                                                                                                            |
39
|     PreviousPoint   [in code]                                                                              |     ""                                                 |     012                                                                          |     007                                                                          |     005                                                                                                            |
40
|     ParentPoint                                                                                            |     007                                                |     005                                                                          |     001                                                                          |     001                                                                                                            |
41
|     PointChildren                                                                                          |     null                                               |     null                                                                         |     null                                                                         |     [002, 003]                                                                                                     |
42
|     ShardList                                                                                              |     null                                               |     [S01, S02,   S03]                                                            |     [S01, S02,   S03]                                                            |     [S01, S02,   S03]                                                                                              |
43
|     ParentShard                                                                                            |     007-S02                                            |     005-S01                                                                      |     001-S02                                                                      |     null                                                                                                           |
44
|     CurrentParentShard   [in code]                                                                         |     null                                               |     007-S02                                                                      |     005-S01                                                                      |     001-S02                                                                                                        |
45
|     ShardPointChildren                                                                                     |     null                                               |     S02[011,   012]                                                              |     S01[006,   014, 007]                                                         |     S02[016,   017, 005, 009]                                                                                      |
46
|                                                                                                            |                                                        |                                                                                  |                                                                                  |                                                                                                                    |
47
|     PRINT full:                                                                                            |     012                                                |     011, 007(S01+S02)                                                            |     014, 006, 005(S01)                                                           |     017, 016, 001(S01+S02)                                                                                         |
48
|                                                                                                            |                                                        |                                                                                  |                                                                                  |                                                                                                                    |
49
|     If   (ShardPointChildren == null && currentParentShard == null) Else   (PointChildren == null)         |     * True:   not a Shard                              |     * False:   It's a shard. Print ShardPointChildren preceding PreviousPoint    |     * False:   It's a shard. Print ShardPointChildren preceding PreviousPoint    |     * False:   It's a shard. Print ShardPointChildren preceding PreviousPoint     (else,   print PointChildren)    |
50
|                                                                                                            |                                                        |     * PRINT [011]                                                                |     * PRINT [014, 006]                                                           |     * PRINT [017, 016]                                                                                             |
51
|     Print   CurrentPoint:     If(Shard)   => Print from ShardList     Else If   (!Shard) => Print Point    |     * Not a   Shard: Print Point                       |     * Shard:   Print ShardList from CurrentParentShard and those preceding       |     * Shard:   Print ShardList from CurrentParentShard and those preceding       |     * Shard:   Print ShardList from CurrentParentShard and those preceding                                         |
52
|                                                                                                            |     * PRINT: 012                                       |     * PRINT: 007- [S01+S02]                                                      |     * PRINT: 005-[S01]                                                           |     * PRINT: 001-[S01+S02]                                                                                         |
53
|     If   (ParentShard == null)                                                                             |     * False:   Set CurrentParentShard = ParentShard    |     * False:   Set CurrentParentShard = ParentShard                              |     * False:   Set CurrentParentShard = ParentShard                              |     True:                                                                                                          |
54 1 Tomislav Pleše
|     If   (ParentPoint == PointId)                                                                          |     * False:   Set PreviousPoint = currentPoint        |     * False:   Set PreviousPoint = currentPoint                                  |     * False:   Set PreviousPoint = currentPoint                                  |     * True:   This is Root ParentPoint - END                                                                       |
55
|                                                                                                            |     * Go to   ParentPoint: 007                         |     Go to   ParentPoint: 005                                                     |     Go to   ParentPoint: 001                                                     |                                                                                                                    |
56 3 Tomislav Pleše
57
58
59
FLOW
60
61 40 Tomislav Pleše
ContextArgs
62 48 Tomislav Pleše
  * String currentPoint = newPoint;
63
  * String? parentPoint = newPoint.parentPoint;
64
  * String? parentShard = newPoint.parentShard;
65 29 Tomislav Pleše
  * String? error;
66 4 Tomislav Pleše
67 26 Tomislav Pleše
68 30 Tomislav Pleše
Decision points in the flow:
69
70 26 Tomislav Pleše
* Is previousPoint = null - new Root Point?
71
* Is previousPoint = Root - directly under Root - root.pointChildren[] -> previousPoint = Root
72 27 Tomislav Pleše
* Is previousPoint = rootChild - under Regular Point - root.pointChildren[] -> previousPoint = Child Point
73 28 Tomislav Pleše
* Is previousPoint = Shard - directly under Shard
74 1 Tomislav Pleše
* Is previousPoint = shardChild - under  
75
* Is it a child of a Point /w Shard?
76
  * If yes: 
77
  * If no:  print currentPoint
78
* 
79
80
81 42 Tomislav Pleše
Main questions: 
82 1 Tomislav Pleše
* What I need to addTo.messages[] in currentPoint?
83
* What's the nextPoint?
84
85 42 Tomislav Pleše
86
87
Pseudo-Code 
88 41 Tomislav Pleše
89
1. currentPoint(T-012) = newPoint -> addTo.messages[]
90 44 Tomislav Pleše
  * Is currentPoint != Root -> nextCurrentPoint.exists (currentPoint.id != currentPoint.parentPointId)
91 1 Tomislav Pleše
    * True: 
92 38 Tomislav Pleše
      * What's the nextCurrentPoint? Is it a Sub Prompt (Sharding) product? (isNextPointAShard? -> nextPoint.shardsList[] != null || nextPoint.pointChilren[] != null)
93
        * True: 
94
        * previousPoint = currentPoint; 
95
        * currentPoint = nextPoint
96
      * False: 
97
        * previousPoint = currentPoint; 
98
        * currentPoint = nextPoint.parentPoint
99 1 Tomislav Pleše
    * False: 
100 43 Tomislav Pleše
      * addTo.messages[].fromCurrentPoint
101
      * FINISH
102 32 Tomislav Pleše
2. currentPoint(T-007)
103 1 Tomislav Pleše
  * Does currentPoint have Shards? (currentPoint.shardsList[] != null)
104
    * True: 
105 34 Tomislav Pleše
      * Find Shard: currentShard = currentPoint.shardsList.findPreviousPoint.parentShardId; 
106 36 Tomislav Pleše
      * Find previousPoint in the shardChildren: currentShard.shardChildren.findPreviousPoint 
107 41 Tomislav Pleše
      * addTo.messages[].from.currentShard.shardChildren.fromPreviousPointIndex-1
108
      * addTo.messages[].from.shardsList.fromCurrentShardIndex.fromAnchorEndPoisition
109 1 Tomislav Pleše
      * Does currentPoint have pointChildren (is it Root)? - if the flow goes through shardChildren (Root has Shards), then pointChildren come only after last Shard - so, not relevant
110
        * True: not relevant
111
        * False: not relevant
112 29 Tomislav Pleše
    * False: Does currentPoint have pointChildren (is it Root)?
113 36 Tomislav Pleše
      * True: 
114
        * Find previousPoint in pointChildren: currentPoint.pointChildren.findPreviousPoint
115 41 Tomislav Pleše
        * addTo.messages[].from.pointChildren.fromPreviousPointIndex-1
116
        * addTo.messages[].currentPoint
117 36 Tomislav Pleše
      * False: 
118 41 Tomislav Pleše
        * addTo.messages[].currentPoint
119 45 Tomislav Pleše
120
121
--------
122
123 47 Tomislav Pleše
* INITIAL SETUP 
124
125 48 Tomislav Pleše
  * If Root -> (currentPoint.id == currentPoint.parentPointId)
126 56 Tomislav Pleše
    * add currentPoint: addTo.messages[].currentPoint
127 57 Tomislav Pleše
  * Else if Child Point -> (currentPoint.parentPoint != null)
128 56 Tomislav Pleše
    * add currentPoint: addTo.messages[].currentPoint
129 60 Tomislav Pleše
    * childPoint = currentPoint 
130
    * currentPoint = parentPoint
131 1 Tomislav Pleše
    
132 58 Tomislav Pleše
  * isRootAddedToMessages = false
133 1 Tomislav Pleše
134 58 Tomislav Pleše
* WHILE (!isRootAddedToMessages)
135
136 47 Tomislav Pleše
  * WHAT TO ADD TO MESSAGES?
137 49 Tomislav Pleše
138 54 Tomislav Pleše
    * Is childPoint existing? (childPoint != null) 
139 1 Tomislav Pleše
      * True: 
140 54 Tomislav Pleše
        * Is childPoint part of currentPoint.shardsList.shardChildren? (currentPoint.shardsList[].contains.childPoint.parentShard)
141
          * True: 
142
            * Find currentShard: currentShard = currentPoint.shardsList.find.childPoint.parentShardId; 
143 62 Tomislav Pleše
            * Find shardChildren index of childPoint: currentShard.shardChildren.find.childPoint
144 54 Tomislav Pleše
            * add shardChildren: addTo.messages[].from.currentShard.shardChildren.from.childPointIndex-1
145
            * add Shards: addTo.messages[].from.shardsList.from.currentShardIndex.from.anchorEndPoisition
146
        * Is childPoint part of currentPoint.pointChildren? (currentPoint.pointChildren[].contains.childPoint)
147
          * True: 
148
            * Find childPoint in pointChildren: currentPoint.pointChildren.find.childPoint
149
            * add pointChildren: addTo.messages[].from.pointChildren.from.childPointIndex-1    
150 1 Tomislav Pleše
151
  * WHAT'S THE PARENT POINT?
152
153 59 Tomislav Pleše
    * if (currentPoint.id == currentPoint.parentPointId)
154 1 Tomislav Pleše
      * True:
155 61 Tomislav Pleše
        * add currentPoint: addTo.messages[].currentPoint
156 59 Tomislav Pleše
        * isRootAddedToMessages = true (FINISH)
157
      * False:
158 1 Tomislav Pleše
        * childPoint = currentPoint 
159 58 Tomislav Pleše
        * currentPoint = parentPoint
160 59 Tomislav Pleše
161
162 45 Tomislav Pleše