AbstractHierarchicalItem.st
changeset 6000 7edb725b77ac
parent 5999 812567d6f683
child 6008 33dc33ff2314
--- a/AbstractHierarchicalItem.st	Wed Feb 13 13:00:00 2019 +0100
+++ b/AbstractHierarchicalItem.st	Wed Feb 13 15:24:09 2019 +0100
@@ -145,6 +145,23 @@
     "Modified: / 09-07-2010 / 08:56:27 / cg"
 !
 
+nextSibling
+    "returns the next child of my parent or nil"
+
+    |siblings myIndex|
+
+    (parent notNil and:[parent isHierarchicalItem]) ifTrue:[
+        siblings := parent getChildren.
+        myIndex := siblings identityIndexOf:self.
+        myIndex ~~ 0 ifTrue:[
+            ^ siblings at:myIndex+1 ifAbsent:nil
+        ].
+    ].
+    ^ nil
+
+    "Created: / 13-02-2019 / 15:17:39 / Claus Gittinger"
+!
+
 parent
     "returns the parent or nil"
 
@@ -165,6 +182,23 @@
     parent := aParent
 !
 
+previousSibling
+    "returns the previous child of my parent or nil"
+
+    |siblings myIndex|
+
+    (parent notNil and:[parent isHierarchicalItem]) ifTrue:[
+        siblings := parent getChildren.
+        myIndex := siblings identityIndexOf:self.
+        myIndex ~~ 0 ifTrue:[
+            ^ siblings at:myIndex-1 ifAbsent:nil
+        ].
+    ].
+    ^ nil
+
+    "Created: / 13-02-2019 / 15:17:57 / Claus Gittinger"
+!
+
 rootItem
     "returns the root item"