From: <jbo...@li...> - 2005-12-19 21:41:13
|
Author: wrzep Date: 2005-12-19 16:41:00 -0500 (Mon, 19 Dec 2005) New Revision: 1879 Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByNameComparator.java trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByScoreComparator.java Removed: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectByScoreComparator.java Log: http://jira.jboss.com/jira/browse/JBLAB-415 Pawel Deleted: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectByScoreComparator.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectByScoreComparator.java 2005-12-19 21:38:50 UTC (rev 1878) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectByScoreComparator.java 2005-12-19 21:41:00 UTC (rev 1879) @@ -1,26 +0,0 @@ -package org.jboss.forge.status; - -import java.util.Comparator; - -import org.jboss.forge.status.plugins.Plugin; - -public class ProjectByScoreComparator implements Comparator { - - private Plugin orderPlugin; - - public ProjectByScoreComparator(Plugin orderPlugin) { - this.orderPlugin = orderPlugin; - } - - public int compare(Object o1, Object o2) { - - String project1Id = (String) o1; - String project2Id = (String) o2; - - Long project1Score = new Long(orderPlugin.getValue(project1Id)); - Long project2Score = new Long(orderPlugin.getValue(project2Id)); - - return project2Score.compareTo(project1Score); - } - -} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByNameComparator.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByNameComparator.java 2005-12-19 21:38:50 UTC (rev 1878) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByNameComparator.java 2005-12-19 21:41:00 UTC (rev 1879) @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status; + +import java.util.Comparator; + +import org.jboss.forge.common.projects.Projects; + +/** + * + * @author Pawel Wrzeszcz + * + */ + +public class ProjectsByNameComparator implements Comparator<String> { + + private Projects projects; + + public ProjectsByNameComparator(Projects projects) { + this.projects = projects; + } + + public int compare(String project1Id, String project2Id) { + + String project1Name = projects.getProjectName(project1Id); + String project2Name = projects.getProjectName(project2Id); + + return project1Name.compareTo(project2Name); + } + +} Added: trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByScoreComparator.java =================================================================== --- trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByScoreComparator.java 2005-12-19 21:38:50 UTC (rev 1878) +++ trunk/forge/portal-extensions/forge-status/src/java/org/jboss/forge/status/ProjectsByScoreComparator.java 2005-12-19 21:41:00 UTC (rev 1879) @@ -0,0 +1,51 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ + +package org.jboss.forge.status; + +import java.util.Comparator; + +import org.jboss.forge.status.plugins.Plugin; + +/** + * + * @author Pawel Wrzeszcz + * + */ + +public class ProjectsByScoreComparator implements Comparator<String> { + + private Plugin orderPlugin; + + public ProjectsByScoreComparator(Plugin orderPlugin) { + this.orderPlugin = orderPlugin; + } + + public int compare(String project1Id, String project2Id) { + + Long project1Score = new Long(orderPlugin.getValue(project1Id)); + Long project2Score = new Long(orderPlugin.getValue(project2Id)); + + return project2Score.compareTo(project1Score); + } + +} |