List of usage examples for java.lang String equalsIgnoreCase
public boolean equalsIgnoreCase(String anotherString)
From source file:com.dbmojo.Util.java
/** Take a String as input. If the String is a Y or a y then true else false. * This is usefull for HTTP request parameters. *///from w w w . j a v a2s.c o m public static boolean getBoolean(String val) { return val != null && (val.equalsIgnoreCase("Y") || val.equalsIgnoreCase("true") || val.equalsIgnoreCase("1")); }
From source file:com.hyunnyapp.easycursor.util.JsonPayloadHelper.java
public static String getString(final JSONObject object, final String key) { final String res = object.optString(key, null); if (key != null && key.equalsIgnoreCase(NULL)) { return null; } else {//from www . ja v a 2s .c o m return res; } }
From source file:conceptnet.ConceptBuilder.java
public static Concept createConcept(String name) { if (name.indexOf(" ") >= 0) { name = name.replace(' ', '_'); }// w w w. j a v a2s. c o m Concept c = getConcept(name); if (c != null) { return c; } c = readConcept(name); if (c != null) { allConcepts.put(name, c); return c; } c = new Concept(name); String conceptStr = JSONStringObtain.get(urlBase + name); if (conceptStr.length() == 0) { return null; } try { JSONObject jso = new JSONObject(conceptStr); JSONArray ae = jso.getJSONArray("edges"); Flag: for (int i = 0; i < ae.length(); i++) { JSONObject e = ae.getJSONObject(i); String id = e.getString("id"); Edge te = allEdges.get(id); if (te == null) { te = new Edge(e); allEdges.put(id, te); } if (te.start.equalsIgnoreCase(te.end)) { continue; } for (String s : stopWord) { if (s.equalsIgnoreCase(te.start) || s.equalsIgnoreCase(te.end)) { continue Flag; } } if (te.start.equalsIgnoreCase(name)) { c.addOutEdge(te); } else if (te.end.equalsIgnoreCase(name)) { c.addInEdge(te); } } allConcepts.put(name, c); saveConcept(c); return c; } catch (Exception e) { e.printStackTrace(); } return null; }
From source file:controllers.charroi.Cars.java
public static void downloadDoc(long id, String doc) { Car car = Car.findById(id);/*from ww w. ja v a 2 s. c o m*/ String ext = ""; if (doc.equalsIgnoreCase("doc1")) { ext = car.doc1Ext; } if (doc.equalsIgnoreCase("doc2")) { ext = car.doc2Ext; } if (doc.equalsIgnoreCase("doc3")) { ext = car.doc3Ext; } if (doc.equalsIgnoreCase("doc4")) { ext = car.doc4Ext; } if (doc.equalsIgnoreCase("doc5")) { ext = car.doc5Ext; } response.setHeader("Content-Disposition", "attachment;filename=\"" + doc + "-" + car.licensePlate + ext + "\""); renderBinary(new File(Car.DOC_DIR + doc + "-" + car.id + ext)); }
From source file:de.tudarmstadt.ukp.dkpro.c4corpus.license.evaluation.LicenseDetectionEvaluation.java
public static void evaluate(String inputFile) throws IOException { List<String> lines = FileUtils.readLines(new File(inputFile)); String licenseType = "(by|by-sa|by-nd|by-nc|by-nc-sa|by-nc-nd|publicdomain)"; String noLicense = "none"; int tp = 0;//from w w w . j a va 2s . c o m int tn = 0; int fp = 0; int fn = 0; for (String line : lines) { String fileID = line.split("\t")[0]; String goldLicense = line.split("\t")[1]; String predictedLicense = line.split("\t")[2]; if (goldLicense.equalsIgnoreCase(predictedLicense)) { if (goldLicense.matches(licenseType)) { tp++; } else if (goldLicense.matches(noLicense)) { tn++; } } else { if (goldLicense.matches(noLicense) && predictedLicense.matches(licenseType)) { fp++; System.out.println("False positive detected: " + fileID); } else if (goldLicense.matches(licenseType) && predictedLicense.matches(noLicense)) { fn++; System.out.println("False negative detected: " + fileID); } } } float precision = tp / (float) (tp + fp); float recall = tp / (float) (tp + fn); float fScore = (2 * precision * recall) / (precision + recall); System.out.println("The page is licensed and predicted as licensed => True Positive: " + tp); System.out.println("The page is not licensed and not predicted as licensed => True Negative: " + tn); System.out.println( "The page has a CC link but not licensed, however predicted as licensed => False Positive: " + fp); System.out.println("The page is licensed but not predicted as licensed => False Negative: " + fn); System.out.println("====================================="); System.out.println("Precision: " + precision); System.out.println("Recall: " + recall); System.out.println("F-Score: " + fScore); }
From source file:com.ExtendedAlpha.SWI.SeparatorLib.PlayerStatsSeparator.java
public static boolean shouldSerialize(String key, SeparateWorldItems plugin) { if (key.equalsIgnoreCase("gamemode") && plugin.getConfigManager().getConfig("config").getBoolean("separate-gamemode-inventories")) return false; return plugin.getConfigManager().getShouldSerialize("player-stats." + key); }
From source file:com.util.StringUtilities.java
public static String getDepartmentByCaseType(String caseType) { String section = NumberFormatService.getSection(caseType); if (section.equalsIgnoreCase("CMDS") || section.equalsIgnoreCase("CSC")) { return "SPBR"; } else {/* ww w . j a va 2 s .c o m*/ return "SERB"; } }
From source file:net.sf.taverna.t2.activities.wsdl.WSDLActivityHealthChecker.java
public static boolean checkStyleAndUse(String style, String use) { return !(style.equalsIgnoreCase("rpc") && use.equalsIgnoreCase("literal")); }
From source file:edu.cmu.sei.ams.cloudlet.impl.CloudletUtilities.java
static String getSafeString(String name, JSONObject json) { try {//from w ww . j av a 2s .co m if (json.has(name)) { // We do a null check here because the server will return "null" instead of null String val = json.getString(name); if (val != null && val.equalsIgnoreCase("null")) val = null; return val; } } catch (Exception e) { } return null; }
From source file:com.marklogic.contentpump.utilities.PermissionUtil.java
public static ContentCapability getCapbility(String cap) { ContentCapability capability = null; if (cap.equalsIgnoreCase(ContentCapability.READ.toString())) { capability = ContentCapability.READ; } else if (cap.equalsIgnoreCase(ContentCapability.EXECUTE.toString())) { capability = ContentCapability.EXECUTE; } else if (cap.equalsIgnoreCase(ContentCapability.INSERT.toString())) { capability = ContentCapability.INSERT; } else if (cap.equalsIgnoreCase(ContentCapability.UPDATE.toString())) { capability = ContentCapability.UPDATE; } else {//from w w w . j a v a2 s . com LOG.error("Illegal permission: " + cap); } return capability; }