getprixtotal pour config
This commit is contained in:
@@ -201,6 +201,4 @@ public class CompatibilityManagerImpl implements CompatibilityManager {
|
||||
Femeture_Transivite(reference, result,new HashSet<>(),reference);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -17,39 +17,50 @@ public class ConfigurationImpl implements Configuration {
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
if (this.isComplete()){
|
||||
for(Part pt: selectedParts){
|
||||
//Verifier Requirements
|
||||
for(PartType require : compatibilityManager.getRequirements(pt.getType())){
|
||||
//if(!selectedParts.contains(require)) return false;
|
||||
//IN V2, instead of verify if it's in selectedParts,
|
||||
//we will compare its type and selectedParts
|
||||
//boolean no_error = true;
|
||||
for(Part pt: selectedParts){
|
||||
//Verifier Requirements
|
||||
for(PartType require : compatibilityManager.getRequirements(pt.getType())){
|
||||
//if(!selectedParts.contains(require)) return false;
|
||||
//IN V2, instead of verify if it's in selectedParts,
|
||||
//we will compare its type and selectedParts
|
||||
//boolean no_error = true;
|
||||
|
||||
for(Part selectPart : selectedParts){
|
||||
if (selectPart.getType().equals(require)){
|
||||
return false;
|
||||
//no_error= true;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Verifier Incompabilities
|
||||
for(PartType incompa : compatibilityManager.getIncompatibilities(pt.getType())){
|
||||
for (Part selectPart : selectedParts){
|
||||
if(selectPart.getType().equals(incompa)){
|
||||
return false;
|
||||
}
|
||||
for(Part selectPart : selectedParts){
|
||||
if (selectPart.getType().equals(require)){
|
||||
return false;
|
||||
//no_error= true;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
//Verifier Incompabilities
|
||||
for(PartType incompa : compatibilityManager.getIncompatibilities(pt.getType())){
|
||||
for (Part selectPart : selectedParts){
|
||||
if(selectPart.getType().equals(incompa)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getPriceTotal(){
|
||||
int prix_final=0;
|
||||
if(this.isValid()){
|
||||
for(Part pt: selectedParts){
|
||||
Optional<String> price_opt =pt.getProperty("prix");
|
||||
if(price_opt.isPresent()){
|
||||
int prix_piece= Integer.parseInt(price_opt.get());
|
||||
prix_final += prix_piece;
|
||||
}
|
||||
}
|
||||
return prix_final;
|
||||
}else{
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isComplete() {
|
||||
if(selectedParts.size()==NB_CATEGORY){
|
||||
|
||||
Reference in New Issue
Block a user