private void convertReqsInCriterions() { // convert the general requirements ArrayList<Criterion> criteria = this.data.getCriteria(); for (Requirement req : this.data.getRequirements()) { if (req.isCriterion()) { // create new criterion Criterion crit = new Criterion(); if (req.getQuantType() != null) crit.setName(req.getQuantType().getValue()); else if (req.getQualType() != null) crit.setName(req.getQualType().getValue()); else // this is a price requirement crit.setName("price"); String[] msg = {crit.getName(), "General"}; if (this.methodID == CloudAid.SAW) { Float weight = Float.parseFloat(CloudAid.askData(CloudAid.GET_WEIGHT, msg, null)); crit.setWeight(weight); } // get the criterion preference direction String res = CloudAid.askData(CloudAid.GET_PREFERENCE_DIRECTION, msg, null); if (res.equalsIgnoreCase("y")) { crit.setPreferenceDirection("max"); } else if (res.equalsIgnoreCase("n")) { crit.setPreferenceDirection("min"); } criteria.add(crit); } } this.data.setCriteria(criteria); // convert each serpiceTemplate requirements for (ServiceTemplate template : this.data.getServiceTemplates()) { ArrayList<Criterion> templateCriteria = template.getCriteria(); for (Requirement req : template.getRequirements()) { if (req.isCriterion()) { // create new criterion Criterion crit = new Criterion(); if (req.getQuantType() != null) crit.setName(req.getQuantType().getValue()); else if (req.getQualType() != null) crit.setName(req.getQualType().getValue()); else // this is a price requirement crit.setName("price"); String[] msg = {crit.getName(), template.getType()}; if (this.methodID == CloudAid.SAW) { Float weight = Float.parseFloat(CloudAid.askData(CloudAid.GET_WEIGHT, msg, null)); crit.setWeight(weight); } // get the criterion preference direction String res = CloudAid.askData(CloudAid.GET_PREFERENCE_DIRECTION, msg, null); if (res.equalsIgnoreCase("y")) { crit.setPreferenceDirection("max"); } else if (res.equalsIgnoreCase("n")) { crit.setPreferenceDirection("min"); } templateCriteria.add(crit); } } template.setCriteria(templateCriteria); } }