jkdkhdas
[rmh3093.git] / lab5 / bin / act2 / RCS / TeamComparator.java,v
blobe90a489cd4fcc2bc958bfb922df93117e0418586
1 head    1.1;
2 access;
3 symbols;
4 locks
5         rmh3093:1.1; strict;
6 comment @# @;
9 1.1
10 date    2008.04.16.00.54.22;    author rmh3093; state Exp;
11 branches;
12 next    ;
15 desc
16 @initial commit
20 1.1
21 log
22 @Initial revision
24 text
25 @/*
26  * TeamComparator.java
27  *
28  * Version:
29  *     $Id$
30  *
31  * Revisions:
32  *     $Log$
33  */
35 import java.util.Comparator;
37 /**
38  * This class provides a comparator so that teams can be arranged on the 
39  * alternate basis of 'strength of schedule'.
40  *  
41  * @@author Ryan Hope
42  */
43 public class TeamComparator implements Comparator<Team> {
44         
45         /**
46          * compare needed in order to satisfy the interface definition
47          * 
48          * @@param first first of two teams
49          * @@param second second         of two teams
50          * @@return compares two teams, but only on the basis of their strength of 
51          * schedules; returns -1 if the 'first' team has a schedule considered 
52          * stronger than the 'second' team; returns 1 if the 'second' team has a 
53          * schedule considered stronger than the 'first' team; otherwise, returns 0.
54          */
55         public int compare(Team first, Team second) {
56                 if (first.getStrengthOfSchedule() > 
57                 second.getStrengthOfSchedule()) {
58                         return -1;
59                 } else if (first.getStrengthOfSchedule() < 
60                 second.getStrengthOfSchedule()) {
61                         return 1;
62                 } else {
63                         return 0;
64                 }
65         }
66