public class GroupZipper extends Object
Group
objects.
It is kind of an iterator with a pointer to the current element. The current
element can be found with getNode() method.
Navigation through the tree is possible with the methods down()
up() left() right().
The tree can also be modified by using the replace(Group) method to
replace a node with another one.
| Constructor and Description |
|---|
GroupZipper(KeePassFile keePassFile)
Create a zipper with the tree structure of the given KeePass file.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canDown()
Returns true if it is possible to navigate down.
|
boolean |
canLeft()
Returns true if it is possible to navigate left.
|
boolean |
canRight()
Returns true if it is possible to navigate right.
|
boolean |
canUp()
Returns true if it is possible to navigate up.
|
KeePassFile |
cloneKeePassFile()
Creates a cloned
KeePassFile from the current tree structure. |
KeePassFile |
close()
Returns a new
KeePassFile from the current tree structure. |
GroupZipper |
down()
Navigates down the tree to the first child node of the current node.
|
Group |
getNode()
Returns the current node.
|
Group |
getRoot()
Returns the root node of the tree.
|
Iterator<Group> |
iterator()
Returns an iterator over the groups in this tree.
|
GroupZipper |
left()
Navigates left the tree to the previous node at the same level.
|
GroupZipper |
replace(Group group)
Replaces the current node with the given one.
|
GroupZipper |
replaceMeta(Meta meta)
Replaces the meta with the given one.
|
GroupZipper |
right()
Navigates right the tree to the next node at the same level.
|
String |
toString() |
GroupZipper |
up()
Navigates up the tree to the parent node of the current node.
|
public GroupZipper(KeePassFile keePassFile)
keePassFile - the underlying data structurepublic boolean canDown()
public GroupZipper down()
If the current node has no childs an exception will be thrown.
NoSuchElementException - if the current node has no child nodespublic boolean canUp()
public GroupZipper up()
If the current node has no parent an exception will be thrown.
NoSuchElementException - if the current node has no parent nodepublic boolean canRight()
public GroupZipper right()
NoSuchElementException - if the last node at the current level has already been
reachedpublic boolean canLeft()
public GroupZipper left()
NoSuchElementException - if the first node at the current level has already been
reachedpublic Group getNode()
public GroupZipper replace(Group group)
Can be used to modify the tree.
group - the replacement nodepublic KeePassFile close()
KeePassFile from the current tree structure.public KeePassFile cloneKeePassFile()
KeePassFile from the current tree structure.public Group getRoot()
public GroupZipper replaceMeta(Meta meta)
meta - the given meta objectCopyright © 2018. All rights reserved.