Information Technology Reference
In-Depth Information
matchPointcutMap
and
match
, two more, rather straightforward operations were
implemented. The first operation decides, given two path nodes, whether the
two path nodes match according to the criteria mentioned in Sect. 4.1. It is used
by
matchPointcutMap
. The second operation finds, given two sets of path nodes,
all permutations that match elements in one set against elements in the other.
It is used by
match
. Note that (a) each element in one set has to be matched
against exactly one element in the other set and vice versa, and that (b) the
second operation makes use of the first to match individual elements.
Operation:
matchPointcutMap
Input:
UCMPointcutMap pointcutMap, UCMmodel baseUCM
Output:
MappingsList
Exception:
NoMatchFound (if match is unsuccessful)
begin
// matchPointcutMap
MappingsList resultMappingsList = Ø
PathNode initPointcutNode = pointcutMap.getInitialPathNode()
foreach
PathNode pn
in
baseUCM
if
initPointcutNode matches pn
then
MappingsList firstMapping = Ø
add new
Mapping(initPointcutNode, pn)
to
firstMapping
try
// Match next path nodes of initPointcutNode against next path nodes of
// pn and return matchList (which contains firstMapping plus
// new mappings found by match()).
MappingsList matchList = match(initPointcutNode, pn, firstMapping)
add
matchList
to
resultMappingsList
endtry
catch
NoMatchFound
// Do nothing and continue for loop (this gives initPointcutNode a
// chance to be matched against other path nodes in the UCM model).
endcatch
endif
endforeach
// PathNode
if
resultMappingsList == Ø
then
throw new
NoMatchFound()
// No mapping found at all.
endif
return
resultMappingsList
end
// matchPointcutMap
Operation:
match
Input
: PathNode pointcutNode, PathNode baseNode, MappingsList currentMappings
Output
: MappingsList
Exception
: NoMatchFound (if match is unsuccessful)
begin
// match
if
pointcutNode does not have any next path nodes
then
return
currentMappings
// Stops recursion.
Search WWH ::
Custom Search