Package jmri.util

Class CompareUtil


  • public class CompareUtil
    extends java.lang.Object
    Compare values.
    • Method Detail

      • compare

        public static boolean compare​(CompareUtil.CompareType type,
                                      CompareUtil.CompareOperation oper,
                                      java.lang.Object value1,
                                      java.lang.Object value2,
                                      boolean caseInsensitive)
        Compare two values.
        Parameters:
        type - the type
        oper - the operation
        value1 - left side of the comparison
        value2 - right side of the comparison
        caseInsensitive - true if comparison should be case insensitive; false otherwise
        Returns:
        true if values compare per _memoryOperation; false otherwise
      • compareString

        public static boolean compareString​(CompareUtil.CompareOperation oper,
                                            java.lang.Object value1,
                                            java.lang.Object value2,
                                            boolean caseInsensitive)
        Compare two values.
        Parameters:
        oper - the operation
        value1 - left side of the comparison
        value2 - right side of the comparison
        caseInsensitive - true if comparison should be case insensitive; false otherwise
        Returns:
        true if values compare per _memoryOperation; false otherwise
      • compareNumber

        public static boolean compareNumber​(boolean requireNumber,
                                            CompareUtil.CompareOperation oper,
                                            java.lang.Object value1,
                                            java.lang.Object value2,
                                            boolean caseInsensitive)
        Compare two values.
        Parameters:
        requireNumber - true if two numbers are required, false otherwise
        oper - the operation
        value1 - left side of the comparison
        value2 - right side of the comparison
        caseInsensitive - true if comparison should be case insensitive; false otherwise
        Returns:
        true if values compare per _memoryOperation; false otherwise