Mercurial > hg > ltpda
diff m-toolbox/classes/@LTPDAworkbench/addBlock.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@LTPDAworkbench/addBlock.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,40 @@ +% ADDBLOCK adds a block to the current pipeline +% +% CALL: addBlock(wb, name, info) +% addBlock(wb, name, info, x, y) +% +% M Hewitson 11-10-08 +% +% $Id: addBlock.m,v 1.3 2010/08/06 19:10:48 ingo Exp $ +% +function varargout = addBlock(varargin) + + wb = varargin{1}; + name = varargin{2}; + info = varargin{3}; + if nargin > 4 + x = varargin{4}; + y = varargin{5}; + end + + disp(sprintf('adding block: %s', name)); + algo = LTPDAworkbench.minfo2algo(info); + if nargin == 2 + name = awtinvoke(wb.mp, 'AddBlock(Ljava.lang.String;Lmpipeline.jltpda.LTPDAalgorithm;)', name, algo); + else + name = awtinvoke(wb.mp, 'AddBlock(Ljava.lang.String;Lmpipeline.jltpda.LTPDAalgorithm;II)', name, algo,x,y); + end + + % Set default plist + idx = find(strcmp('Default', info.sets)); + if isempty(idx) + wb.uploadPlist(name, info.plists(1)); + else + wb.uploadPlist(name, info.plists(idx)); + end + + if nargout > 0 + varargout{1} = char(name); + end + +end