Add predefined Velocity and CSS templates if wiki builder is assigned to a project
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / model / DisplayableComparator.java
1 package com.quantum.model;
2
3 import java.util.Comparator;
4
5
6 /**
7  * This class is used to compare two displayable objects.
8  * 
9  * @author BC Holmes
10  */
11 public class DisplayableComparator implements Comparator {
12
13         public int compare(Object arg0, Object arg1) {
14                 if (arg0 == null && arg1 == null) {
15                         return 0;
16                 } else if (arg0 == null) {
17                         return -1;
18                 } else if (arg1 == null) {
19                         return 1;
20                 } else {
21                         return compare((Displayable) arg0, (Displayable) arg1);
22                 }
23         }
24
25         /**
26          * @param displayable0
27          * @param displayable1
28          * @return
29          */
30         private int compare(Displayable displayable0, Displayable displayable1) {
31                 if (displayable0.getDisplayName() == null && displayable1.getDisplayName() == null) {
32                         return 0;
33                 } else if (displayable0.getDisplayName() == null) {
34                         return -1;
35                 } else if (displayable1.getDisplayName() == null) {
36                         return 1;
37                 } else {
38                         return displayable0.getDisplayName().toLowerCase().compareTo(
39                                         displayable1.getDisplayName().toLowerCase());
40                 }
41         }
42
43 }