getPathCount
public int getPathCount(Primitive source,
java.lang.String target)
Counts the number of possible paths from the source (parent) primitive to the target (child)
primitive. The method recursively traverses all AND- and OR- rules starting from the source
primitive searching for child primitives which name equals the target name.
Important points: (1) If the source is not an OP primitive (operation) 0 is returned. (2) If
there are several references from a parent to a child they are considered as a single path.
To avoid redundant traversals and calculations, the method memorizes all previous results.
This information is used when it is requested again. This is important as the method works
recursively. That is information on paths from a parent is calculated as a sum of the result
of its childs. In this case, there is no need to traverse all the hierarchy again if
information on child primitives has already been calculated.
- Parameters:
source
- Source (parent) primitive.
target
- Target (child) primitive name.
- Returns:
- The number of possible paths from the source to the target.
- Throws:
java.lang.NullPointerException
- if any of the parameters equals null.