Examples of Splitter


Examples of com.google.common.base.Splitter

        }

        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

Examples of com.google.common.base.Splitter

   * @param resourceName Where to get the data.
   * @return A matrix of the results.
   * @throws IOException If there is an error reading the data
   */
  static Matrix readCsv(String resourceName) throws IOException {
    Splitter onCommas = Splitter.on(',').trimResults(CharMatcher.anyOf(" \""));

    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) {
      labels.put(value, column);
      column++;
    }
    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

Examples of com.google.common.base.Splitter

    //
    // This test uses a deterministic split that is neither outstandingly good nor bad


    RandomUtils.useTestSeed();
    Splitter onComma = Splitter.on(",");

    // read the data
    List<String> raw = Resources.readLines(Resources.getResource("iris.csv"), Charsets.UTF_8);

    // holds features
    List<Vector> data = Lists.newArrayList();

    // holds target variable
    List<Integer> target = Lists.newArrayList();

    // for decoding target values
    Dictionary dict = new Dictionary();

    // for permuting data later
    List<Integer> order = Lists.newArrayList();

    for (String line : raw.subList(1, raw.size())) {
      // order gets a list of indexes
      order.add(order.size());

      // 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

Examples of com.google.common.base.Splitter

    }
  }

  @Test
  public void incompleteBeta() throws IOException {
    Splitter onComma = Splitter.on(",").trimResults();

    InputSupplier<InputStreamReader> input =
        Resources.newReaderSupplier(Resources.getResource("beta-test-data.csv"), Charsets.UTF_8);
    boolean header = true;
    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

Examples of com.google.gwt.thirdparty.guava.common.base.Splitter

          return new String[]{"userAgents"};
        }

        @Override
        public boolean setString(String str) {
          Splitter splitter = Splitter.on(",").omitEmptyStrings().trimResults();
          shell.userAgentsOpt = ImmutableSet.copyOf(splitter.split(str));
          return true;
        }
      });

      registerHandler(new ArgHandlerIncrementalCompile(options));
View Full Code Here

Examples of com.intellij.openapi.ui.Splitter

    public static void updateSplitterProportion(final JComponent root, final float proportion) {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                if (root instanceof Splitter) {
                    Splitter splitter = (Splitter) root;
                    splitter.setProportion(proportion);
                } else {
                    Component[] components = root.getComponents();
                    for (Component component : components) {
                        if (component instanceof JComponent) {
                            updateSplitterProportion((JComponent) component, proportion);
View Full Code Here

Examples of com.intellij.openapi.ui.Splitter

    private void createUIComponents() {
        prefixItemDataPanel = new AlternateGenericPrefixRegexItemDataPanel();
        postfixItemDataPanel = new AlternateGenericPostfixRegexItemDataPanel();
        fileExtensionItemDataPanel = new AlternateGenericFileExtensionRegexItemDataPanel();

        Splitter innerSplitter = new Splitter(false, 0.5f);
        innerSplitter.setHonorComponentsMinimumSize(true);

        innerSplitter.setFirstComponent(createItemDataPanel(prefixItemDataPanel, AlternateGenericPrefixPostfixRegexItem.GenericType.PREFIX.getText()));
        innerSplitter.setSecondComponent(createItemDataPanel(postfixItemDataPanel, AlternateGenericPrefixPostfixRegexItem.GenericType.POSTFIX.getText()));

        Splitter outerSplitter = new Splitter(false, 0.67f);
        outerSplitter.setHonorComponentsMinimumSize(true);
        outerSplitter.setFirstComponent(innerSplitter);
        outerSplitter.setSecondComponent(createItemDataPanel(fileExtensionItemDataPanel, "File Extension"));

        //
        dataPanel = outerSplitter;
    }
View Full Code Here

Examples of com.intellij.openapi.ui.Splitter

        dataInterfaces.add(freeRegexPanel);
        ((Splitter) regexSplitter).setSecondComponent(freeRegexPanel.getRootComponent());
    }

    private void createUIComponents() {
        regexSplitter = new Splitter(true, 0.5f);
    }
View Full Code Here

Examples of dk.brics.xact.analysis.transformations.Splitter

      return output;
  }
 
  private List<FlowGraph> splitFlowGraph(FlowGraph g) {
    startPhase("Splitting flow graph...");
    List<FlowGraph> list = new Splitter().split(g);
    Debug.println(2, true, "Created " + list.size() + " subgraphs");
    diagnostics.afterSplit(g, list);
    endPhase();
    return list;
  }
View Full Code Here

Examples of org.apache.camel.processor.Splitter

    }

    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        Processor childProcessor = routeContext.createProcessor(this);
        return new Splitter(getExpression().createExpression(routeContext), childProcessor);
    }
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.