/** * Constructor for creating a box config from a set of already chosen boxes. * * @param boxes The list of boxes to use when creating the box config. */ public BoxConfiguration(ArrayList<Box> boxes2) { this.boxes = new ArrayList<Box>(); for (Box box : boxes2) { this.boxes.add(box); if (minPersons < box.getWeight()) { /* Calculate min persons to solve */ minPersons = box.getWeight(); } } onlyConnections = true; }
/** * Constructor with a filename. * * @param filename Absolute or relative path of the file to be read. */ public BoxConfiguration(String filename) { boxes = new ArrayList<Box>(); onlyConnections = false; this.createFromFile(filename); for (Box box : boxes) { /* Calculate min persons to solve */ if (minPersons < box.getWeight()) { minPersons = box.getWeight(); } } }