KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > content > comparators > ContainerListByPageComparator


1 package org.jahia.content.comparators;
2
3 import java.util.Comparator JavaDoc;
4 import org.jahia.services.containers.ContentContainerList;
5
6 /**
7  * <p>Title: This container list comparator orders containers lists by page ID</p>
8  * <p>Description: </p>
9  * <p>Copyright: Copyright (c) 2002</p>
10  * <p>Company: Jahia Ltd</p>
11  * @author Serge Huber
12  * @version 1.0
13  */

14
15 public class ContainerListByPageComparator implements Comparator JavaDoc {
16
17     public ContainerListByPageComparator() {
18     }
19
20     public int compare(Object JavaDoc o1, Object JavaDoc o2) {
21         ContentContainerList leftContainerList = (ContentContainerList) o1;
22         ContentContainerList rightContainerList = (ContentContainerList) o2;
23         return new Integer JavaDoc(leftContainerList.getPageID()).compareTo(new Integer JavaDoc(rightContainerList.getPageID()));
24     }
25
26     public boolean equals(Object JavaDoc obj) {
27         if (obj instanceof ContainerListByPageComparator) {
28             return true;
29         } else {
30             return false;
31         }
32     }
33
34 }
Popular Tags