Package introspector.model.traverse
Class TraverseHelper
java.lang.Object
introspector.model.traverse.TraverseHelper
MapNode provides a Node implementation to represent any value whose type is a java.util.Map.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds the new children to the modified nodes.static booleancontainsNullKey(Map<?, ?> map) Returns whether the map contains a null key.(package private) static booleancouldBeVisitedTwice(Node node) Returns whether a node could be visited twice or more(package private) static booleancouldBeVisitedTwice(SymmetricPair<Node, Node> nodePair) Returns whether two nodes could be visited twice or more(package private) static booleanhasBeenVisited(Node node, Set<Node> alreadyTraversed) Returns whether a node is a cyclic or alias reference.(package private) static booleanhasBeenVisited(SymmetricPair<Node, Node> nodePair, Set<SymmetricPair<Node, Node>> alreadyTraversed) Returns whether a pair of nodes have a cyclic or alias reference.static booleanshouldBeTraversed(Node node, Set<Node> alreadyTraversed) Returns whether a node should be traversed.static booleanshouldBeTraversed(SymmetricPair<Node, Node> nodePair, Set<SymmetricPair<Node, Node>> alreadyTraversed) Returns whether two nodes in a comparison (two trees) should be traversed.
-
Constructor Details
-
TraverseHelper
public TraverseHelper()
-
-
Method Details
-
containsNullKey
Returns whether the map contains a null key. -
couldBeVisitedTwice
Returns whether a node could be visited twice or more- Parameters:
node- the node traversed- Returns:
- whether the node could be visited twice or more
-
couldBeVisitedTwice
Returns whether two nodes could be visited twice or more- Parameters:
nodePair- the node traversed- Returns:
- whether the node could be visited twice or more
-
hasBeenVisited
Returns whether a node is a cyclic or alias reference. That is, it has been already traversed and hence the tree is actually a graph.- Parameters:
node- the node traversedalreadyTraversed- a set of previously traversed nodes- Returns:
- whether the node is a cyclic or alias reference
-
hasBeenVisited
static boolean hasBeenVisited(SymmetricPair<Node, Node> nodePair, Set<SymmetricPair<Node, Node>> alreadyTraversed) Returns whether a pair of nodes have a cyclic or alias reference. That is, it has been already traversed and hence the tree is actually a graph.- Parameters:
nodePair- the node traversedalreadyTraversed- a set of previously traversed nodes- Returns:
- whether the node is a cyclic or alias reference
-
shouldBeTraversed
Returns whether a node should be traversed. That is, it has not been traversed yet.- Parameters:
node- the node traversedalreadyTraversed- a set of previously traversed nodes- Returns:
- whether the node should be traversed
-
shouldBeTraversed
public static boolean shouldBeTraversed(SymmetricPair<Node, Node> nodePair, Set<SymmetricPair<Node, Node>> alreadyTraversed) Returns whether two nodes in a comparison (two trees) should be traversed. That is, it has not been traversed yet as a pair- Parameters:
nodePair- the pair of nodes traversedalreadyTraversed- a set of previously traversed nodes- Returns:
- whether the node should be traversed
-
addNewChildren
public static void addNewChildren(List<Node> children1, List<Node> children2, Set<Node> modifiedNodes) Adds the new children to the modified nodes.- Parameters:
children1- One list of nodeschildren2- Another list of nodesmodifiedNodes- The set of modified nodes where the new children will be added
-