Example usage for java.lang String compareToIgnoreCase

List of usage examples for java.lang String compareToIgnoreCase

Introduction

In this page you can find the example usage for java.lang String compareToIgnoreCase.

Prototype

public int compareToIgnoreCase(String str) 

Source Link

Document

Compares two strings lexicographically, ignoring case differences.

Usage

From source file:ca.uqac.info.trace.XML.Hadoop.HadoopTraceGenerator.java

public static MessageFeeder instantiateFeeder(String name) {
    MessageFeeder mf = null;// w  ww. j  a v  a2s .  c  o m
    if (name.compareToIgnoreCase("HadoopLTLValidator") == 0)
        mf = new HadoopLTLValidatorFeeder();
    return mf;
}

From source file:ca.uqac.info.trace.XML.XMLTraceGenerator.java

public static MessageFeeder instantiateFeeder(String name) {
    MessageFeeder mf = null;//from   ww w  .  java 2 s  .c  om
    if (name.compareToIgnoreCase("LTLValidator") == 0)
        mf = new LTLValidatorFeeder();
    return mf;
}

From source file:org.openmrs.module.providermanagement.ProviderManagementGlobalProperties.java

public static final Boolean stringToBoolean(String str) {

    if (str == null) {
        return null;
    } else if (str.compareToIgnoreCase("true") == 0) {
        return true;
    } else if (str.compareToIgnoreCase("false") == 0) {
        return false;
    } else {/*w  w w  .ja va2 s  .c  o  m*/
        return null;
    }
}

From source file:at.gv.egovernment.moa.id.util.legacy.LegacyHelper.java

public static boolean isUseMandateRequested(HttpServletRequest req) throws WrongParametersException {

    String useMandate = req.getParameter(PARAM_USEMANDATE);
    useMandate = StringEscapeUtils.escapeHtml(useMandate);
    if (!ParamValidatorUtils.isValidUseMandate(useMandate))
        throw new WrongParametersException("StartAuthentication", PARAM_USEMANDATE, "auth.12");

    //check UseMandate flag
    String useMandateString = null;
    if ((useMandate != null) && (useMandate.compareTo("") != 0)) {
        useMandateString = useMandate;/*from  www .  j a  v  a2 s . c o  m*/
    } else {
        useMandateString = "false";
    }

    if (useMandateString.compareToIgnoreCase("true") == 0)
        return true;
    else
        return false;
}

From source file:ca.uqac.info.trace.conversion.TraceConverter.java

/**
 * Initialize the trace reader, based on the string passed from the
 * command-line//from ww w.jav a2s . c  o  m
 * @param input_format The reader name
 * @return An instance of TraceFactory
 */
private static TraceReader initializeReader(String input_format) {
    TraceReader tf = null;
    if (input_format.compareToIgnoreCase("xml") == 0) {
        tf = new XmlTraceReader();
    }
    /*else if (input_format.compareToIgnoreCase("sql") == 0)
    {
        tf = new SqlTraceReader();
    }*/
    else if (input_format.compareToIgnoreCase("csv") == 0) {
        tf = new CsvTraceReader();
    }
    return tf;
}

From source file:oscar.util.OscarRoleObjectPrivilege.java

public static boolean checkPrivilege(String objName, String orgCd, String propPrivilege) {
    try {//  w  ww.  j av a2  s.c  om
        com.quatro.service.security.SecurityManager secManager = (com.quatro.service.security.SecurityManager) pageContext
                .getSession().getAttribute("securitymanager");
        if (orgCd == null)
            orgCd = "";
        String x = secManager.GetAccess(objName, orgCd);
        return x.compareToIgnoreCase(propPrivilege) >= 0;
    } catch (Exception e) {
        MiscUtils.getLogger().error("Error", e);
        return (false);
    }
}

From source file:ca.uqac.info.trace.conversion.TraceConverter.java

/**
 * Initialize the translator, based on the string passed from the
 * command-line/* w  w w  .j av  a2 s  . c  o m*/
 * @param output_format The translator name
 * @return An instance of Translator
 */
private static Translator initializeTranslator(String output_format) {
    Translator trans = null;
    if (output_format.compareToIgnoreCase("smv") == 0) {
        trans = new SmvTranslator();
    } else if (output_format.compareToIgnoreCase("sql") == 0) {
        trans = new SqlTranslator();
    }
    /*else if (output_format.compareToIgnoreCase("javamop") == 0)
    {
        trans = new JavaMopTranslator();
    }
    else if (output_format.compareToIgnoreCase("json") == 0)
    {
        trans = new JsonTranslator();
    }*/
    else if (output_format.compareToIgnoreCase("xml") == 0) {
        trans = new XmlTranslator();
    } else if (output_format.compareToIgnoreCase("promela") == 0) {
        trans = new PromelaTranslator();
    } else if (output_format.compareToIgnoreCase("maude") == 0) {
        trans = new MaudeTranslator();
    }
    return trans;
}

From source file:org.cloudbees.literate.jenkins.promotions.PromotionConfiguration.java

public static int nameCompare(String n1, String n2) {
    return n1.compareToIgnoreCase(n2);
}

From source file:Main.java

public static DefaultMutableTreeNode sortTreeNode(DefaultMutableTreeNode root) {
    if (root == null)
        return root;
    int count = root.getChildCount();
    if (count <= 0)
        return root;
    for (int i = 0; i < count; i++) {
        for (int j = count - 1; j > i; j--) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(j);
            String nt = node.getUserObject().toString();
            DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root.getChildAt(j - 1);
            String np = prevNode.getUserObject().toString();
            if (nt.compareToIgnoreCase(np) < 0) {
                root.insert(node, j - 1);
                root.insert(prevNode, j);
            }/*from ww w . j  a v a  2  s  .com*/
        }
        sortTreeNode((DefaultMutableTreeNode) root.getChildAt(i));
    }

    for (int i = 0; i < count; i++) {
        for (int j = count - 1; j > i; j--) {
            DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(j);
            DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root.getChildAt(j - 1);
            if (prevNode.isLeaf() && !node.isLeaf()) {
                root.insert(node, j - 1);
                root.insert(prevNode, j);
            }
        }
    }

    return root;
}

From source file:com.baasbox.service.dbmanager.DbManagerService.java

public static void importDb(String appcode, ZipInputStream zis) throws FileFormatException, Exception {
    File newFile = null;//from  w  ww  .j  av a2s  . c o m
    FileOutputStream fout = null;
    try {
        //get the zipped file list entry
        ZipEntry ze = zis.getNextEntry();
        if (ze == null)
            throw new FileFormatException("Looks like the uploaded file is not a valid export.");
        if (ze.isDirectory()) {
            ze = zis.getNextEntry();
        }
        if (ze != null) {
            newFile = File.createTempFile("export", ".json");
            fout = new FileOutputStream(newFile);
            IOUtils.copy(zis, fout, BBConfiguration.getImportExportBufferSize());
            fout.close();
        } else {
            throw new FileFormatException("Looks like the uploaded file is not a valid export.");
        }
        ZipEntry manifest = zis.getNextEntry();
        if (manifest != null) {
            File manifestFile = File.createTempFile("manifest", ".txt");
            fout = new FileOutputStream(manifestFile);
            for (int c = zis.read(); c != -1; c = zis.read()) {
                fout.write(c);
            }
            fout.close();
            String manifestContent = FileUtils.readFileToString(manifestFile);
            manifestFile.delete();
            Pattern p = Pattern.compile(BBInternalConstants.IMPORT_MANIFEST_VERSION_PATTERN);
            Matcher m = p.matcher(manifestContent);
            if (m.matches()) {
                String version = m.group(1);
                if (version.compareToIgnoreCase("0.6.0") < 0) { //we support imports from version 0.6.0
                    throw new FileFormatException(String.format(
                            "Current baasbox version(%s) is not compatible with import file version(%s)",
                            BBConfiguration.getApiVersion(), version));
                } else {
                    if (BaasBoxLogger.isDebugEnabled())
                        BaasBoxLogger.debug("Version : " + version + " is valid");
                }
            } else {
                throw new FileFormatException("The manifest file does not contain a version number");
            }
        } else {
            throw new FileFormatException("Looks like zip file does not contain a manifest file");
        }
        if (newFile != null) {
            DbHelper.importData(appcode, newFile);
            zis.closeEntry();
            zis.close();
        } else {
            throw new FileFormatException("The import file is empty");
        }
    } catch (FileFormatException e) {
        BaasBoxLogger.error(ExceptionUtils.getMessage(e));
        throw e;
    } catch (Throwable e) {
        BaasBoxLogger.error(ExceptionUtils.getStackTrace(e));
        throw new Exception("There was an error handling your zip import file.", e);
    } finally {
        try {
            if (zis != null) {
                zis.close();
            }
            if (fout != null) {
                fout.close();
            }
        } catch (IOException e) {
            // Nothing to do here
        }
    }
}