Hope it works manager
like title
This commit is contained in:
@@ -9,16 +9,24 @@ import java.util.Set;
|
|||||||
public class Configuration implements fr.istic.nplouzeau.cartaylor.api.Configuration {
|
public class Configuration implements fr.istic.nplouzeau.cartaylor.api.Configuration {
|
||||||
private Set<PartType> selectedParts;
|
private Set<PartType> selectedParts;
|
||||||
private CompatibilityManager compatibilityManager;
|
private CompatibilityManager compatibilityManager;
|
||||||
|
private static int NB_CATEGORY = 4;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
if ( this.isComplete()){
|
if (this.isComplete()){
|
||||||
|
for(PartType pt: selectedParts){
|
||||||
return true;
|
//Verifier Requirements
|
||||||
|
for(PartType require : compatibilityManager.getRequirements(pt)){
|
||||||
|
if(!selectedParts.contains(pt)) return false;
|
||||||
|
}
|
||||||
|
//Verifier Incompabilities
|
||||||
|
for(PartType incompa : compatibilityManager.getIncompatibilities(pt)){
|
||||||
|
if(selectedParts.contains(pt)) return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
return true;
|
||||||
|
}else{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +34,7 @@ public class Configuration implements fr.istic.nplouzeau.cartaylor.api.Configura
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isComplete() {
|
public boolean isComplete() {
|
||||||
if(selectedParts.size()==4){
|
if(selectedParts.size()==NB_CATEGORY){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user