From 2fb2feffb751a5ac8c67b9972947f8e66f746312 Mon Sep 17 00:00:00 2001 From: Thomas Walker Lynch Date: Sat, 11 Jan 2025 06:32:48 +0000 Subject: [PATCH] Updated Diagonal SRTM --- .../example/IndexTree/SRTM_Diagonal.java | 136 ++++++++++++++---- 1 file changed, 108 insertions(+), 28 deletions(-) diff --git a/developer/example/IndexTree/SRTM_Diagonal.java b/developer/example/IndexTree/SRTM_Diagonal.java index 490cbb4..ee5a78b 100644 --- a/developer/example/IndexTree/SRTM_Diagonal.java +++ b/developer/example/IndexTree/SRTM_Diagonal.java @@ -27,19 +27,53 @@ would never descend to the grandchildren level of the tree. How diagonalization works: - The `diagonal` list is the read value. It is initialized to the - label for the root node, '[]'. + This is an infinite object, with each node having an infinite number + of children, and their being an infinite number of generations, + i.e. levels in the tree. + + Given a label, `inc_across` will turn it into the label for the + right neighbor sibling, while `inc_down` will turn it into the label + for the leftmost child. + + We compute each next diagonal based on the prior diagonal and a list + a 'child_srtm_list'. We should not modify values in the diagonal, + because the calling program might still be using it. Hence, + labels on the diagonal are copies before being modified. + + Because we want to do two independent modifications of the same base + label, we will need to copy it again before at least one of the + modifications. + + Initially: + + diagonal_0 is the root node, '[]'. + diagonal_1 is null. + child_srtm_list_0 is empty. + child_srtm_list_1 is null. Each time SRTM_Diagonal is stepped - 1. For each given label on the diagonal, inc_down is called, thus - turning the label into the label for the leftmost child of the - given node's child list. + 1. make an empty diagonal_1, and an empty child_srtm_list_1. + + 2. bind diagonl_0 to an SRTM, then for each cell: + 2.1 read label_0. + 2.2 copy label_0 to label_2. + 2.3 inc_down label_1 + 2.4 copy label_1 to label_2. + 2.5 append label_1 to diagonal_2. + 2.6 bind a Child_SRTM to label_2. + 2.7 append the Child_SRTM to child_srtm_list_1 + + 3. Given child_srtm_list_0, for each child_srtm: - 2.Each given SRTM_Child kept on the incomplete_list is `inc_across`ed. - This turns each label into the label for its right neighbor. + 3.1 read label_0 + 3.3 inc_across label_0, which will modify it in place to become + the right neighbor sibling label. + 3.3 append label_0 to diagonal_1 - The SRTM_Child.read() value is then appended to the `diagonal`. + 4, Update state: + 3.1 Join child_srtm_list_1 to the end of child_srtm_list_0. + 3.2 Write over the diagonal_0 reference with the diagonal_1 reference. */ @@ -65,10 +99,8 @@ public class SRTM_Diagonal extends Ariadne_SRTM_Label{ // Instance data // - private final List