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.genericcloners; 006 007 import graphlab.library.BaseEdge; 008 import graphlab.library.BaseEdgeProperties; 009 import graphlab.library.BaseVertex; 010 import graphlab.library.BaseVertexProperties; 011 012 /** 013 * @author Omid 014 */ 015 016 public class BaseEdgeVertexCopier implements 017 EdgeVertexCopier<BaseVertex, BaseEdge<BaseVertex>> { 018 019 public BaseEdge<BaseVertex> convert(BaseEdge<BaseVertex> e, BaseVertex newSource, BaseVertex newTarget) { 020 if (e != null) 021 return new BaseEdge<BaseVertex>(newSource, newTarget, new BaseEdgeProperties(e.getProp())); 022 else 023 return new BaseEdge<BaseVertex>(newSource, newTarget); 024 } 025 026 public BaseVertex convert(BaseVertex e) { 027 if (e != null) 028 return new BaseVertex(new BaseVertexProperties(e.getProp())); 029 else 030 return new BaseVertex(); 031 } 032 }