Package java.util

Examples of java.util.Scanner.nextLine()


    if (num_mat != 0) {
      throw new Error("svdLoadSparseTextHBFile: I don't know how to handle a file "
          + "with elemental matrices (last entry on header line 3)");
    }
    /* Skip the line giving the formats: */
    scanner.nextLine();

    S = new SMat(rows, cols, vals);

    /* Read column pointers. */
    for (i = 0; i <= S.cols; i++) {
View Full Code Here


    static SMat svdLoadSparseTextHBFile(File file) throws FileNotFoundException {
        int i, x, rows, cols, vals, num_mat;
        Scanner scanner = new Scanner(file);
        SMat S;
        /* Skip the header line: */
        scanner.nextLine();
        /* Skip the line giving the number of lines in this file: */
        scanner.nextLine();
        /* Read the line with useful dimensions: */
        scanner.next();
        rows = scanner.nextInt();
View Full Code Here

        Scanner scanner = new Scanner(file);
        SMat S;
        /* Skip the header line: */
        scanner.nextLine();
        /* Skip the line giving the number of lines in this file: */
        scanner.nextLine();
        /* Read the line with useful dimensions: */
        scanner.next();
        rows = scanner.nextInt();
        cols = scanner.nextInt();
        vals = scanner.nextInt();
View Full Code Here

        scanner.next();
        rows = scanner.nextInt();
        cols = scanner.nextInt();
        vals = scanner.nextInt();
        num_mat = scanner.nextInt();
        scanner.nextLine();
        if (num_mat != 0) {
            throw new Error("svdLoadSparseTextHBFile: I don't know how to handle a file "
                    + "with elemental matrices (last entry on header line 3)");
        }
        /* Skip the line giving the formats: */
 
View Full Code Here

        if (num_mat != 0) {
            throw new Error("svdLoadSparseTextHBFile: I don't know how to handle a file "
                    + "with elemental matrices (last entry on header line 3)");
        }
        /* Skip the line giving the formats: */
        scanner.nextLine();

        S = new SMat(rows, cols, vals);

        /* Read column pointers. */
        for (i = 0; i <= S.cols; i++) {
View Full Code Here

        Scanner sc = null;
        try {
            sc = new Scanner(bodyFile);
            String expectedBody = "";
            while (sc.hasNextLine()) {
                expectedBody += sc.nextLine() + "\n";
            }
            expectedBody = expectedBody.substring(0, expectedBody.length()-1);
            return expectedBody;
        } finally {
            if (sc != null) {
View Full Code Here

    static void assertHeaders(File headersFile, ModifiableValueMap m) throws FileNotFoundException {
        Map<String, List<String>> expectedHeaders = new HashMap<String, List<String>>();
        Scanner sc = new Scanner(headersFile);
        while (sc.hasNextLine()) {
            String line = sc.nextLine();
            if (line.startsWith("//"))
                continue;
            String[] colon = line.split(TEST_FILE_FIELD_SEPARATOR);
            String header = colon[0];
            String value = colon[1];
View Full Code Here

    }

    Scanner sc = new Scanner(System.in);
    System.out.println("Type \"quit\" to continue loading MAS.");
    System.out.print("*** New query: >");
    String query = sc.nextLine();
    while (!query.equalsIgnoreCase("quit")) {
      try {
        System.out.println("*** sql");
        Iterator<Resource> resSQL = resolver.findResources(query, Query.JCR_SQL2);
        while (resSQL.hasNext()) {
View Full Code Here

      } catch (Exception e) {
        e.printStackTrace();
      }
     
      System.out.print("*** New query: >");
      query = sc.nextLine();
    }
  }

  @SuppressWarnings("serial")
  private static class Props extends HashMap<String, Object> {
View Full Code Here

  public void buildNewTree(InputStream stream) throws IOException {
    Scanner scan = new Scanner(stream, "UTF-8");
    // creating a new tree
    this.root = new TextNode();
    while (scan.hasNextLine()) {
      String s = scan.nextLine().trim();

      if (s.endsWith("=")) {
        s = s.substring(0, s.length() - 1);
        s = s.trim();
      }
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.