From f2c0645f60f9f849170985cd03593a586d601428 Mon Sep 17 00:00:00 2001 From: Minh VU Date: Fri, 20 Dec 2024 13:18:36 +0100 Subject: [PATCH] add comments --- src/fr/api/Configuration.java | 36 ++++++++++++++++++++++++++++-- src/fr/api/Configurator.java | 16 +++++++++++++ src/fr/api/PartType.java | 7 ++++++ src/fr/impl/ConfigurationImpl.java | 16 ------------- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/src/fr/api/Configuration.java b/src/fr/api/Configuration.java index c849b7f..da3b9b2 100644 --- a/src/fr/api/Configuration.java +++ b/src/fr/api/Configuration.java @@ -3,11 +3,43 @@ import java.util.Set; import java.util.Optional; public interface Configuration { - boolean isValid(); - boolean isComplete(); + /* + * @return true if there is no compatibility issue between PartType else false + */ + boolean isValid(); + + /* + * @return true if the configuration is valid and done + */ + boolean isComplete(); + + /* + * @return the list of the Part in the configuration + */ public Set getSelectedParts(); + + /* + * @return the Part that we chose earlier which has Category we choose + * it is optional + * @param catgeory : Category that we want to know about the PartType can be null + */ public Optional getSelectionForCategory(Category category); + + /* + * Select a PartType to add to the configuration + * @param chosenPart : the PartType that we wish to add to the configuration + */ void selectPart(PartType chosenPart); + + /* + * DeSelect PartType has Catgerory catgoryToClear to delete from the configuration + * @param categoryToClear : the PartType has categoryToClear Category + * that we wish to delete from the configuration + */ void unselectPartType(Category categoryToClear); + + /* + * Remove all PartType from configuation + */ void clear(); } \ No newline at end of file diff --git a/src/fr/api/Configurator.java b/src/fr/api/Configurator.java index cf53845..9ab61e1 100644 --- a/src/fr/api/Configurator.java +++ b/src/fr/api/Configurator.java @@ -1,8 +1,24 @@ package src.fr.api; import java.util.Set; public interface Configurator { + /* + * @return the list of the Category in the configurator + */ Set getCategories(); + + /* + * @return the list of the Category in the configurator + * @param category: category that we want to see all PartType in that category + */ Set getVariants(Category category); + + /* + * @return the configuration + */ Configuration getConfiguration(); + + /* + * @return compabilitychecker + */ CompatibilityChecker getCompatibilityChecker(); } \ No newline at end of file diff --git a/src/fr/api/PartType.java b/src/fr/api/PartType.java index b9fbe1f..e26ef12 100644 --- a/src/fr/api/PartType.java +++ b/src/fr/api/PartType.java @@ -1,5 +1,12 @@ package src.fr.api; public interface PartType { + /* + * @return name of this PartType + */ String getName(); + + /* + * @return the category of this PartType + */ Category getCategory(); } \ No newline at end of file diff --git a/src/fr/impl/ConfigurationImpl.java b/src/fr/impl/ConfigurationImpl.java index 24d3388..f18bbf8 100644 --- a/src/fr/impl/ConfigurationImpl.java +++ b/src/fr/impl/ConfigurationImpl.java @@ -62,22 +62,6 @@ public class ConfigurationImpl implements Configuration { } return test; } - /* - public int getTotalPrice(){ - int prix_final=0; - if(this.isValid()){ - for(Part pt: selectedParts){ - Optional 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 -1; - } - }*/ public int getTotalPrice(){ int prix_final=0;