Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void loadState()
- {
- try
- {
- BufferedReader br = new BufferedReader(new FileReader("Logindata.txt"));
- String tempStr = br.readLine();
- String[] totalStr = tempStr.split("#");
- for (int i = 0; i < totalStr.length; i++)
- {
- Person tempPer = new Person(totalStr[i]);
- if (tempPer.getStatus() == 0)
- {
- Librarian tempLib = new Librarian(totalStr[i]);
- users.add(tempLib);
- }
- else if (tempPer.getStatus() == 1)
- {
- User tempUs = new User(totalStr[i]);
- users.add(tempUs);
- }
- }
- br.close();
- BufferedReader br2 = new BufferedReader(new FileReader("Bookdata.txt"));
- String tempStr2;
- while ((tempStr2 = br2.readLine()) != null)
- {
- Book tempBook = new Book(tempStr2);
- books.add(tempBook);
- }
- br2.close();
- }
- catch(Exception e)
- {
- System.out.println(e);
- }
- }
- /*_________________________________________
- I EN GALAKSE LANGT LANGT VÆK, AKA I EN ANDEN KLASSE */
- public Person(String fromString)
- {
- String[] strAr = fromString.split("'");
- this.id = Integer.parseInt(strAr[0]);
- this.userName = strAr[1];
- this.password = strAr[2];
- this.status = 3;
- }
- // Og så den i user
- public User(String fromString)
- {
- super(fromString);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement