%% undo
%    moves backwards in the queue, if room to go backwards
% inputs:
%   object - current UndoManager
% outputs:
%   data:structure - action to be undone.
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function [ data ] = undo( object )
%check if we have already undone everything we can
if object.undo_level == size(object.queue,2) 
    data = [];
else
    data = object.queue(object.current_depth);
    object.current_depth = object.current_depth - 1;
    object.undo_level = object.undo_level + 1;
end

end

