Package com.google.common.base

Examples of com.google.common.base.Splitter.split()


        String oldDiff = cleanUp(oldRecord);
        String newDiff = cleanUp(newRecord);

        Splitter splitter = Splitter.on(CharMatcher.anyOf("\r\n"));
        List<String> oldLines = Lists.newArrayList(splitter.split(oldDiff));
        List<String> newLines = Lists.newArrayList(splitter.split(newDiff));
        if (oldLines.equals(newLines)) {
            return "";
        }
        Patch diffs = DiffUtils.diff(oldLines, newLines);
        return Joiner.on("\n").join(DiffUtils.generateUnifiedDiff(DIFF_OLD_FILE_NAME, DIFF_NEW_FILE_NAME, oldLines,
View Full Code Here


    Readable isr = new InputStreamReader(Resources.getResource(resourceName).openStream(), Charsets.UTF_8);
    List<String> data = CharStreams.readLines(isr);
    String first = data.get(0);
    data = data.subList(1, data.size());

    List<String> values = Lists.newArrayList(onCommas.split(first));
    Matrix r = new DenseMatrix(data.size(), values.size());

    int column = 0;
    Map<String, Integer> labels = Maps.newHashMap();
    for (String value : values) {
View Full Code Here

    r.setColumnLabelBindings(labels);

    int row = 0;
    for (String line : data) {
      column = 0;
      values = Lists.newArrayList(onCommas.split(line));
      for (String value : values) {
        r.set(row, column, Double.parseDouble(value));
        column++;
      }
      row++;
View Full Code Here

      // parse the predictor variables
      Vector v = new DenseVector(5);
      v.set(0, 1);
      int i = 1;
      Iterable<String> values = onComma.split(line);
      for (String value : Iterables.limit(values, 4)) {
        v.set(i++, Double.parseDouble(value));
      }
      data.add(v);
View Full Code Here

    for (String line : CharStreams.readLines(input)) {
      if (header) {
        // skip
        header = false;
      } else {
        Iterable<String> values = onComma.split(line);
        double alpha = Double.parseDouble(Iterables.get(values, 0));
        double beta = Double.parseDouble(Iterables.get(values, 1));
        double x = Double.parseDouble(Iterables.get(values, 2));
        double ref = Double.parseDouble(Iterables.get(values, 3));
        double actual = Gamma.incompleteBeta(alpha, beta, x);
View Full Code Here

        }

        // everything else should be merged, duplicates should be eliminated.
        Splitter splitter = Splitter.on(',');
        ImmutableSet.Builder<String> targetValues = ImmutableSet.builder();
        targetValues.addAll(splitter.split(higherPriority.getValue()));
        targetValues.addAll(splitter.split(getValue()));
        higherPriority.getXml().setValue(Joiner.on(',').join(targetValues.build()));
    }

    /**
 
View Full Code Here

        // everything else should be merged, duplicates should be eliminated.
        Splitter splitter = Splitter.on(',');
        ImmutableSet.Builder<String> targetValues = ImmutableSet.builder();
        targetValues.addAll(splitter.split(higherPriority.getValue()));
        targetValues.addAll(splitter.split(getValue()));
        higherPriority.getXml().setValue(Joiner.on(',').join(targetValues.build()));
    }

    /**
     * Merge this attribute value (on a lower priority element) with a implicit default value
View Full Code Here

    }

    private Message.Request parseLine(String line)
    {
        Splitter splitter = Splitter.on(' ').trimResults().omitEmptyStrings();
        Iterator<String> iter = splitter.split(line).iterator();
        if (!iter.hasNext())
            return null;
        String msgType = iter.next().toUpperCase();
        if (msgType.equals("STARTUP"))
        {
View Full Code Here

        long maxErrors = OptionUtil.getLongOption(cmd, maxErrorsOption, 1L);

        if (cmd.hasOption(rolesOption.getLongOpt())) {
            Set<String> roles = new HashSet<String>();
            Splitter splitter = Splitter.on(",").trimResults().omitEmptyStrings();
            for (String role : splitter.split(cmd.getOptionValue(rolesOption.getLongOpt()))) {
                roles.add(role);
            }
            AuthorizationContextHolder.setCurrentContext(new AuthorizationContext("lily-import", repositoryName, roles));
        }
View Full Code Here

        String tableName = OptionUtil.getStringOption(cmd, tableOption, Table.RECORD.name);

        if (cmd.hasOption(rolesOption.getLongOpt())) {
            Set<String> roles = new HashSet<String>();
            Splitter splitter = Splitter.on(",").trimResults().omitEmptyStrings();
            for (String role : splitter.split(cmd.getOptionValue(rolesOption.getLongOpt()))) {
                roles.add(role);
            }
            AuthorizationContextHolder.setCurrentContext(new AuthorizationContext("lily-scan-records", repositoryName, roles));
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.