Information Technology Reference
In-Depth Information
endif
// Else, there are still path nodes to match.
MappingsList finalMappingsList = Ø
// In order to match the next path nodes, all permutations of these path nodes
// have to be considered. Hence the need for the first for loop!
// The resulting permutations contain all possible mappings between all next
// path nodes of pointcutNode and all next path nodes of baseNode.
// These mappings can be accessed with getMappings() for each
// permutation. A match is successful if at least one permutation can be
// matched recursively.
Find all matching permutations of baseNode's next path nodes
foreach permutation p in the found permutations
MappingsList permutationMappings = Ø
// The following if statement catches an invalid permutation because the
// mappings for the permutation contradict already established mappings.
// Therefore, discard this permutation and move on to the next.
if currentMappings contradict p.getMappings()
then continue with next loop iteration
endif
copy currentMappings to permutationMappings
add p.getMappings() to permutationMappings
try
MappingsList mergeResult = Ø
// For each mapping in the current permutation a recursive match has to
// be attempted. Hence, the need for the second for loop! There are two fail
// cases: 1) the recursive match cannot find any matching path elements
// (match() is not successful) or 2) the merging of all mappings causes
// contradictory mappings (merge is not successful).
foreach mapping pointcutNode2 to baseNode2 in p.getMappings()
// Match recursively next path nodes of pointcutNode2 against next
// path nodes of baseNode2 and return mappingsList (which contains
// permutationMappings plus new mappings found by match()).
// Match() throws NoMatchFound exception if not successful.
MappingsList recursionResult = match(pointcutNode2, baseNode2,
permutationMappings)
// At this point, the results need to be merged. This is necessary
// because in each pass of the for loop a branch is explored recursively
// and a match is only found if the results from all branches together
// make sense (i.e. they do not contradict each other). Merge also
// throws NoMatchFound exception if not successful.
merge recursionResult with mergeResult
endforeach // mapping
add mergeResult to finalMappingsList
endtry
catch NoMatchFound
Search WWH ::




Custom Search