List of usage examples for java.util Locale ENGLISH
Locale ENGLISH
To view the source code for java.util Locale ENGLISH.
Click Source Link
From source file:de.tudarmstadt.ukp.dkpro.argumentation.sequence.report.ConfusionMatrixTools.java
public static String prettyPrintConfusionMatrixResults(ConfusionMatrix cm) { cm.printNiceResults();/*from w w w . j a va2 s . c o m*/ String f = "%.3f"; List<String> header = new ArrayList<>(); List<String> row = new ArrayList<>(); header.add("Macro F1"); header.add("Accuracy"); header.add("Acc CI@95"); row.add(String.format(Locale.ENGLISH, f, cm.getMacroFMeasure())); row.add(String.format(Locale.ENGLISH, f, cm.getAccuracy())); row.add(String.format(Locale.ENGLISH, f, cm.getConfidence95Accuracy())); Map<String, Double> precisionForLabels = cm.getPrecisionForLabels(); Map<String, Double> recallForLabels = cm.getRecallForLabels(); Map<String, Double> fMForLabels = cm.getFMeasureForLabels(); SortedSet<String> labels = new TreeSet<>(precisionForLabels.keySet()); for (String label : labels) { header.add(label + " P"); row.add(String.format(Locale.ENGLISH, f, precisionForLabels.get(label))); header.add(label + " R"); row.add(String.format(Locale.ENGLISH, f, recallForLabels.get(label))); header.add(label + " F1"); row.add(String.format(Locale.ENGLISH, f, fMForLabels.get(label))); } return StringUtils.join(header, GLUE) + "\n" + StringUtils.join(row, GLUE); }
From source file:mobac.program.EnvironmentSetup.java
public static void checkMemory() { Runtime r = Runtime.getRuntime(); long maxHeap = r.maxMemory(); String heapMBFormatted = String.format(Locale.ENGLISH, "%3.2f MiB", maxHeap / 1048576d); log.info("Total available memory to MOBAC: " + heapMBFormatted); if (maxHeap < 200000000) { String msg = "<html><b>WARNING:</b> Mobile Atlas Creator has been started " + "with a very small amount of memory assigned.<br>" + "The current maximum usable amount of memory to Mobile Atlas Creator is <b>" + heapMBFormatted + "</b>.<br><br>Please make sure to start Mobile Atlas Creator in " + "the future via the provided start scripts <i>Mobile Atlas Creator.exe</i><br>" + "on Windows or <i>start.sh</i> on Linux/Unix/OSX or add the " + "parameter <b>-Xmx 512M</b> to your startup command.<br><br>" + "Example: <i>java -Xmx512M -jar Mobile_Atlas_Creator.jar</i><br>" + "<br><center>Press OK to continue and start Mobile Atlas Creator</center></html>"; JOptionPane.showMessageDialog(null, msg, "Warning: low memory", JOptionPane.WARNING_MESSAGE); }//from w ww. j a v a2 s .c o m }
From source file:Main.java
/** * Method to change update date in xml files - used for reloadable issue and auto change on start up. * // ww w . j a v a 2 s. c o m * @param target document * @return updated document * @throws ParseException */ private static Document changeDate(Document target) throws ParseException { NodeList parents = target.getElementsByTagName("g:options"); Element parent = (Element) parents.item(0); //g:options - only 1 element DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH); Date newT = new Date(); String time = format.format(newT); parent.setAttribute("time", time); return target; }
From source file:am.ik.categolj2.api.file.FileResource.java
@JsonProperty public String getFileExtension() { return Files.getFileExtension(fileName).toLowerCase(Locale.ENGLISH); }
From source file:Main.java
/** * Method to check difference between actual time and saved time in xml file. * /*from w ww .java 2s. co m*/ * @param target document * @return time difference as integer * @throws ParseException */ public static int checkDateDifference(Document target) throws ParseException { int diff = 0; NodeList parents = target.getElementsByTagName("g:options"); Element parent = (Element) parents.item(0); //g:options - only 1 element DateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ENGLISH); //date xml String time = parent.getAttribute("time"); Date oldT = format.parse(time); //date now Date newT = new Date(); //compare diff = (int) ((newT.getTime() - oldT.getTime()) / 1000); return diff; }
From source file:Main.java
/** * Maps the given name of a bzip2-compressed file to the name that the * file should have after uncompression. Commonly used file type specific * suffixes like ".tbz" or ".tbz2" are automatically detected and * correctly mapped. For example the name "package.tbz2" is mapped to * "package.tar". And any filenames with the generic ".bz2" suffix * (or any other generic bzip2 suffix) is mapped to a name without that * suffix. If no bzip2 suffix is detected, then the filename is returned * unmapped.// www . j a v a 2 s. c o m * * @param filename name of a file * @return name of the corresponding uncompressed file */ public static String getUncompressedFilename(String filename) { String lower = filename.toLowerCase(Locale.ENGLISH); int n = lower.length(); // Shortest suffix is three letters (.bz), longest is five (.tbz2) for (int i = 3; i <= 5 && i < n; i++) { Object suffix = uncompressSuffix.get(lower.substring(n - i)); if (suffix != null) { return filename.substring(0, n - i) + suffix; } } return filename; }
From source file:be.ceau.chart.enums.BorderCapStyle.java
private BorderCapStyle() { this.serialized = name().toLowerCase(Locale.ENGLISH); }
From source file:io.lavagna.model.util.ShortNameGenerator.java
/** * <p>// ww w . j a va 2 s.c om * Generate a short name given the full project name. * * Total length returned is equal or less than 8. * </p> * * <p> * Heuristic: * </p> * <ul> * <li>if name is less or equals than 6 chars and is a single word, the short name will be UPPER(name)</li> * <li>if the project has multiple words, it will concatenate each words. If a word has a length more than 4: * <ul> * <li>it will take only the upper case characters if there are more than 1.</li> * <li>else it will take the first two characters.</li> * </ul> * </li> * </ul> * * @param name * @return */ public static String generateShortNameFrom(String name) { if (StringUtils.isBlank(name)) { return name; } String t = name.trim().replace("-", ""); String[] splitted = t.split("\\s+"); if (splitted.length == 1) { return splitted[0].substring(0, Math.min(6, splitted[0].length())).toUpperCase(Locale.ENGLISH); } StringBuilder sb = new StringBuilder(); for (String token : splitted) { if (token.length() <= 4) { sb.append(token); } else if (countUpperCase(token) > 1) { sb.append(takeFirstFourUpperCaseChars(token)); } else { sb.append(token.substring(0, 3)); } } return sb.toString().toUpperCase(Locale.ENGLISH).substring(0, Math.min(8, sb.length())); }
From source file:Main.java
public static String toSafeColumnName(String columnName) { // SCTO-567 - begin all column names with "c_" to avoid possible conflicts with // reserved keywords; also, escape any potentially-illegal characters return "c_" + columnName.trim().replaceAll("[^A-Za-z0-9_]", "_").toLowerCase(Locale.ENGLISH); }
From source file:net.sf.util.zip.FileNameUtil.java
/** * * @param name the filename// ww w . ja v a 2 s .com * @return the file extension or empty string if there is no extension */ public static String getExtension(String name) { final String lower = name.toLowerCase(Locale.ENGLISH); String ext = null; try { ext = lower.substring(lower.lastIndexOf("."), lower.length()); } catch (Throwable t) { ext = ""; } return ext; }