function queue = queue(varargin) %HASHTABLE Constructor for LIFO queue class % q = queue - Default constructor, empty queue table % mq = queue(q) - Copy constructor % $Id$ % todos: define maxSize dimension % if nargin == 1 && isa(varargin{1},'integer') % q.maxSize = varargin{1}; % end % and test maxSize in push % copy constructor % ---------------- if nargin == 1 && isa(varargin{1},'queue') queue = varargin{1}; return; % default constructor % ------------------- elseif nargin == 0 % number of object stored in queue % -------------------------------- q.index = 0; % objects % ------- q.data = []; % last object extract from pop and dispose with get % ------------------------------------------------- q.lifo = []; else error('queue:queue', 'Invalid arguments.'); end % class constructor % ----------------- queue = class(q,'queue');