Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Person(Element user)throws Exception {
- Attribute userID = user.getAttribute("UserID");
- this.userID =
- Integer.parseInt(userID.getValue());
- UserBerechnungen.setUserID(this.userID);
- List<Element> userAttributes = user.getChildren();
- String username = userAttributes.get(0).getText();
- this.name = username;
- // Waehrung waehrung, double geldwert
- Geld geld = new Geld(
- new Waehrung("" + userAttributes.get(1).getAttribute("Währung")),
- Double.parseDouble(userAttributes.get(1).getText())
- );
- this.geld = geld;
- double drivingskill
- = Double.parseDouble(userAttributes.get(2).getText());
- this.drivingskill = drivingskill;
- Attribute stellpl = userAttributes.get(3).getAttribute("Stellplätze");
- int garageSize =
- Integer.parseInt(stellpl.getValue());
- Auto[] garage = new Auto[garageSize];
- System.out.println("103");
- List<Element> carList = userAttributes.get(3).getChildren();
- for (int i = 0; i < garageSize; i++) {
- System.out.println("==AUTO:"+i+"==");
- //String marke, String model,
- //String fahrzeugart, Motor motor,
- //int gewicht,Geld preis
- List<Element> autoListe = carList.get(i).getChildren();
- String marke = autoListe.get(0).getText();
- System.out.println("MARKE = "+marke);
- String model = autoListe.get(1).getText();
- System.out.println("MODEL = "+model);
- String bauart = carList.get(0).getAttribute("Bauart").getValue();
- System.out.println("BAUART = "+bauart);
- String motorbez = autoListe.get(2).getValue();
- System.out.println("MOTORBEZ = "+motorbez);
- int ps = Integer.parseInt(autoListe.get(2).getAttribute("Motorleistung").getValue());
- System.out.println("PS = "+ps);
- int gewicht = Integer.parseInt("" + autoListe.get(3).getText());
- System.out.println("GEWICHT = "+gewicht);
- garage[i]
- = new Auto(
- marke,
- model,
- bauart,
- //String bezeichnung,int motorleistung
- new Motor(motorbez,ps),
- gewicht
- );
- }
- String password = user.getChild("Password").getText();
- System.out.println("PW = "+password);
- this.password = password;
- this.garage = garage;
- this.tuningInventar = new Motor[4];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement