Top Description Fields Constructors Methods
org.jabref.model.groups

public Class GroupTreeNode

extends TreeNode<GroupTreeNode>
Class Inheritance
Imports
java.util.ArrayList, .Collection, .Collections, .List, .Objects, .Optional, java.util.stream.Collectors, org.jabref.model.FieldChange, .TreeNode, org.jabref.model.database.BibDatabase, org.jabref.model.entry.BibEntry, org.jabref.model.search.SearchMatcher, org.jabref.model.search.matchers.MatcherSet, .MatcherSets

A node in the groups tree that holds exactly one AbstractGroup.

Field Summary

Modifier and TypeField and Description
private AbstractGroup
private static final String

Constructor Summary

AccessConstructor and Description
public
GroupTreeNode(AbstractGroup
the group underlying this node
group
)

Creates this node and associates the specified group with it.

Method Summary

Modifier and TypeMethod and Description
public List<FieldChange>
addEntriesToGroup(Collection<BibEntry> entries)

Adds the specified entries to this group.

public GroupTreeNode
public GroupTreeNode
copyNode()

Implements abstract org.jabref.model.TreeNode.copyNode.

Creates a copy of this node, completely separated from the tree (i.e. no children and no parent)

public boolean
equals(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public List<BibEntry>

Returns:

matched entries
findMatches
(List<BibEntry>
list of entries to be searched
entries
)

Determines the entries in the specified list which are matched by this group.

public List<BibEntry>

Returns:

matched entries
findMatches
(BibDatabase
database to be searched
database
)

Determines the entries in the specified database which are matched by this group.

public static GroupTreeNode
public Optional<GroupTreeNode>
getChildByPath(String pathToSource)

Finds a children using the given path.

public List<GroupTreeNode>

Returns:

List of GroupTreeNode containing the matches. AllEntriesGroup is always contained}
getContainingGroups
(List<BibEntry>
List of BibEntry to search for
entries
,
boolean
Whether to return only groups that must contain all entries
requireAll
)

Get only groups containing all the entries or just groups containing any of the

public List<BibEntry>
public AbstractGroup

Returns:

the group associated with this node
getGroup
()

Returns the group underlying this node.

public List<GroupTreeNode>
getMatchingGroups(BibEntry entry)

Determines all groups in the subtree starting at this node which contain the given entry.

public List<GroupTreeNode>
getMatchingGroups(List<BibEntry> entries)

Determines all groups in the subtree starting at this node which contain at least one of the given entries.

public String

Returns:

String the name of the group
getName
()

Get the name of the underlying group

public String
getPath()

Get the path from the root of the tree as a string (every group name is separated by PATH_DELIMITER.

public SearchMatcher
getSearchMatcher()

Creates a SearchMatcher that matches entries of this group and that takes the hierarchical information into account.

private SearchMatcher
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public boolean
isSameGroupAs(GroupTreeNode other)

Returns true if the underlying groups of both GroupTreeNodes is the same.

public boolean
matches(BibEntry entry)

Returns whether this group matches the specified BibEntry while taking the hierarchical information into account.

public List<FieldChange>
removeEntriesFromGroup(List<BibEntry> entries)

Removes the given entries from this group.

public void
setGroup(AbstractGroup
the new group (has to be non-null)
newGroup
)

Associates the specified group with this node.

public List<FieldChange>
setGroup(AbstractGroup
the new group (has to be non-null)
newGroup
,
boolean
specifies whether previous matched entries should be added to the new group
shouldKeepPreviousAssignments
,
boolean
specifies whether previous matched entries should be removed from the old group
shouldRemovePreviousAssignments
,
List<BibEntry>
list of entries in the database
entriesInDatabase
)

Associates the specified group with this node while also providing the possibility to modify previous matched entries so that they are now matched by the new group.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from org.jabref.model.TreeNode:
addChildaddChildchildIndexExistscopySubtreefindChildrenSatisfyinggetChildAtgetChildrengetDescendantgetFirstChildgetIndexedPathFromRootgetIndexOfChildgetLastChildgetLevelgetNextSiblinggetNumberOfChildrengetParentgetPathFromRootgetPositionInParentgetPreviousSiblinggetRootisAncestorOfisLeafisNodeDescendantisRootmoveAllChildrenTomoveTomoveTonotifyAboutDescendantChangeremoveAllChildrenremoveChildremoveChildremoveFromParentsetParentsortChildrensubscribeToDescendantChanged

Field Detail

groupback to summary
private AbstractGroup group
PATH_DELIMITERback to summary
private static final String PATH_DELIMITER

Constructor Detail

GroupTreeNodeback to summary
public GroupTreeNode(AbstractGroup group)

Creates this node and associates the specified group with it.

Parameters
group:AbstractGroup

the group underlying this node

Method Detail

addEntriesToGroupback to summary
public List<FieldChange> addEntriesToGroup(Collection<BibEntry> entries)

Adds the specified entries to this group. If the group does not support explicit adding of entries (i.e., does not implement GroupEntryChanger), then no action is performed.

addSubgroupback to summary
public GroupTreeNode addSubgroup(AbstractGroup subgroup)
copyNodeback to summary
public GroupTreeNode copyNode()

Implements abstract org.jabref.model.TreeNode.copyNode.

Doc from org.jabref.model.TreeNode.copyNode.

Creates a copy of this node, completely separated from the tree (i.e. no children and no parent)

Returns:GroupTreeNode

a deep copy of this node

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
o:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
findMatchesback to summary
public List<BibEntry> findMatches(List<BibEntry> entries)

Determines the entries in the specified list which are matched by this group.

Parameters
entries:List<BibEntry>

list of entries to be searched

Returns:List<BibEntry>

matched entries

findMatchesback to summary
public List<BibEntry> findMatches(BibDatabase database)

Determines the entries in the specified database which are matched by this group.

Parameters
database:BibDatabase

database to be searched

Returns:List<BibEntry>

matched entries

fromGroupback to summary
public static GroupTreeNode fromGroup(AbstractGroup group)
getChildByPathback to summary
public Optional<GroupTreeNode> getChildByPath(String pathToSource)

Finds a children using the given path. Each group name should be separated by PATH_DELIMITER.

The path should be generated using getPath().

getContainingGroupsback to summary
public List<GroupTreeNode> getContainingGroups(List<BibEntry> entries, boolean requireAll)

Get only groups containing all the entries or just groups containing any of the

Parameters
entries:List<BibEntry>

List of BibEntry to search for

requireAll:boolean

Whether to return only groups that must contain all entries

Returns:List<GroupTreeNode>

List of GroupTreeNode containing the matches. AllEntriesGroup is always contained}

getEntriesInGroupback to summary
public List<BibEntry> getEntriesInGroup(List<BibEntry> entries)
getGroupback to summary
public AbstractGroup getGroup()

Returns the group underlying this node.

Returns:AbstractGroup

the group associated with this node

getMatchingGroupsback to summary
public List<GroupTreeNode> getMatchingGroups(BibEntry entry)

Determines all groups in the subtree starting at this node which contain the given entry.

getMatchingGroupsback to summary
public List<GroupTreeNode> getMatchingGroups(List<BibEntry> entries)

Determines all groups in the subtree starting at this node which contain at least one of the given entries.

getNameback to summary
public String getName()

Get the name of the underlying group

Returns:String

String the name of the group

getPathback to summary
public String getPath()

Get the path from the root of the tree as a string (every group name is separated by PATH_DELIMITER.

The name of the root is not included.

getSearchMatcherback to summary
public SearchMatcher getSearchMatcher()

Creates a SearchMatcher that matches entries of this group and that takes the hierarchical information into account. I.e., it finds elements contained in this nodes group, or the union of those elements in its own group and its children's groups (recursively), or the intersection of the elements in its own group and its parent's group (depending on the hierarchical settings stored in the involved groups)

getSearchMatcherback to summary
private SearchMatcher getSearchMatcher(GroupHierarchyType originalContext)
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isSameGroupAsback to summary
public boolean isSameGroupAs(GroupTreeNode other)

Returns true if the underlying groups of both GroupTreeNodes is the same.

matchesback to summary
public boolean matches(BibEntry entry)

Returns whether this group matches the specified BibEntry while taking the hierarchical information into account.

removeEntriesFromGroupback to summary
public List<FieldChange> removeEntriesFromGroup(List<BibEntry> entries)

Removes the given entries from this group. If the group does not support the explicit removal of entries (i.e., does not implement GroupEntryChanger), then no action is performed.

setGroupback to summary
public void setGroup(AbstractGroup newGroup)

Associates the specified group with this node.

Parameters
newGroup:AbstractGroup

the new group (has to be non-null)

Annotations
@Deprecated
setGroupback to summary
public List<FieldChange> setGroup(AbstractGroup newGroup, boolean shouldKeepPreviousAssignments, boolean shouldRemovePreviousAssignments, List<BibEntry> entriesInDatabase)

Associates the specified group with this node while also providing the possibility to modify previous matched entries so that they are now matched by the new group.

Parameters
newGroup:AbstractGroup

the new group (has to be non-null)

shouldKeepPreviousAssignments:boolean

specifies whether previous matched entries should be added to the new group

shouldRemovePreviousAssignments:boolean

specifies whether previous matched entries should be removed from the old group

entriesInDatabase:List<BibEntry>

list of entries in the database

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override