From 2c8a08074eec6a74edfd3cdb34162dd0bc412c9c Mon Sep 17 00:00:00 2001 From: rec0de Date: Sat, 26 May 2018 22:09:24 +0200 Subject: [PATCH] Add comments --- BTree/src/lab/B_TreeNode.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/BTree/src/lab/B_TreeNode.java b/BTree/src/lab/B_TreeNode.java index d411ecc..c508e89 100644 --- a/BTree/src/lab/B_TreeNode.java +++ b/BTree/src/lab/B_TreeNode.java @@ -328,6 +328,11 @@ public class B_TreeNode { // These getter / setter methods try to enforce reasonable constraints to make debugging easier + /** + * Returns the entry at position i of the node + * @param i Index of the entry to get + * @return Entry at position i + */ public Entry getEntry(int i) { if(i > this.currentLoad - 1) throw new RuntimeException("Trying to get non-existent entry"); @@ -337,9 +342,15 @@ public class B_TreeNode { return res; } + /** + * Sets the i-th entry of the node + * @param i Index of the entry to set + * @param value Entry to set + */ public void setEntry(int i, Entry value) { if(i > this.currentLoad- 1) throw new RuntimeException("Trying to set non-existent entry"); + // keys.set might fail if the node capacity has been expanded, use add in that case if(this.keys.size() <= i) keys.add(value); else