From: <the...@us...> - 2003-12-17 17:00:06
|
Update of /cvsroot/junk/junk/WEB-INF/classes/junk/util In directory sc8-pr-cvs1:/tmp/cvs-serv22394 Modified Files: NameOnline.java Computer.java Log Message: implemented Comparable Index: NameOnline.java =================================================================== RCS file: /cvsroot/junk/junk/WEB-INF/classes/junk/util/NameOnline.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** NameOnline.java 25 Nov 2003 12:05:57 -0000 1.6 --- NameOnline.java 17 Dec 2003 17:00:02 -0000 1.7 *************** *** 33,37 **** *@version 0.1 */ ! public class NameOnline implements Serializable { /** name of the resource */ private String name; --- 33,37 ---- *@version 0.1 */ ! public class NameOnline implements Serializable, Comparable { /** name of the resource */ private String name; *************** *** 93,95 **** --- 93,100 ---- return this.getName() + " " + this.getOnline(); } + + public int compareTo(Object o) { + return -((NameOnline)o).getName().compareTo(this.getName()); + } + } Index: Computer.java =================================================================== RCS file: /cvsroot/junk/junk/WEB-INF/classes/junk/util/Computer.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** Computer.java 17 Nov 2003 19:39:59 -0000 1.1.1.1 --- Computer.java 17 Dec 2003 17:00:02 -0000 1.2 *************** *** 25,29 **** import java.util.*; ! public class Computer{ private Boolean online = new Boolean(false); --- 25,29 ---- import java.util.*; ! public class Computer implements Comparable { private Boolean online = new Boolean(false); *************** *** 84,87 **** --- 84,90 ---- } + public int compareTo(Object o) { + return -((Computer)o).getName().compareTo(this.getName()); + } } |