Create Context » History » Revision 62
Revision 61 (Tomislav Pleše, 09/29/2025 01:49 PM) → Revision 62/68 (Tomislav Pleše, 09/29/2025 01:53 PM)
# Create Context
|- T-001: Shard-01
| |- T-004: Point
| |- T-015: Point
|- T-001: Shard-02
| |- T-016: Point
| |- T-017: Point
| |- T-005: Shard-01
| | |- T-006: Point
| | |- T-014: Point
| | |- T-007: Shard-01
| | | |- T-010: Point
| | | |- T-013: Point
| | |- T-007: Shard-02
| | | |- T-011: Point
| | | |- T-012: Point <-- starting point
| | |- T-007: Shard-03
| | |- T-008: Point
| |- T-005: Shard-02
| | |- T-018: Point
| |- T-005: Shard-03
| |- T-009: Point
|- T-001: Shard-03
|- T-002: Point
|- T-003: Point
Context: [012, 011, 007(S01+S02), 014, 006, 005(S01), 017, 016, 001(S01+S02) ]
| PointId | 012 | 007 | 005 | 001 |
|------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|----------------------------------------------------------------------------------|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------|
| StartingPoint [in code] | 012 | 012 | 012 | 012 |
| PreviousPoint [in code] | "" | 012 | 007 | 005 |
| ParentPoint | 007 | 005 | 001 | 001 |
| PointChildren | null | null | null | [002, 003] |
| ShardList | null | [S01, S02, S03] | [S01, S02, S03] | [S01, S02, S03] |
| ParentShard | 007-S02 | 005-S01 | 001-S02 | null |
| CurrentParentShard [in code] | null | 007-S02 | 005-S01 | 001-S02 |
| ShardPointChildren | null | S02[011, 012] | S01[006, 014, 007] | S02[016, 017, 005, 009] |
| | | | | |
| PRINT full: | 012 | 011, 007(S01+S02) | 014, 006, 005(S01) | 017, 016, 001(S01+S02) |
| | | | | |
| 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) |
| | | * PRINT [011] | * PRINT [014, 006] | * PRINT [017, 016] |
| 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 |
| | * PRINT: 012 | * PRINT: 007- [S01+S02] | * PRINT: 005-[S01] | * PRINT: 001-[S01+S02] |
| If (ParentShard == null) | * False: Set CurrentParentShard = ParentShard | * False: Set CurrentParentShard = ParentShard | * False: Set CurrentParentShard = ParentShard | True: |
| If (ParentPoint == PointId) | * False: Set PreviousPoint = currentPoint | * False: Set PreviousPoint = currentPoint | * False: Set PreviousPoint = currentPoint | * True: This is Root ParentPoint - END |
| | * Go to ParentPoint: 007 | Go to ParentPoint: 005 | Go to ParentPoint: 001 | |
FLOW
ContextArgs
* String currentPoint = newPoint;
* String? parentPoint = newPoint.parentPoint;
* String? parentShard = newPoint.parentShard;
* String? error;
Decision points in the flow:
* Is previousPoint = null - new Root Point?
* Is previousPoint = Root - directly under Root - root.pointChildren[] -> previousPoint = Root
* Is previousPoint = rootChild - under Regular Point - root.pointChildren[] -> previousPoint = Child Point
* Is previousPoint = Shard - directly under Shard
* Is previousPoint = shardChild - under
* Is it a child of a Point /w Shard?
* If yes:
* If no: print currentPoint
*
Main questions:
* What I need to addTo.messages[] in currentPoint?
* What's the nextPoint?
Pseudo-Code
1. currentPoint(T-012) = newPoint -> addTo.messages[]
* Is currentPoint != Root -> nextCurrentPoint.exists (currentPoint.id != currentPoint.parentPointId)
* True:
* What's the nextCurrentPoint? Is it a Sub Prompt (Sharding) product? (isNextPointAShard? -> nextPoint.shardsList[] != null || nextPoint.pointChilren[] != null)
* True:
* previousPoint = currentPoint;
* currentPoint = nextPoint
* False:
* previousPoint = currentPoint;
* currentPoint = nextPoint.parentPoint
* False:
* addTo.messages[].fromCurrentPoint
* FINISH
2. currentPoint(T-007)
* Does currentPoint have Shards? (currentPoint.shardsList[] != null)
* True:
* Find Shard: currentShard = currentPoint.shardsList.findPreviousPoint.parentShardId;
* Find previousPoint in the shardChildren: currentShard.shardChildren.findPreviousPoint
* addTo.messages[].from.currentShard.shardChildren.fromPreviousPointIndex-1
* addTo.messages[].from.shardsList.fromCurrentShardIndex.fromAnchorEndPoisition
* 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
* True: not relevant
* False: not relevant
* False: Does currentPoint have pointChildren (is it Root)?
* True:
* Find previousPoint in pointChildren: currentPoint.pointChildren.findPreviousPoint
* addTo.messages[].from.pointChildren.fromPreviousPointIndex-1
* addTo.messages[].currentPoint
* False:
* addTo.messages[].currentPoint
--------
* INITIAL SETUP
* If Root -> (currentPoint.id == currentPoint.parentPointId)
* add currentPoint: addTo.messages[].currentPoint
* Else if Child Point -> (currentPoint.parentPoint != null)
* add currentPoint: addTo.messages[].currentPoint
* childPoint = currentPoint
* currentPoint = parentPoint
* isRootAddedToMessages = false
* WHILE (!isRootAddedToMessages)
* WHAT TO ADD TO MESSAGES?
* Is childPoint existing? (childPoint != null)
* True:
* Is childPoint part of currentPoint.shardsList.shardChildren? (currentPoint.shardsList[].contains.childPoint.parentShard)
* True:
* Find currentShard: currentShard = currentPoint.shardsList.find.childPoint.parentShardId;
* Find shardChildren index of childPoint: currentShard.shardChildren.find.childPoint currentShard.shardChildren.find.cildPoint
* add shardChildren: addTo.messages[].from.currentShard.shardChildren.from.childPointIndex-1
* add Shards: addTo.messages[].from.shardsList.from.currentShardIndex.from.anchorEndPoisition
* Is childPoint part of currentPoint.pointChildren? (currentPoint.pointChildren[].contains.childPoint)
* True:
* Find childPoint in pointChildren: currentPoint.pointChildren.find.childPoint
* add pointChildren: addTo.messages[].from.pointChildren.from.childPointIndex-1
* WHAT'S THE PARENT POINT?
* if (currentPoint.id == currentPoint.parentPointId)
* True:
* add currentPoint: addTo.messages[].currentPoint
* isRootAddedToMessages = true (FINISH)
* False:
* childPoint = currentPoint
* currentPoint = parentPoint