/****************************************************************************** String Less Than or Equal Ignore Case Comparator ---------------------------------------------------- Copyright (c) Gunnar Gotshalks. All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for NON-COMMERCIAL purposes and without fee is hereby granted. *******************************************************************************/ package FlexOr.container; /** Compare two strings ignoring case.
@author Gunnar Gotshalks @see java.util.Vector @version 1.0 1999 Jan 15 */ public class StringLessThanEqualIC implements BinaryPredicate { /** Return true if string a <= string b, else return false. @exception if at least one of a or b is not a String. */ public final boolean execute(final Object a, final Object b) { if (! (a instanceof String && b instanceof String)) { throw new BinPredParamException(); } return ((String) a).toLowerCase().compareTo(((String) b).toLowerCase()) <= 0; } public static boolean execute(final String a, final String b) { BinaryPredicate comp = new StringLessThanEqual(); return comp.execute(a, b); } }