Interface PersistedCollectionMemberGraph
- All Known Implementing Classes:
PersistedCollectionMemberGraphImpl
** IMPORTANT **
For very large graphs it is the caller's responsibility to properly manage performance and memory
by inflating member references in chunks, rather than one-at-a-time or all-at-once, and deflating
each chunk before inflating the next one. The depth-first navigation iterator provided by this
class offers an inflate option to assist with memory management and performance.
Navigation methods:
1) To process a member graph using depth-first navigation:
PersistedCollectionMemberGraph memberGraph = PersistedCollectionHelper.service.getMemberGraph(...);
for (final DepthIterator iter = depthIterator(false, true); iter.hasNext();) {
invalid input: ' 'invalid input: ' 'invalid input: ' ' final PersistedCollectionMemberNode memberNode = iter.next();
invalid input: ' 'invalid input: ' 'invalid input: ' '
invalid input: ' 'invalid input: ' 'invalid input: ' ' // Custom processing code for member node here...
invalid input: ' 'invalid input: ' 'invalid input: ' ' // Additional information available from methods: iter.getLocalLevel(), iter.getLocalRoles, iter.isRepeated()
invalid input: ' 'invalid input: ' 'invalid input: ' '
}
2) To process a member graph using breadth-first navigation:
invalid input: ' ' // Process all member nodes on level 1, then all member nodes on level 2, etc.
PersistedCollectionMemberGraph memberGraph = PersistedCollectionHelper.service.getMemberGraph(...);
Mapinvalid input: '<Integer', Setinvalid input: '<PersistedCollectionMemberNode'invalid input: '>'invalid input: '>' levelToNodeMap = memberGraph.getMemberNodesByLevel();
for (int i = 1; i invalid input: '<'= levelToNodeMap.size(); i++) {
invalid input: ' 'invalid input: ' 'invalid input: ' ' for (PersistedCollectionMemberNode memberNode : levelToNodeMap.get(i)) {
invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' '
invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' ' // Custom processing code for a member node at level i here...
invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' ' // This algorithm guarantees that all parent nodes of memberNode have already been processed.
invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' 'invalid input: ' '
invalid input: ' 'invalid input: ' 'invalid input: ' ' }
}
Supported API: true
Extendable: false
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceIterator to perform a depth-first navigation of a member graph.static interfaceGraph node representing a single member of a persisted collection. -
Method Summary
Modifier and TypeMethodDescriptionvoidClear the visited state of all nodes in the member graph.depthIterator(boolean inflate, boolean skipRepeated) Get depth-first graph iterator to PersistedCollectionMemberNode objects with optionally inflated member references.Get collection of all member nodes from the graph.Get set of all members from the graph.Get the display assistant used for localizing relationship roles.Get the holder for which this member graph was created.getMemberNode(PersistedCollectable member) Get the graph node for a collection member.getMemberNode(ObjectReference memberRef) Get the graph node for a collected member.Get member nodes sorted by their maximum level in the graph.Get member nodes corresponding to the seed objects.intsize()Get member graph size.
-
Method Details
-
size
int size()Get member graph size.
Supported API: true- Returns:
- Number of nodes in member graph.
-
getMemberNode
PersistedCollectionMemberGraph.PersistedCollectionMemberNode getMemberNode(ObjectReference memberRef) Get the graph node for a collected member.
Supported API: true- Parameters:
memberRef- ObjectReference for a PersistedCollectable member object.- Returns:
- PersistedCollectionMemberNode for the specified member reference, or null if the reference is not a member of the graph.
-
getMemberNode
PersistedCollectionMemberGraph.PersistedCollectionMemberNode getMemberNode(PersistedCollectable member) Get the graph node for a collection member.
Supported API: true- Parameters:
member- PersistedCollectable member object.- Returns:
- PersistedCollectionMemberNode for the specified member object, or null if the object is not a member of the graph.
-
getAllMemberNodes
Collection<PersistedCollectionMemberGraph.PersistedCollectionMemberNode> getAllMemberNodes()Get collection of all member nodes from the graph.
Supported API: true- Returns:
- Collection of all member graph Nodes.
-
getAllMembers
WTSet getAllMembers()Get set of all members from the graph.
Supported API: true- Returns:
- Set of all members (non-null, may be empty).
-
clearAllVisited
void clearAllVisited()Clear the visited state of all nodes in the member graph.
Supported API: true -
getSeedNodes
Set<PersistedCollectionMemberGraph.PersistedCollectionMemberNode> getSeedNodes()Get member nodes corresponding to the seed objects. Depending on how the configuration specifications were set up for the collector, these objects may be the same as the actual seeds or may be different versions of the actual seeds.
Supported API: true- Returns:
- Set of Member graph nodes for the seed members.
-
getMemberNodesByLevel
Map<Integer,Set<PersistedCollectionMemberGraph.PersistedCollectionMemberNode>> getMemberNodesByLevel()Get member nodes sorted by their maximum level in the graph. When navigating nodes by order of increasing level, it is guaranteed that all parents of a node will be visited before the node itself is reached.
Supported API: true- Returns:
- Map of maximum level to member nodes at that level (non-null, may be empty).
-
getHolder
PersistedCollectableHolder getHolder()Get the holder for which this member graph was created.
Supported API: true- Returns:
- PersistedCollectableHolder object.
-
getDisplayAssistant
AssociationDisplayAssistant getDisplayAssistant()Get the display assistant used for localizing relationship roles.
Supported API: true- Returns:
- AssociationDisplayAssistant object.
-
depthIterator
Get depth-first graph iterator to PersistedCollectionMemberNode objects with optionally inflated member references. The remove() method may not be called for this iterator.Inflating and deflated member references are handled internally to the iterator when created with inflate=true. References are inflated and deflated in chunks to maintain a balance between performance and memory usage. Do not use two or more of these iterators with inflate=true simultaneously for the same member graph (i.e., may result in slow performance or excessive memory usage).
Supported API: true- Parameters:
inflate- Set true to have the iterator inflate the member references of the nodes being returned by the next() method. Set false to have the iterator return member references in whatever state they are currently in, inflated or deflated.skipRepeated- True to skip repeated branches of the graph, false to iterate over the entire graph (included repeated branches). If true the iterator will return an entire repeated branch the first time it is encountered, but will only return the root node all subsequent times.- Returns:
- Iterator to return member nodes using depth-first graph navigation.
- See Also:
-