Example usage for java.util Locale ENGLISH

List of usage examples for java.util Locale ENGLISH

Introduction

In this page you can find the example usage for java.util Locale ENGLISH.

Prototype

Locale ENGLISH

To view the source code for java.util Locale ENGLISH.

Click Source Link

Document

Useful constant for language.

Usage

From source file:haflow.component.mahout.logistic.RunLogistic.java

static void mainToOutput(String[] args) throws Exception {
    if (parseArgs(args)) {
        if (!showAuc && !showConfusion && !showScores) {
            showAuc = true;/*  w  ww. java2s.  c  om*/
            showConfusion = true;
        }

        //PrintWriter output=new PrintWriter(new FileOutputStream(outputFile),true);

        PrintWriter output = new PrintWriter(HdfsUtil.writeHdfs(outputFile), true);
        PrintWriter acc_output = new PrintWriter(HdfsUtil.writeHdfs(accurateFile), true);
        Auc collector = new Auc();
        LogisticModelParameters lmp = LogisticModelParameters.loadFrom(HdfsUtil.open(modelFile));

        CsvRecordFactory csv = lmp.getCsvRecordFactory();
        OnlineLogisticRegression lr = lmp.createRegression();
        BufferedReader in = new BufferedReader(new InputStreamReader(HdfsUtil.open(inputFile)));
        String line = in.readLine();
        csv.firstLine(line);
        line = in.readLine();
        if (showScores) {
            output.println("\"target\",\"model-output\",\"log-likelihood\"");
        }
        while (line != null) {
            Vector v = new SequentialAccessSparseVector(lmp.getNumFeatures());
            int target = csv.processLine(line, v);

            double score = lr.classifyScalar(v);
            if (showScores) {
                output.printf(Locale.ENGLISH, "%d,%.3f,%.6f%n", target, score, lr.logLikelihood(target, v));
            }
            collector.add(target, score);
            line = in.readLine();
        }

        if (showAuc) {
            acc_output.printf(Locale.ENGLISH, "AUC , %.2f%n", collector.auc());
        }
        if (showConfusion) {
            Matrix m = collector.confusion();
            acc_output.printf(Locale.ENGLISH, "confusion, [[%.1f  %.1f], [%.1f  %.1f]]%n", m.get(0, 0),
                    m.get(1, 0), m.get(0, 1), m.get(1, 1));
            m = collector.entropy();
            acc_output.printf(Locale.ENGLISH, "entropy, [[%.1f  %.1f], [%.1f  %.1f]]%n", m.get(0, 0),
                    m.get(1, 0), m.get(0, 1), m.get(1, 1));
        }
        output.close();
        acc_output.close();
    }
}

From source file:com.futureplatforms.kirin.internal.JSONUtils.java

private static String hex(char ch) {
    return Integer.toHexString(ch).toUpperCase(Locale.ENGLISH);
}

From source file:com.example.app.profile.ui.terminology.ProfileTermsEditor.java

@Override
public void init() {
    super.init();
    final Locale inputLocale = Locale.ENGLISH;
    final LocaleContext inputLocaleContext = LocaleUtil.getLocaleContext(inputLocale);
    final FunctionColumn<ProfileTerm, TextSource> providerCol = new FunctionColumn<ProfileTerm, TextSource>(
            ProfileTerm.class, TextSource.class, this::getTerm) {
        @Override//  w ww  . j  av a  2s .c o  m
        public boolean isValueEditable(Object rowData) {
            return true;
        }

        @Override
        public void setValue(Object rowData, Object value) {
            final ProfileTerm pt = (ProfileTerm) rowData;
            final TransientLocalizedObjectKey tlok = _termMap.get(pt);
            final TextSource defaultTerm = getDefaultTerm(pt);
            String existing = tlok.getText() == null ? null : tlok.getText().get(inputLocale);
            if (!defaultTerm.getText(inputLocaleContext).toString().equals(value)) {
                if (!Objects.equals(existing, value)) {
                    tlok.addLocalization(inputLocale, value.toString());
                    _modificationState = ModificationState.CHANGED;
                }
            } else {
                if (existing != null && tlok.getText() != null) {
                    tlok.removeLocalization(inputLocale);
                    _modificationState = ModificationState.CHANGED;
                }
            }
        }
    };
    providerCol.setColumnName(_company.getName());
    final FunctionColumn<ProfileTerm, TextSource> defaultCol = new FunctionColumn<>(ProfileTerm.class,
            TextSource.class, this::getDefaultTerm);
    defaultCol.setColumnName(CommonColumnText.DEFAULT);

    _table = new DataColumnTable<>(providerCol, defaultCol);
    _table.addClassName("profile-terms");

    final LocalizedObjectKeyFieldComponent field = new LocalizedObjectKeyFieldComponent();
    field.setInputLocale(inputLocale);
    field.setInsertLocalizedObjectKeyWhenEmpty(false);
    field.setUpdateLocalizedObjectKeyWhenEmpty(true);
    field.setTrimWhitespace(true);
    final Column providerColumn = _table.getUIColumn(providerCol);
    assert providerColumn != null;
    providerColumn.setTableCellEditor(field);
    add(_table);
    setValue(_profileTerms);
}

From source file:com.example.app.config.ShellCommandsUtil.java

/**
 * Create a Localized Object Key from the given value
 *
 * @param value the value to create an LoK from
 *
 * @return an LoK/*  w w  w .  j a  va  2s .  c om*/
 *
 * @throws LocaleSourceException if creating the LoK failed
 */
public LocalizedObjectKey createLoK(String value) throws LocaleSourceException {
    TransientLocalizedObjectKey valueKey = new TransientLocalizedObjectKey(new HashMap<>());
    valueKey.addLocalization(Locale.ENGLISH, value);

    return valueKey.updateOrStore(_jdbcLocaleSource, null);
}

From source file:io.github.xxyy.simplegiveall.SimpleGiveallMain.java

private void initialiseConfig() {
    this.getConfig().options().copyDefaults(true);
    this.getConfig().options().copyHeader(true);
    this.getConfig().options().header(LICENSE_HEADER
            + "\nLocale format: http://docs.oracle.com/javase/7/docs/api/java/util/Locale.html#forLanguageTag%28java.lang.String%29");
    this.getConfig().addDefault("locale", Locale.ENGLISH.toLanguageTag());
    saveConfig();/*from w  ww  .  j  a v  a  2  s  .c om*/
}

From source file:Main.java

/**
 * Get an uppercase hex string of the specified length, representing the given number.
 *
 * @param num The number to represent.//from   w  w w  .j  av  a 2  s  .c o m
 * @param len The desired length of the output.
 * @return The uppercase hex string.
 */
private static String hexString(final int num, final int len) {
    final StringBuilder out = new StringBuilder(len);
    final String hex = Integer.toHexString(num).toUpperCase(Locale.ENGLISH);
    final int n = len - hex.length();
    for (int i = 0; i < n; i++) {
        out.append('0');
    }
    out.append(hex);
    return out.toString();
}

From source file:au.com.onegeek.lambda.core.provider.WebDriverBackedSeleniumProvider.java

public void sleep(String wait) throws InterruptedException, ParseException {
    NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH);
    Number number = format.parse(wait);
    this.sleep(number.intValue());
}

From source file:com.bellman.bible.service.format.osistohtml.taghandler.TitleHandler.java

@Override
public void start(Attributes attrs) {
    //JSword adds the chapter no at the top but hide this because the chapter is in the Embedded Bible header
    boolean addedByJSword = attrs.getLength() == 1
            && OSISUtil.GENERATED_CONTENT.equals(attrs.getValue(OSISUtil.OSIS_ATTR_TYPE));
    // otherwise show if user wants Titles or the title is canonical
    isShowTitle = !addedByJSword && (parameters.isShowTitles()
            || "true".equalsIgnoreCase(attrs.getValue(OSISUtil.OSIS_ATTR_CANONICAL)));

    if (isShowTitle) {
        // ESV has subType butcom.bellmantext has lower case subtype so concatenate both and search with contains()
        String subtype = attrs.getValue(OSISUtil.OSIS_ATTR_SUBTYPE)
                + attrs.getValue(OSISUtil.OSIS_ATTR_SUBTYPE.toLowerCase(Locale.ENGLISH));
        isMoveBeforeVerse = (StringUtils.containsIgnoreCase(subtype, PREVERSE)
                || (!verseInfo.isTextSinceVerse && verseInfo.currentVerseNo > 0));
        if (isMoveBeforeVerse) {
            // section Titles normally come before a verse, so overwrite the, already written verse, which is rewritten on writer.finishedInserting
            writer.beginInsertAt(verseInfo.positionToInsertBeforeVerse);
        }//from  w w w  .j a va 2s  .c  o m

        // get title type from level
        String titleClass = "heading" + TagHandlerHelper.getAttribute(OSISUtil.OSIS_ATTR_LEVEL, attrs, "1");

        writer.write("<h1 class='" + titleClass + "'>");
    } else {
        writer.setDontWrite(true);
    }
}

From source file:com.igormaznitsa.jcp.utils.PreprocessorUtils.java

@Nonnull
@MustNotContainNull//from  w ww  .  j  a v  a  2  s  .  c  om
@ThrowsRuntimeException(value = NullPointerException.class, reference = "if extensions are null")
public static String[] splitExtensionCommaList(@Nonnull final String extensions) {
    assertNotNull("String of extensions is null", extensions);

    final String trimmed = extensions.trim();

    String[] result;

    if (trimmed.isEmpty()) {
        result = new String[0];
    } else {
        result = splitForChar(extensions, ',');
        for (int li = 0; li < result.length; li++) {
            result[li] = result[li].trim().toLowerCase(Locale.ENGLISH);
        }
    }

    return result;
}

From source file:org.shredzone.cilla.view.SearchView.java

/**
 * Shows the view result page./*from  w w w  . j  av  a2  s . co m*/
 */
@Framed
@View(pattern = "/search", name = "search")
@View(pattern = "/search/${date}", name = "search")
public String searchView(HttpServletRequest req, @Optional @PathPart("date") DateRange date,
        @Optional @Parameter("p") PaginatorModel paginator, @Optional @Parameter("q") String query)
        throws ViewException {
    if (query == null) {
        return "view/search.jsp";
    }

    if (query.trim().isEmpty()) {
        req.setAttribute("message", "search.msg.noterm");
        return "view/search.jsp";
    }

    Locale locale = req.getLocale();
    if (locale == null) {
        locale = Locale.ENGLISH;
    }

    if (paginator == null) {
        paginator = new PaginatorModel();
    }
    paginator.setPerPage(maxEntries);

    FilterModel filter = new FilterModel();
    filter.setLocale(locale);
    filter.setQuery(query);

    try {
        SearchResult result = searchService.search(filter);
        paginator.setCount(result.getCount());
        result.setPaginator(paginator);
        req.setAttribute("result", result);
    } catch (CillaServiceException ex) {
        req.setAttribute("message", "search.msg.failed");
        req.setAttribute("details", ex.getCause().getLocalizedMessage());
    }

    req.setAttribute("paginator", paginator);
    req.setAttribute("query", query);

    return "view/search.jsp";
}