Example usage for java.util SortedSet toString

List of usage examples for java.util SortedSet toString

Introduction

In this page you can find the example usage for java.util SortedSet toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:com.redhat.rhn.manager.user.CreateUserCommand.java

/**
 * Private helper method to validate the user's prefix. Puts errors into the
 * errors list.//  w  w  w. j  av a2 s .  c om
 */
private void validatePrefix() {
    String prefix = user.getPrefix();
    if (prefix != null) {
        // Make sure whether prefix is valid, if it is set
        SortedSet validPrefixes = LocalizationService.getInstance().availablePrefixes();
        if (prefix.isEmpty()) {
            user.setPrefix(" ");
        }
        if (!validPrefixes.contains(user.getPrefix())) {
            errors.add(new ValidatorError("error.user_invalid_prefix", prefix, validPrefixes.toString()));
        }
    }
}

From source file:com.espertech.esper.filter.TestFilterSpecParamComparator.java

public void testCompareAll() {
    SortedSet<FilterOperator> sorted = new TreeSet<FilterOperator>(comparator);

    for (int i = 0; i < FilterOperator.values().length; i++) {
        FilterOperator op = FilterOperator.values()[i];
        sorted.add(op);/*from   w w w  .j  av  a2 s. c om*/
    }

    assertEquals(FilterOperator.EQUAL, sorted.first());
    assertEquals(FilterOperator.BOOLEAN_EXPRESSION, sorted.last());
    assertEquals(
            "[EQUAL, IS, IN_LIST_OF_VALUES, RANGE_OPEN, RANGE_HALF_OPEN, RANGE_HALF_CLOSED, RANGE_CLOSED, LESS, LESS_OR_EQUAL, GREATER_OR_EQUAL, GREATER, NOT_RANGE_CLOSED, NOT_RANGE_HALF_CLOSED, NOT_RANGE_HALF_OPEN, NOT_RANGE_OPEN, NOT_IN_LIST_OF_VALUES, NOT_EQUAL, IS_NOT, BOOLEAN_EXPRESSION]",
            sorted.toString());

    log.debug(".testCompareAll " + Arrays.toString(sorted.toArray()));
}

From source file:com.sillelien.dollar.DollarOperatorsRegressionTest.java

public void regression(String symbol, String operation, String variant, @NotNull List<List<var>> result)
        throws IOException {
    String filename = operation + "." + variant + ".json";
    final JsonArray previous = new JsonArray(IOUtils.toString(getClass().getResourceAsStream("/" + filename)));
    //Use small to stop massive string creation
    final File file = new File("target", filename);
    final var current = $(result);
    FileUtils.writeStringToFile(file, current.jsonArray().encodePrettily());
    System.out.println(file.getAbsolutePath());
    SortedSet<String> typeComparison = new TreeSet<>();
    SortedSet<String> humanReadable = new TreeSet<>();
    for (List<var> res : result) {
        if (res.size() != 3) {
            throw new IllegalStateException(res.toString());
        }/*from  w  w w .j  a  va2  s.c o  m*/

        typeComparison.add(
                res.get(0).$type() + " " + operation + " " + res.get(1).$type() + " = " + res.get(2).$type());
        humanReadable.add(res.get(0).toDollarScript() + " " + symbol + " " + res.get(1).toDollarScript()
                + " <=> " + res.get(2).toDollarScript());
    }
    final String typesFile = operation + "." + variant + ".types.txt";
    final String humanFile = operation + "." + variant + ".ds";
    FileUtils.writeLines(new File("target", typesFile), typeComparison);
    FileUtils.writeLines(new File("target", humanFile), humanReadable);
    final TreeSet previousTypeComparison = new TreeSet<String>(
            IOUtils.readLines(getClass().getResourceAsStream("/" + typesFile)));
    diff("type", previousTypeComparison.toString(), typeComparison.toString());
    diff("result", previous, current.jsonArray());
}

From source file:dollar.DollarOperatorsRegressionTest.java

public void regression(@NotNull String symbol, @NotNull String operation, @NotNull String variant,
        @NotNull List<List<Value>> result) throws IOException {
    String filename = operation + "." + variant + ".json";
    final JsonArray previous = new JsonArray(
            new String(ByteStreams.toByteArray(getClass().getResourceAsStream("/" + filename))));
    //Use small to stop massive string creation
    final File file = new File("target", filename);
    final Value current = DollarStatic.$(result);
    Files.write(current.jsonArray().encodePrettily(), file, Charset.forName("utf-8"));
    System.out.println(file.getAbsolutePath());
    SortedSet<String> typeComparison = new TreeSet<>();
    SortedSet<String> humanReadable = new TreeSet<>();
    for (List<Value> res : result) {
        if (res.size() != 3) {
            throw new IllegalStateException(res.toString());
        }//from w  ww . java 2s  .  co m

        typeComparison.add(
                res.get(0).$type() + " " + operation + " " + res.get(1).$type() + " = " + res.get(2).$type());
        humanReadable.add(res.get(0).toDollarScript() + " " + symbol + " " + res.get(1).toDollarScript()
                + " <=> " + res.get(2).toDollarScript());
    }
    final String typesFile = operation + "." + variant + ".types.txt";
    final String humanFile = operation + "." + variant + ".ds";
    Files.asCharSink(new File("target", typesFile), Charset.forName("utf-8")).writeLines(typeComparison);
    Files.asCharSink(new File("target", humanFile), Charset.forName("utf-8")).writeLines(humanReadable);
    final TreeSet previousTypeComparison = new TreeSet<>(Resources
            .asCharSource(getClass().getResource("/" + typesFile), Charset.forName("utf-8")).readLines());
    diff("type", previousTypeComparison.toString(), typeComparison.toString());
    diff("result", previous, current.jsonArray());
}

From source file:com.castis.xylophone.adsmadapter.convert.axistree.ConvertMgad.java

private String toPpsString(SortedSet<Integer> ppsSlotNumber) {
    return ppsSlotNumber.toString().substring(1, ppsSlotNumber.toString().length() - 1).replaceAll("\\p{Space}",
            "");/*from   www.j  av a 2s.c o  m*/
}