/*
 * 

jFin, open source derivatives trade processing

* *

Copyright (C) 2005, 2006, 2007 Morgan Brown Consultancy Ltd.

* *

This file is part of jFin.

* *

jFin is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version.

* *

jFin 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 General Public * License for more details.

* *

You should have received a copy of the GNU General Public License along * with jFin; if not, write to the Free Software Foundation, Inc., 51 Franklin * St, Fifth Floor, Boston, MA 02110-1301 USA.

*/ package org.jfin.date; import java.util.Comparator; /** * Provides a comparator for sorting periods into order ready for cutting. * * This differs from the default comparison provided in the implementation of * comparable on the Period class in that: * * 1. It relies only on the startCalendar of the Period * 2. It is used explicitly by the ScheduleCutter and so cannot be overriden * * This allows the ScheduleCutter to be fully isolated from the implementation * of subclasses of Period. */ public class ScheduleCutterPeriodComparator implements Comparator { public int compare(Period period1, Period period2) { return ScheduleGenerator.copyAndReset(period1.getStartCalendar()).compareTo(ScheduleGenerator.copyAndReset(period2.getStartCalendar())); } }

Ads help maintain this website.