Advertisement
Guest User

Untitled

a guest
May 30th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.49 KB | None | 0 0
  1. import de.htw.saarland.stl.Stdin;
  2. import java.util.Arrays;
  3. import java.io.*;
  4. import java.util.*;
  5. import java.lang.*;
  6. import java.lang.StringBuilder;
  7.  
  8. public class Queuetest
  9. {
  10.     String[] parts;
  11.     private Auftragsverwaltung test1;
  12.     int maxSize = 100;
  13.     static String filepath;
  14.  
  15.     public void start()
  16.     {  
  17.         int auftragsnr;
  18.         String auftraggeber;
  19.         test1 = new Auftragsverwaltung(maxSize);
  20.  
  21.         while(filepath == null){
  22.             einlesen();
  23.         }
  24.  
  25.         String fileName = filepath;
  26.         FileReader fr = null;
  27.         LineNumberReader lnr = null;
  28.         String str;
  29.         int i;
  30.  
  31.         try{
  32.             // create new reader
  33.             fr = new FileReader(filepath);
  34.             lnr = new LineNumberReader(fr);
  35.  
  36.             // read lines till the end of the stream
  37.             while((str=lnr.readLine())!=null)
  38.             {  
  39.                 if (str.charAt(0) =='+'){
  40.                     str = str.replace("+", "");
  41.                     String[] parts = str.split("\t");
  42.                     // int intZahl = Integer.parseInt(stringZahl);
  43.                     auftragsnr = Integer.parseInt(parts[0]);
  44.                     auftraggeber = parts[1];
  45.                     System.out.println(parts[0]);
  46.                     System.out.println(parts[1]);
  47.                     test1.neuerAuftrag(auftragsnr, auftraggeber);
  48.                     System.out.println(test1);
  49.                 }
  50.                 else{
  51.                     System.out.println("Hallo");
  52.                     }
  53.                 //i=lnr.getLineNumber();
  54.                 //System.out.print("("+i+")");
  55.  
  56.                 // prints string
  57.                 //System.out.println(str);
  58.                 //l.addLast("("+i+")"+"" + str );
  59.             }
  60.         }
  61.         catch(Exception e){
  62.  
  63.             // if any error occurs
  64.             e.printStackTrace();
  65.         }
  66.        
  67.  
  68.         finally{
  69.             try{
  70.  
  71.             // closes the stream and releases system resources
  72.             if(fr!=null)
  73.                 fr.close();
  74.             if(lnr!=null)
  75.                 lnr.close();
  76.         }
  77.         catch (Exception e) {
  78.             e.printStackTrace();
  79.             }
  80.         }
  81.    
  82.  
  83.            
  84.             }
  85.  
  86.     public static String einlesen()
  87.     {
  88.         filepath = Stdin.readlnString("Geben sie den Filenamen und Pfad an");
  89.         return filepath;
  90.  
  91.     }
  92.  
  93.     public static void main(String[] args) {
  94.         new Queuetest().start();
  95.  
  96.     }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement