001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    
005    package graphlab.plugins.algorithmanimator.extension;
006    
007    import graphlab.platform.core.AbstractAction;
008    import graphlab.platform.core.BlackBoard;
009    import graphlab.platform.extension.ExtensionHandler;
010    
011    public class AlgorithmExtensionHandler implements ExtensionHandler {
012    
013        AbstractAction a = null;
014    
015        public AbstractAction handle(BlackBoard b, Object ext) {
016            a = null;
017            if (ext instanceof AlgorithmExtension) {
018                try {
019                    AlgorithmExtension vm = (AlgorithmExtension) ext;
020                    a = new AlgorithmExtensionAction(b, vm);
021                } catch (Exception e) {
022                    e.printStackTrace();
023                }
024            }
025            return a;
026        }
027    }