Table of Contents
Previous Chapter
APPENDIX B
PROCEDURES
Procedure 1. SEARCH(n)
Variables: the method in an object corresponding to the link, nMet;
Begin
remove node n from NQ;
if nMet is marked then
add GraphConnection to node n;
else
{
if the object of nMet is not the destination object then
{
for each output link, ol, which carries the tt, of the method, nMet do
{
newNode();
add newNode to n;
add newNode to NQ;
}
mark nMet;
}
else
{
newNode();
add newNode to n;
mark nMet;
}
}
if the object of nMet is not the destination object then
{
for each pull method, nm, of the object, no do
{
if the method, nm, is makred then
{
add graphConnection to node n;
}
else
{
for each output link, ol, which carries the tt, of the nm do
{
newNode();
add newNode to n;
add newNode to NQ;
}
mark nm;
}
}
}
End
Procedure 2. FINDPATHS
Inputs: a message reachability graph; destination nodes in the message reachability graph;
Outputs: message path(s)
Variables: mp, a message path; MPL, a list of message path(s); v, a message path; nn, a node in the message reachability graph; v', a message path; n, a node, m, a node;
Begin
for each destination node do
{
create and initialize a message path, mp;
add mp to MPL;
}
while there exists a mp in MPL do
{
Let v be any message path in MPL;
remove v from the MPL;
while v does not reach the starting node do
{
let n be any predecessor node of nn;
for each remaining predecessor node, rn, of nn do
{
v' = v;
add the rn to the v';
add v' to MPL;
}
add n to the v;
}
}
End
Algorithm 4: Sequence of Objects
Inputs: a graph G=(V, E), where V are nodes, E are directed arcs.
Outputs: a sequence of objects
Variables: marked done nodes, MV; marked potential nodes, PV;
Begin
for each node, v, in V do
{
if v does not have outward arcs
then
{
mark v done;
add v into MV;
remove v from V;
for each connected node, v', of v
{
add v' into PV;
mark v' potential;
remove arc from E;
remove v' from V;
}
}
}
while PV is not empty do
{
remove the first node, v" from PV;
for each connected node, v', of v"
{
if v' is not in PV
then
{
add v' into PV;
remove v' from V;
remove arc from E;
}
else
remove arc from E:
}
if there is no outward arcs of v" then
{
marked v" done;
add v" into MV;
}
else
append v' to PV;
}
end
Table of Contents
Next Chapter