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.Comparator; 009 010 /** 011 * @author Rouzbeh Ebrahimi 012 */ 013 public class VertexCycleLengthComparator implements Comparator { 014 public VertexCycleLengthComparator() { 015 016 } 017 018 public int compare(Object o1, Object o2) { 019 VertexModel v1 = (VertexModel) o1; 020 VertexModel v2 = (VertexModel) o2; 021 int v1i1 = ((PathProperties) v1.getProp().obj).getFirstColor(); 022 int v1i2 = ((PathProperties) v1.getProp().obj).getSecondColor(); 023 Integer v1i = new Integer(v1i1 + v1i2); 024 Integer v2i1 = ((PathProperties) v2.getProp().obj).getFirstColor(); 025 Integer v2i2 = ((PathProperties) v2.getProp().obj).getSecondColor(); 026 Integer v2i = new Integer(v2i1 + v2i2); 027 028 return v1i.compareTo(v2i); 029 030 } 031 }