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    package graphlab.plugins.algorithmanimator.core.atoms;
005    
006    import graphlab.graph.atributeset.GraphAttrSet;
007    import graphlab.graph.graph.GraphModel;
008    import graphlab.library.event.Event;
009    import graphlab.library.event.GraphRequest;
010    import graphlab.platform.core.BlackBoard;
011    import graphlab.plugins.algorithmanimator.core.AtomAnimator;
012    
013    /**
014     * @author Azin Azadi
015     */
016    public class GraphSelect implements AtomAnimator<GraphRequest> {
017    ///    public boolean isAnimatable(Event event) {
018    //        return event instanceof VertexRequest;
019    //    }
020    
021        public boolean isAnimatable(Event e) {
022            return e instanceof GraphRequest;
023        }
024    
025        public GraphRequest animate(GraphRequest gr, BlackBoard b) {
026            GraphModel g = b.getData(GraphAttrSet.name);
027            gr.setGraph(g);
028            return gr;
029        }
030    }
031