view m-toolbox/classes/@LTPDAworkbench/addBlock.m @ 40:977eb37f31cb database-connection-manager

User friendlier errors from utils.mysql.connect
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 18:04:03 +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