Example #1
0
 public int compareTo(EBookFormat o) {
   if (o == null) return -1;
   else {
     if (getPriority() == o.getPriority()) return 0;
     else return (getPriority() > o.getPriority() ? -1 : 1);
   }
 }
Example #2
0
 public static EBookFormat fromFormat(String sFormat) {
   // The following should only ever happen in test mode!
   // It is not cnvenient in test to call the routine to initialise
   // the list of formats so we simply assume it is valid
   // We therefore 'fudge' a return value to get tests to work
   if (supportedFormats == null) {
     return new EBookFormat(sFormat, "mimetestdummy");
   }
   for (EBookFormat format : supportedFormats) {
     if (format.getName().equalsIgnoreCase(sFormat)) return format;
   }
   return null;
 }