public interface Group<D extends Database<D,G,E,I>,G extends Group<D,G,E,I>,E extends Entry<D,G,E,I>,I extends Icon>
Databases have exactly one Root Group.
Other Groups of the database are a child of another Group.
A Database may contain Groups to an indefinite level.
Any Group may contain Entry
items.
Groups have a name, a UUID and an Icon.
Modifier and Type | Method and Description |
---|---|
E |
addEntry(E entry)
Adds an entry to this group removing it from another group
if it was part of one.
|
G |
addGroup(G group)
If the group belongs to this database then move it from its present parent, if any, to
the group on which this method is called.
|
void |
copy(Group<? extends Database,? extends Group,? extends Entry,? extends Icon> parent)
Make a deep copy of the children a group and add to this group.
|
List<? extends E> |
findEntries(Entry.Matcher matcher,
boolean recursive)
Finds all entries in this group that match using the matcher supplied.
|
List<? extends E> |
findEntries(String match,
boolean recursive)
Finds all entries in this group that match the string supplied.
|
List<? extends G> |
findGroups(String groupName)
Returns a list of child Groups whose name exactly matches that supplied.
|
D |
getDatabase()
Get the database this group was created from
|
List<? extends E> |
getEntries()
Returns a modifiable by the caller list of entries contained in this group.
|
int |
getEntriesCount()
Returns the number of entries in this group
|
List<? extends G> |
getGroups()
Returns a list of groups that are the children of this group.
|
int |
getGroupsCount()
Returns the number of groups that are direct children of this group
|
Icon |
getIcon()
Get the Icon of this group
|
String |
getName()
Get the name of this group
|
G |
getParent()
Returns the parent of this group, or null if either this
group is the root group, or if the group does not have
a parent - e.g.
|
String |
getPath()
Returns an XPath-like string of the names of Groups from the Root
to this Group.
|
UUID |
getUuid()
Get the UUID of this group
|
boolean |
isRecycleBin()
Returns true if this is the recycle bin of a database
|
boolean |
isRootGroup()
Returns true if this is the root group of a database
|
E |
removeEntry(E entry)
Remove an entry from this group and hence from the database.
|
G |
removeGroup(G group)
Removes the group supplied from this group.
|
void |
setIcon(I icon)
Set the Icon of this group
|
void |
setName(String name)
Set the name of this group
|
void |
setParent(G parent)
Add this group to a parent.
|
boolean isRootGroup()
boolean isRecycleBin()
@Nullable G getParent()
void setParent(G parent)
parent
- a prospective parentList<? extends G> getGroups()
The list returned is modifiable by the caller without affecting the status of the database.
int getGroupsCount()
It's possible that returning a list as in getGroups()
may incur significantly
more overhead so use this method if only the count is reuqired
G addGroup(G group)
The root group cannot be added to another group.
group
- the group to addList<? extends G> findGroups(String groupName)
The returned list may be modified without affecting the underlying database.
groupName
- the name of the groups soughtG removeGroup(G group)
If the group is incompatible with the databse an exception is thrown.
If the group is not present no error is thrown.
group
- the group to removeIllegalArgumentException
- if the group is not a child of this groupList<? extends E> getEntries()
int getEntriesCount()
It's possible that returning a list as in getEntries()
may incur significantly
more overhead so use this method if only the count is reuqired
List<? extends E> findEntries(String match, boolean recursive)
Entry match is described under Entry.match(String)
Note: finding within recycle bin is supported, recusion into recycle bin is inhibited
match
- the text to matchrecursive
- whether to include sub groups in the processEntry.match(String)
List<? extends E> findEntries(Entry.Matcher matcher, boolean recursive)
Entry match is described under Entry.match(Entry.Matcher)
Note: finding within recycle bin is supported, recusion into recycle bin is inhibited
matcher
- the mathcher to userecursive
- whether to include sub groups in the processEntry.match(Entry.Matcher)
E addEntry(E entry)
entry
- the entry to addE removeEntry(E entry)
entry
- the entry to removeIllegalArgumentException
- if the Entry is not in the groupvoid copy(Group<? extends Database,? extends Group,? extends Entry,? extends Icon> parent)
parent
- the group to deep copyString getPath()
String getName()
void setName(String name)
UUID getUuid()
Icon getIcon()
void setIcon(I icon)
@NotNull D getDatabase()
Copyright © 2023. All rights reserved.