/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package inport; import java.util.Map; /** * * @author topazh_ag */ public class Storage { private int id; private String name; private double volume; private Cargo cargo; /** * Get the value of cargo * * @return the value of cargo */ public Cargo getCargo() { return cargo; } /** * Set the value of cargo * * @param cargo new value of cargo */ public void setCargo(Cargo cargo) { this.cargo = cargo; } /** * Get the value of volume * * @return the value of volume */ public double getVolume() { return volume; } /** * Set the value of volume * * @param volume new value of volume */ public void setVolume(double volume) { this.volume = volume; } /** * Get the value of name * * @return the value of name */ public String getName() { return name; } /** * Set the value of name * * @param name new value of name */ public void setName(String name) { this.name = name; } /** * Get the value of id * * @return the value of id */ public int getId() { return id; } /** * Set the value of id * * @param id new value of id */ public void setId(int id) { this.id = id; } public Storage(int id, String name, double volume, Cargo cargo) { this.id = id; this.name = name; this.volume = volume; this.cargo = cargo; } public Storage() { } @Override public String toString() { return id + ";" + name + ";" + cargo.getId() + ";" +volume; } public Storage(String s, Map cargoes) { String[] tokens = s.split(";"); id = Integer.parseInt(tokens[0].trim()); name = tokens[1].trim(); volume = Double.parseDouble(tokens[3].trim()); int key = Integer.parseInt(tokens[2].trim()); cargo = cargoes.get(key); } }