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 Lesser General Public License (LGPL): http://www.gnu.org/licenses/
004    
005    package graphlab.library.event;
006    
007    import graphlab.library.BaseEdge;
008    import graphlab.library.BaseGraph;
009    import graphlab.library.BaseVertex;
010    
011    /**
012     * @author Omid
013     */
014    public class EdgeRequest<VertexType extends BaseVertex, EdgeType extends BaseEdge<VertexType>>
015            implements Event {
016    
017        private EdgeType edge;
018        public final BaseGraph<VertexType, EdgeType> graph;
019        private String message;
020    
021        public EdgeRequest(BaseGraph<VertexType, EdgeType> graph) {
022            this.graph = graph;
023    
024        }
025    
026        /**
027         * @param edge The edge to set.
028         */
029        public void setEdge(EdgeType edge) {
030            if (edge == null)
031                throw new NullPointerException("Null edge supplied");
032    
033            graph.checkVertex(edge.target);
034            graph.checkVertex(edge.source);
035    
036            this.edge = edge;
037        }
038    
039        /**
040         * @return Returns the edge.
041         */
042        public EdgeType getEdge() {
043            return edge;
044        }
045    
046        public String getID() {
047            return "EdgeRequest";
048        }
049    
050        public String getDescription() {
051            return "Select an edge.";
052        }
053    
054        public String getMessage() {
055            return message;
056        }
057    
058        public void setMessage(String message) {
059            this.message = message;
060        }
061    }