KickJava   Java API By Example, From Geeks To Geeks.

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


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

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