// traverse the network and add all the found jumps to the // ring. A jump is network link which does not exist in the // tree. *operation* void build_jumps(Tree* tree, Ring* ring) *traverse* *from* Network *through* -> *, neighbors, * *to-stop* Node *carry* *in* Node* source_node, *in* Tree_Adjacency* source_tree_adj *along* *from* Adjacency *through* -> *, neighbors, * *to-stop* Node *at* Adjacency source_node = (@ this->get_source() @) *at* Adjacency source_tree_adj = (@ tree->find(source_node) @) *wrapper* Node (@ if (!(source_tree_adj->has_neighbor(this))) { //jump VNode* vnode1 = source_node->last_vnode(); VNode* vnode2 = this->first_vnode(); ring->add_jump(vnode1, vnode2); } @) // return 1 if "noe" is a neighbor of the corresponding tree // adjacency, 0 otherwise. *operation* int has_neighbor(Node* node) *init* (@ 0 @) *traverse* *from* Tree_Adjacency *through* -> *, neighbors, * *to-stop* Node *wrapper* Node (@ if (this == node) return_val = 1; @) // add a jump from vnode1 to vnode2 *operation* void add_jump(VNode* vnode1, VNode* vnode2) *wrapper* Ring (@ VirtualAdjacency* adj1 = this->find(vnode1); adj1->add_jump(vnode2); @) *operation* void add_jump(VNode* vnode) *wrapper* VirtualAdjacency (@ VirtualNeighbor* jump_neigh = new VirtualNeighbor(vnode, new DemReal(0.0), new DemReal(0.0), new DemReal(0.0)); this->get_jumps()->append(jump_neigh); @) // return a list with all the virtual nodes that are reachable with // jumps from the current adjacency. *operation* VNode_ParList* get_jump_vnodes() *init* (@ new VNode_ParList @) *traverse* *from* VirtualAdjacency *through* -> *, jumps, * *to-stop* VNode *wrapper* VNode (@ return_val->append(this); @)