You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: FigureObserver.m
    path of file: ./repos/erplab/studio_functions/GUI Layout Toolbox/layout/+uix
    
    the code of the file until where you have to start completion: classdef ( Hidden, Sealed ) FigureObserver < handle
    %uix.FigureObserver  Figure observer
    %
    %  A figure observer raises an event FigureChanged when the figure
    %  ancestor of a subject changes.
    
    %  Copyright 2009-2020 The MathWorks, Inc.
    
    properties( SetAccess = private )
        Subj
    
function update( obj )
            %update  Update listeners and Figure property
            
            % Create fresh listeners
            obj.PreSetListeners = event.proplistener.empty( [1 0] ); % clear
            obj.PostSetListeners = event.proplistener.empty( [1 0] ); % clear
            o = obj.Subject;
            while ~isempty( o ) && ~isa( o, 'matlab.ui.Figure' )
                obj.PreSetListeners(end+1) = event.proplistener( o, ...
                    findprop( o, 'Parent' ), 'PreSet', @obj.onParentPreSet );
                obj.PostSetListeners(end+1) = event.proplistener( o, ...
                    findprop( o, 'Parent' ), 'PostSet', @obj.onParentPostSet );
                o = o.Parent;
            end
            
            % Store figure
            obj.Figure = o;
            
        end % update
        
        function onParentPreSet( obj, ~, ~ )
            %onParentPreSet  Event handler
            
            % Store old figure
            obj.OldFigure = obj.Figure;
            
        end % onParentPreSet
        
        function onParentPostSet( obj, ~, ~ )
            %onParentPostSet  Event handler
            
            % Update object
            obj.update()
            
            % Raise event
            oldFigure = obj.OldFigure;
            newFigure = obj.Figure;
            if ~isequal( oldFigure, newFigure )
                notify( obj, 'FigureChanged', ...
                    uix.FigureData( oldFigure, newFigure ) )
            end
            
            % Clear old figure
            obj.OldFigure = gobjects( 0 );
            
        end