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.visualization.corebasics.basics;
005    
006    import graphlab.graph.graph.VertexModel;
007    
008    import java.util.ArrayList;
009    
010    /**
011     * @author Rouzbeh Ebrahimi
012     */
013    public class Path {
014        ArrayList<VertexModel> pathVertices;
015    
016        public Path() {
017            pathVertices = new ArrayList<VertexModel>();
018        }
019    
020        public boolean add(VertexModel v) {
021            if (!pathVertices.contains(v)) {
022                pathVertices.add(v);
023                return true;
024            } else {
025                return false;
026            }
027        }
028    
029        public void removeLastVertex() {
030            this.pathVertices.remove(pathVertices.size());
031        }
032    
033        public void removeFirstVertex() {
034            this.pathVertices.remove(0);
035        }
036    
037    }