view m-toolbox/classes/@LTPDAworkbench/addBlock.m @ 49:0bcdf74587d1 database-connection-manager

Cleanup
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:36 +0100
parents f0afece42f48
children
line wrap: on
line source

% 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