Package java.util

Examples of java.util.Scanner.nextLine()


    // Read the Newick file into a string
    data="";
    Scanner sc = new Scanner(new File("newick.txt"));
    while(sc.hasNext()) {
      data += sc.nextLine();
    }
    sc.close();
    //    System.out.printf(data);

    // Compare with the expected string
View Full Code Here


    try
    {
      conn = url.openConnection();
      Scanner scanner = new Scanner(conn.getInputStream());
      while (scanner.hasNext())
        result += scanner.nextLine() + '\n';
    } catch (IOException ex)
    {
      Log.info(ex.getLocalizedMessage());
    }
    return result;
View Full Code Here

    List<Instance> instances = new ArrayList<Instance>();
   
    DataConverter converter = new DataConverter(dataset);
   
    while (scanner.hasNextLine()) {
      String line = scanner.nextLine();
      if (line.isEmpty()) {
        log.warn("{}: empty string", instances.size());
        continue;
      }
     
View Full Code Here

    while (scanner.hasNextLine()) {
      if (id % 1000 == 0) {
        log.info(String.format("progress : %d / %d", id, nbInstances));
      }
     
      String line = scanner.nextLine();
      if (line.isEmpty()) {
        continue; // skip empty lines
      }
     
      // write the tuple in files[tuple.label]
View Full Code Here

    // used to convert CATEGORICAL attribute to Integer
    List<String>[] values = new List[attrs.length];
   
    int id = 0;
    while (scanner.hasNextLine()) {
      String line = scanner.nextLine();
      if (line.isEmpty()) {
        continue;
      }
     
      if (parseString(id, attrs, values, line) != null) {
View Full Code Here

      LOGGER.severe("File " + this.showFile.getName() + " does not exist.");
      System.exit(1);
    }
    Show s1;
    while (showscanner.hasNext()) {
      String show = showscanner.nextLine();
      s1 = new Show(show.split(" :: ")[0]);
      try {
        s1.setCurSeason(Integer.parseInt(show.split(" :: ")[1]));
        s1.setLastEpisode(Integer.parseInt(show.split(" :: ")[2]));
      } catch (NumberFormatException e) {
View Full Code Here

      return;
    }
    Show show;
    int availCount = 0;
    while (showscanner.hasNext()) {
      String showLine = showscanner.nextLine();
      String myShowTitle = showLine.split(" :: ")[0];
      show = showLib.getShow(myShowTitle);
      if(show!=null) {
        availCount++;
        try {
View Full Code Here

    Scanner reader = new Scanner(input);
   
    List<Character> descriptors = new ArrayList<Character>();
   
    while (reader.hasNextLine()) {
      String c = reader.nextLine();
      descriptors.add(c.toUpperCase().charAt(0));
    }
   
    if (descriptors.isEmpty()) {
      throw new IllegalArgumentException("Infos file is empty");
View Full Code Here

    int labelIndex = -1;
   
    int index = 0;
   
    while (reader.hasNextLine()) {
      String line = reader.nextLine();
      StringTokenizer tokenizer = new StringTokenizer(line, ", ");
      String token = nextToken(tokenizer);
      if (IGNORED_TOKEN.equals(token)) {
        ignored.add(index);
      } else if (LABEL_TOKEN.equals(token)) {
View Full Code Here

  public static void main(String[] args) throws IOException {
    Scanner s = new Scanner(System.in);
    FileWriter f = new FileWriter("output/avgprofit.csv");
    int lastDeal = 0;
    while(s.hasNextLine()){
      String line = s.nextLine();
      //System.out.println("next line is "+line);
      if(line.contains("deal #")){
        int start = line.indexOf("deal #")+6;
        lastDeal = Integer.parseInt(line.substring(start, line.indexOf(" ", start)));
        System.out.println("Deal "+lastDeal);
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.