Code covered by the BSD License  

Highlights from
Sequence Diagram tool

image thumbnail

Sequence Diagram tool

by

 

06 Oct 2006 (Updated )

Create UML style Sequence Diagrams

sequencereturnlink
function sequencereturnlink
% SEQUENCERETURNLINK - Create a link returning from last named entry
% into the current node.
    
% Author: Eric Ludlam
% Copyright (c) 2006 The MathWorks Inc.

    SD = getappdata(gcf,'SD');
    
    % Previous node
    
    if isempty(SD.links)
        error('Cannot return when there are no links.'); %#ok
    end
    
    lastlinkidx = length(SD.links);
    lastnodeidx = SD.links(lastlinkidx).nodeidx;  % The node we are in.

    % Find the node name of the node to return to.
    nodename = '';
    for i=lastlinkidx:-1:1
       
        if SD.links(i).nodeidx == lastnodeidx && ~SD.links(i).returned
            if SD.links(i).lastnodeidx == 0
                nodename = '';
            else
                nodename = SD.nodes(SD.links(i).lastnodeidx).name;
                SD.links(i).returned = true;
            end
        end
    end
    
    setappdata(gcf,'SD',SD);
    
    sequenceaddlink('return',nodename);
    

Contact us