1 25 26 package org.objectweb.jonas.webapp.jonasadmin.service.resource; 27 28 import java.util.Comparator ; 29 30 33 public class ResourceItemByFile implements Comparator { 34 35 37 public int compare(Object pO1, Object pO2) { 38 ResourceItem oContainer1 = (ResourceItem) pO1; 39 ResourceItem oContainer2 = (ResourceItem) pO2; 40 if ((oContainer1.getFile() == null) || (oContainer2.getFile() == null)) { 41 if ((oContainer1.getFile() == null) && (oContainer2.getFile() == null)) { 42 return 0; 43 } else if ((oContainer1.getFile() == null) && (oContainer2.getFile() != null)) { 44 return 1; 45 } else { 46 return -1; 47 } 48 } 49 return oContainer1.getFile().compareToIgnoreCase(oContainer2.getFile()); 50 } 51 52 public boolean equals(Object pObj) { 53 if (pObj instanceof ResourceItem) { 54 return true; 55 } 56 return false; 57 } 58 } | Popular Tags |