Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
04fdcc5d22 | ||
|
|
1569746582 | ||
|
|
01970a625a | ||
|
|
5260d58c96 | ||
|
|
4198d7a407 | ||
|
|
beeef622b3 | ||
|
|
44fe20e95c | ||
|
|
4880ae8b3f | ||
|
|
6a495edaa0 | ||
|
|
1cb536a785 | ||
|
|
45d796afc6 | ||
|
|
b8d9eb5771 | ||
|
|
141cfdf4ff | ||
|
|
23ea8746b1 | ||
|
|
1168b5377f | ||
|
|
1a09eda6e7 | ||
|
|
ba3596319c | ||
|
|
51a24aa140 | ||
|
|
0b511522bc | ||
|
|
8457ab48fa | ||
|
|
df189bf44c | ||
|
|
9bf322af6a | ||
|
|
8770ec3165 | ||
|
|
82c9f268f8 | ||
|
|
467b20f0b6 | ||
|
|
7bf5b5eb9f | ||
|
|
40e4c6532c | ||
|
|
06fe1715a9 | ||
|
|
7685f600ea | ||
|
|
3af42dabdd | ||
|
|
2fb99e1b62 | ||
|
|
8ea96996d4 | ||
|
|
1b80e60980 | ||
|
|
f97509496e | ||
|
|
51fd5e6e07 | ||
|
|
e9d6072d25 | ||
|
|
1f4c0bdf63 | ||
|
|
6c0b2e1ede | ||
|
|
4ef176d3c5 | ||
|
|
ce92682230 | ||
|
|
e96d87a815 | ||
|
|
1313390d0d | ||
|
|
51ad055258 | ||
|
|
ed03836ef4 | ||
|
|
53edc969c5 | ||
|
|
4268f53f8d | ||
|
|
26928a231d | ||
|
|
fdf82e5ce1 | ||
|
|
d6f25d05ee | ||
|
|
1945c62d03 | ||
|
|
3049848931 | ||
|
|
01ff7abe04 |
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/cartailor.iml" filepath="$PROJECT_DIR$/cartailor.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
114
.idea/workspace.xml
generated
Normal file
114
.idea/workspace.xml
generated
Normal file
@@ -0,0 +1,114 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="12bd6c53-8ba7-454c-a61e-7a76cc3b801b" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/cartailor.iml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/fr/impl/CategoryImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/fr/impl/CategoryImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/fr/impl/CompatibilityManagerImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/fr/impl/CompatibilityManagerImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/fr/impl/ConfigurationImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/fr/impl/ConfigurationImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/fr/impl/ConfiguratorImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/fr/impl/ConfiguratorImpl.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/fr/impl/PartTypeImpl.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/fr/impl/PartTypeImpl.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Interface" />
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||
</component>
|
||||
<component name="ProblemsViewState">
|
||||
<option name="selectedTabId" value="ProjectErrors" />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 1
|
||||
}</component>
|
||||
<component name="ProjectId" id="2nEoqUUHcIor4OnYQ3cqGODPYlO" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||
"git-widget-placeholder": "dev__v1",
|
||||
"ignore.virus.scanning.warn.message": "true",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"last_opened_file_path": "C:/Users/vumin/Desktop/M1/ALO/cartailor",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "Project",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}]]></component>
|
||||
<component name="RecentsManager">
|
||||
<key name="MoveFile.RECENT_KEYS">
|
||||
<recent name="C:\Users\vumin\Desktop\M1\ALO\cartailor\Catalog" />
|
||||
<recent name="C:\Users\vumin\Desktop\M1\ALO\cartailor" />
|
||||
</key>
|
||||
</component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="JetRunConfigurationType">
|
||||
<module name="cartailor" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
|
||||
<module name="cartailor" />
|
||||
<option name="filePath" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9823dce3aa75-28b599e66164-intellij.indexing.shared.core-IU-242.23339.11" />
|
||||
<option value="bundled-js-predefined-d6986cc7102b-5c90d61e3bab-JavaScript-IU-242.23339.11" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="12bd6c53-8ba7-454c-a61e-7a76cc3b801b" name="Changes" comment="" />
|
||||
<created>1728547786554</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1728547786554</updated>
|
||||
<workItem from="1729254205656" duration="1151000" />
|
||||
<workItem from="1729507889060" duration="386000" />
|
||||
<workItem from="1729595321874" duration="25000" />
|
||||
<workItem from="1729743145740" duration="122000" />
|
||||
<workItem from="1729757559608" duration="166000" />
|
||||
<workItem from="1729764402753" duration="206000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
5
.vscode/settings.json
vendored
Normal file
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.watcherExclude": {
|
||||
"**/target": true
|
||||
}
|
||||
}
|
||||
@@ -1 +1,8 @@
|
||||
V1 et V2 respectivement dans les branches dev_V1 et dev_v2
|
||||
V1:
|
||||
|
||||
Nous testons d'abord le CompatibilityManager. On fait un BeforeEach pour initialiser un CompatibilityManager (celui vu en TD)
|
||||
On teste si les Incompatibilities et Requirements sont bien récupérables à partir du CompatibilityManager avec les fonctions getIncompatibilities et getRequirements. GetIncompatibilities et getRequirements doivent donner toutes les Part incompatibles ou Require, même si elles n'ont pas été données directement à la Part testée. On doit donc aussi vérifier la contradiction : A a besoin de B mais B est incompatible avec A, alors A est incompatible avec lui-même.
|
||||
On teste aussi la configuration, en vérifiant si une configuration est complète et si elle est validée (dans notre implémentation V1, une configuration validée est forcément complète, mais pas forcément l'inverse).
|
||||
|
||||
|
||||
nous ne savons pas pourquoi mais dans notre projet les tests avec couverture ne fonctionnent pas, les tets sont bien testé, mais il tourne dans le vide et ne donne jamais le résultat de la couverture...
|
||||
BIN
dragon.gif
BIN
dragon.gif
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 MiB |
BIN
lib/hamcrest-core-1.3.jar
Normal file
BIN
lib/hamcrest-core-1.3.jar
Normal file
Binary file not shown.
BIN
lib/junit-platform-console-standalone-1.11.4.jar
Normal file
BIN
lib/junit-platform-console-standalone-1.11.4.jar
Normal file
Binary file not shown.
14
src/fr/api/Category.java
Normal file
14
src/fr/api/Category.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package src.fr.api;
|
||||
/**
|
||||
* @author plouzeau
|
||||
* <p>
|
||||
* A public type to organize part types in categories
|
||||
*/
|
||||
public interface Category {
|
||||
|
||||
/*
|
||||
* return the name of the cathegory
|
||||
* @return String, name of the cathegory, non null
|
||||
*/
|
||||
String getName();
|
||||
}
|
||||
18
src/fr/api/CompatibilityChecker.java
Normal file
18
src/fr/api/CompatibilityChecker.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package src.fr.api;
|
||||
import java.util.Set;
|
||||
public interface CompatibilityChecker {
|
||||
|
||||
/*
|
||||
* return the list of the incompatibles PartType of a PartType
|
||||
* @param reference : the PartType that we want to see the incompatibilities,non null
|
||||
* @return the Set list of the incompatibles PartType
|
||||
*/
|
||||
Set<PartType> getIncompatibilities(PartType reference);
|
||||
|
||||
/*
|
||||
* return the list of the requirements PartType of a PartType
|
||||
* @param reference : the PartType that we want to see the requirements,non null
|
||||
* @return the Set list of the requirements PartType
|
||||
*/
|
||||
Set<PartType> getRequirements(PartType reference);
|
||||
}
|
||||
34
src/fr/api/CompatibilityManager.java
Normal file
34
src/fr/api/CompatibilityManager.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package src.fr.api;
|
||||
import java.util.Set;
|
||||
public interface CompatibilityManager extends CompatibilityChecker {
|
||||
|
||||
/*
|
||||
* add a incompatibles PartType to a PartType
|
||||
* @param reference : the PartType that we wish to add incompatibilities
|
||||
* @param target : Set list of incompatibilities PartType to add
|
||||
*/
|
||||
void addIncompatibilities(PartType reference,Set<PartType> target);
|
||||
|
||||
/*
|
||||
* remove a PartType of the incompatibilities of a PartType, warning,
|
||||
* warning : we must also remove the incompatibility from all the other PartTypes which the @param reference in their incompatibility
|
||||
* @param reference : the PartType that we wish to remove a incompatible PartType
|
||||
* @param target : PartType to remove of incompatibility
|
||||
*/
|
||||
void removeIncompatibility(PartType reference, PartType target);
|
||||
|
||||
|
||||
/*
|
||||
* add requirements PartType to a PartType
|
||||
* @param reference : the PartType that we wish to add requirements
|
||||
* @param target : Set list of requirement PartType to add
|
||||
*/
|
||||
void addRequirements(PartType reference, Set<PartType> target);
|
||||
|
||||
/*
|
||||
* remove a PartType of the incompatibilities of a PartType
|
||||
* @param reference : the PartType that we wish to remove a requirement PartType
|
||||
* @param target : PartType to remove of requirement
|
||||
*/
|
||||
void removeRequirement(PartType reference, PartType target);
|
||||
}
|
||||
44
src/fr/api/Configuration.java
Normal file
44
src/fr/api/Configuration.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package src.fr.api;
|
||||
import java.util.Set;
|
||||
public interface Configuration {
|
||||
|
||||
|
||||
/*
|
||||
* @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 PartType in the configuration
|
||||
*/
|
||||
Set<PartType> getSelectedParts();
|
||||
|
||||
/*
|
||||
* Select a PartType to add to the configuration
|
||||
* @param chosenPart : the PartType that we wish to add to the configuration
|
||||
*/
|
||||
void selectPart(PartType chosenPart);
|
||||
|
||||
/*
|
||||
* @return the PartType that we chose earlier which has Category we choose
|
||||
* @param catgeory : Category that we want to know about the PartType can be null
|
||||
*/
|
||||
PartType getSelectionForCategory(Category category);
|
||||
|
||||
/*
|
||||
* 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();
|
||||
}
|
||||
24
src/fr/api/Configurator.java
Normal file
24
src/fr/api/Configurator.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package src.fr.api;
|
||||
import java.util.Set;
|
||||
public interface Configurator {
|
||||
/*
|
||||
* @return the list of the Category in the configurator
|
||||
*/
|
||||
Set<Category> getCategories();
|
||||
|
||||
/*
|
||||
* @return the list of the Category in the configurator
|
||||
* @param category: category that we want to see all PartType in that category
|
||||
*/
|
||||
Set<PartType> getVariants(Category category);
|
||||
|
||||
/*
|
||||
* @return the configuration
|
||||
*/
|
||||
Configuration getConfiguration();
|
||||
|
||||
/*
|
||||
* @return compabilitychecker
|
||||
*/
|
||||
CompatibilityChecker getCompatibilityChecker();
|
||||
}
|
||||
12
src/fr/api/PartType.java
Normal file
12
src/fr/api/PartType.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package src.fr.api;
|
||||
public interface PartType {
|
||||
/*
|
||||
* @return name of this PartType
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/*
|
||||
* @return the category of this PartType
|
||||
*/
|
||||
Category getCategory();
|
||||
}
|
||||
14
src/fr/impl/CategoryImpl.java
Normal file
14
src/fr/impl/CategoryImpl.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package src.fr.impl;
|
||||
import src.fr.api.Category;
|
||||
|
||||
public class CategoryImpl implements Category {
|
||||
private String name;
|
||||
|
||||
public CategoryImpl(String name){
|
||||
this.name= name;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
25
src/fr/impl/CompatibilityCheckerImpl.java
Normal file
25
src/fr/impl/CompatibilityCheckerImpl.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package src.fr.impl;
|
||||
|
||||
import java.util.Set;
|
||||
import src.fr.api.PartType;
|
||||
import src.fr.api.CompatibilityManager;
|
||||
import src.fr.api.CompatibilityChecker;
|
||||
|
||||
|
||||
public class CompatibilityCheckerImpl implements CompatibilityChecker {
|
||||
private CompatibilityManager compatibilityManager;
|
||||
|
||||
public CompatibilityCheckerImpl( CompatibilityManager compatibilityManager){
|
||||
this.compatibilityManager=compatibilityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PartType> getIncompatibilities(PartType reference) {
|
||||
return this.compatibilityManager.getIncompatibilities(reference);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PartType> getRequirements(PartType reference) {
|
||||
return this.compatibilityManager.getRequirements(reference);
|
||||
}
|
||||
}
|
||||
206
src/fr/impl/CompatibilityManagerImpl.java
Normal file
206
src/fr/impl/CompatibilityManagerImpl.java
Normal file
@@ -0,0 +1,206 @@
|
||||
package src.fr.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.Objects;
|
||||
import src.fr.api.PartType;
|
||||
import src.fr.api.CompatibilityManager;
|
||||
|
||||
public class CompatibilityManagerImpl implements CompatibilityManager {
|
||||
|
||||
private HashMap<PartType, Set<PartType>> incompatibilities;
|
||||
private HashMap<PartType, Set<PartType>> requirements;
|
||||
|
||||
public CompatibilityManagerImpl() {
|
||||
this.incompatibilities = new HashMap<>();
|
||||
this.requirements = new HashMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIncompatibilities(PartType reference, Set<PartType> target){
|
||||
//Précondition
|
||||
Objects.requireNonNull(reference);
|
||||
Objects.requireNonNull(target);
|
||||
|
||||
|
||||
Set<PartType> incompa = this.getIncompatibilities(reference);
|
||||
Set<PartType> require = this.getRequirements(reference);
|
||||
|
||||
if(incompa.isEmpty()){
|
||||
incompatibilities.put(reference, target);
|
||||
|
||||
}else {
|
||||
for(PartType x: target){
|
||||
if (incompa.contains(x)){
|
||||
System.out.println("We have it already");
|
||||
}else {
|
||||
if(require.contains(x)){
|
||||
System.out.println("Cannot remove");
|
||||
}else{
|
||||
//Ajout ref à x
|
||||
incompa.add(x);
|
||||
System.out.println("Add "+reference.getName() +" incompatible with "+x.getName());
|
||||
|
||||
this.incompatibilities.put(reference, incompa);
|
||||
// Symétrie
|
||||
//Ajoute x à ref
|
||||
//this.getIncompatibilities(x).add(reference);
|
||||
//System.out.println("Add "+x.getName() +" incompatible with "+reference.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeIncompatibility(PartType reference, PartType target){
|
||||
//Précondition
|
||||
Objects.requireNonNull(reference);
|
||||
Objects.requireNonNull(target);
|
||||
|
||||
Set<PartType> incompa = this.getIncompatibilities(reference);
|
||||
if(incompa.isEmpty()){
|
||||
System.out.println("No part incompatible");
|
||||
}else{
|
||||
if(incompa.contains(target)){
|
||||
incompa.remove(target);
|
||||
this.incompatibilities.replace(reference, incompa);
|
||||
// SyMéTrIe
|
||||
//Remove target -> ref
|
||||
//this.getIncompatibilities(target).remove(reference);
|
||||
}else {
|
||||
System.out.println("This part doesn't exist in incompatibilities list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRequirements(PartType reference, Set<PartType> target){
|
||||
//Précondition
|
||||
Objects.requireNonNull(reference);
|
||||
Objects.requireNonNull(target);
|
||||
|
||||
Set<PartType> incompa = this.getIncompatibilities(reference);
|
||||
Set<PartType> require = this.getRequirements(reference);
|
||||
if(require.isEmpty()){
|
||||
requirements.put(reference, target);
|
||||
}else {
|
||||
for(PartType x: target){
|
||||
if (require.contains(x)){
|
||||
System.out.println("We have it already");
|
||||
}else {
|
||||
if(incompa.contains(x)){
|
||||
System.out.println("Cannot remove");
|
||||
}else{
|
||||
//Ajout ref à x
|
||||
require.add(x);
|
||||
System.out.println("Add "+reference.getName() +" compatible with "+x.getName());
|
||||
|
||||
this.requirements.put(reference, require);
|
||||
//Symétrie
|
||||
//Ajoute x à ref
|
||||
//this.getRequirements(x).add(reference);
|
||||
//System.out.println("Add "+x.getName() +" compatible with "+reference.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRequirement(PartType reference, PartType target){
|
||||
//Précondition
|
||||
Objects.requireNonNull(reference);
|
||||
Objects.requireNonNull(target);
|
||||
|
||||
Set<PartType> require = this.getRequirements(reference);
|
||||
if(require.isEmpty()){
|
||||
System.out.println("No part compatible");
|
||||
}else{
|
||||
if(require.contains(target)){
|
||||
require.remove(target);
|
||||
this.requirements.replace(reference, require);
|
||||
// SyMéTrIe
|
||||
//Remove target -> ref
|
||||
//this.getRequirements(target).remove(reference);
|
||||
}else {
|
||||
System.out.println("This part doesn't exist in compatibilities list");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A -> B -> C -> A, D -> B
|
||||
//erquirement only
|
||||
private void Femeture_Transivite(PartType reference, Set<PartType> result, Set<PartType> visited, PartType start){
|
||||
//Condition de quitter la boucle
|
||||
if(visited.contains(reference)){
|
||||
return;
|
||||
}else {
|
||||
visited.add(reference);
|
||||
}
|
||||
|
||||
Set<PartType> list = null;
|
||||
//Get all requirement of A (in example is B)
|
||||
list = this.requirements.get(reference);
|
||||
|
||||
if(list != null){ // list = {B}
|
||||
for(PartType pt: list){
|
||||
if(!result.contains(pt)&& pt !=start){
|
||||
result.add(pt);
|
||||
}
|
||||
Femeture_Transivite(pt,result,visited,reference);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PartType> getIncompatibilities(PartType reference) {
|
||||
Set<PartType> result = new HashSet<>();
|
||||
|
||||
// Remove the case of result become null
|
||||
Set<PartType> directIncompa = this.incompatibilities.get(reference);
|
||||
if(directIncompa!=null){
|
||||
result.addAll(directIncompa);
|
||||
}
|
||||
|
||||
// Collect the requirements list
|
||||
Set<PartType> requirements = new HashSet<>();
|
||||
Femeture_Transivite(reference, requirements,new HashSet<>(),reference);
|
||||
|
||||
for(Map.Entry<PartType, Set<PartType>> entry : this.incompatibilities.entrySet()){
|
||||
// check start
|
||||
if(entry.getValue().contains(reference)){
|
||||
result.add(entry.getKey());
|
||||
}
|
||||
|
||||
// check incompatible of A's requirements
|
||||
for(PartType pt: requirements){
|
||||
// In Catalog of pt
|
||||
if(entry.getValue().contains(pt)){
|
||||
result.add(entry.getKey());
|
||||
}
|
||||
// Direct of pt
|
||||
Set<PartType> direct_pt = this.incompatibilities.get(pt);
|
||||
if(direct_pt!=null){
|
||||
result.addAll(direct_pt);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("size = " + result.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<PartType> getRequirements(PartType reference) {
|
||||
Set<PartType> result = new HashSet<>();
|
||||
Femeture_Transivite(reference, result,new HashSet<>(),reference);
|
||||
System.out.println("size = " + result.size());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
97
src/fr/impl/ConfigurationImpl.java
Normal file
97
src/fr/impl/ConfigurationImpl.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package src.fr.impl;
|
||||
|
||||
import src.fr.api.Category;
|
||||
import src.fr.api.PartType;
|
||||
import src.fr.api.CompatibilityManager;
|
||||
import src.fr.api.Configuration;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ConfigurationImpl implements Configuration {
|
||||
private Set<PartType> selectedParts = new HashSet<PartType> ();
|
||||
private CompatibilityManager compatibilityManager;
|
||||
private static int NB_CATEGORY = 4;
|
||||
|
||||
public ConfigurationImpl(CompatibilityManager cm){
|
||||
this.compatibilityManager=cm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
if (this.isComplete()){
|
||||
for(PartType pt: selectedParts){
|
||||
System.out.println(pt.getName());
|
||||
|
||||
//Verifier Requirements
|
||||
for(PartType require : compatibilityManager.getRequirements(pt)){
|
||||
System.out.println("\t"+require.getName());
|
||||
if(!selectedParts.contains(require)) return false;
|
||||
}
|
||||
//Verifier Incompabilities
|
||||
for(PartType incompa : compatibilityManager.getIncompatibilities(pt)){
|
||||
System.out.println("\t"+incompa.getName());
|
||||
if(selectedParts.contains(incompa)) return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isComplete() {
|
||||
if(selectedParts.size()==NB_CATEGORY){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PartType> getSelectedParts() {
|
||||
return selectedParts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selectPart(PartType chosenPart) {
|
||||
Category cat_chosenPart = chosenPart.getCategory();
|
||||
|
||||
//Vérifier s'il y a des pièces dans la même catégorie, si oui return
|
||||
for( PartType pt: selectedParts){
|
||||
if(pt.getCategory().equals(cat_chosenPart)){
|
||||
System.out.println("Il y a une pièce dans la même catégorie dans la configuration");
|
||||
selectedParts.remove(pt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
selectedParts.add(chosenPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartType getSelectionForCategory(Category category) {
|
||||
for( PartType pt: selectedParts){
|
||||
if(pt.getCategory().equals(category)){
|
||||
return pt;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unselectPartType(Category categoryToClear) {
|
||||
for( PartType pt: selectedParts){
|
||||
if(pt.getCategory().equals(categoryToClear)){
|
||||
selectedParts.remove(pt);
|
||||
}
|
||||
}
|
||||
System.out.println("Il n'y a pas des pièces dans cette catégorie");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.selectedParts.clear();;
|
||||
}
|
||||
}
|
||||
49
src/fr/impl/ConfiguratorImpl.java
Normal file
49
src/fr/impl/ConfiguratorImpl.java
Normal file
@@ -0,0 +1,49 @@
|
||||
package src.fr.impl;
|
||||
|
||||
import src.fr.api.Category;
|
||||
import src.fr.api.CompatibilityChecker;
|
||||
import src.fr.api.Configuration;
|
||||
import src.fr.api.PartType;
|
||||
import src.fr.api.Configurator;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ConfiguratorImpl implements Configurator {
|
||||
private Set<Category> categories;
|
||||
private Set<PartType> partTypes;
|
||||
private Configuration configuration;
|
||||
private CompatibilityChecker compatibilityChecker;
|
||||
|
||||
public ConfiguratorImpl (Set<Category> cat, Set<PartType> pt, Configuration config) {
|
||||
this.categories= cat;
|
||||
this.partTypes=pt;
|
||||
this.configuration=config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Category> getCategories() {
|
||||
return this.categories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PartType> getVariants(Category category) {
|
||||
Set<PartType>a = new HashSet<PartType>();
|
||||
for(PartType x : partTypes){
|
||||
if (x.getCategory()==category){
|
||||
a.add(x);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Configuration getConfiguration() {
|
||||
return this.configuration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompatibilityChecker getCompatibilityChecker() {
|
||||
return this.compatibilityChecker;
|
||||
}
|
||||
}
|
||||
22
src/fr/impl/PartTypeImpl.java
Normal file
22
src/fr/impl/PartTypeImpl.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package src.fr.impl;
|
||||
|
||||
import src.fr.api.Category;
|
||||
import src.fr.api.PartType;
|
||||
|
||||
public class PartTypeImpl implements PartType {
|
||||
private String name;
|
||||
private Category category;
|
||||
|
||||
public PartTypeImpl(String name, Category category ) {
|
||||
this.name = name;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public String getName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Category getCategory(){
|
||||
return this.category;
|
||||
}
|
||||
}
|
||||
335
src/fr/test/test.java
Normal file
335
src/fr/test/test.java
Normal file
@@ -0,0 +1,335 @@
|
||||
package src.fr.test;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
|
||||
import src.fr.impl.*;
|
||||
import src.fr.api.*;
|
||||
|
||||
|
||||
public class test {
|
||||
|
||||
Category Engine = new CategoryImpl("Engine");
|
||||
Category Transmission = new CategoryImpl("Transmission");
|
||||
Category Exterior= new CategoryImpl("Exterior");
|
||||
Category Interior= new CategoryImpl("Interior");
|
||||
|
||||
//PartType
|
||||
PartType EG100= new PartTypeImpl("EG100", Engine);
|
||||
PartType EG133= new PartTypeImpl("EG133", Engine);
|
||||
PartType EG210= new PartTypeImpl("EG210", Engine);
|
||||
PartType ED110= new PartTypeImpl("ED110", Engine);
|
||||
PartType ED180= new PartTypeImpl("ED180", Engine);
|
||||
PartType EH120= new PartTypeImpl("EH120", Engine);
|
||||
|
||||
PartType TM5= new PartTypeImpl("TM5", Transmission);
|
||||
PartType TM6= new PartTypeImpl("TM6", Transmission);
|
||||
PartType TA5= new PartTypeImpl("TA5", Transmission);
|
||||
PartType TS6= new PartTypeImpl("TS6", Transmission);
|
||||
PartType TSF7= new PartTypeImpl("TSF7", Transmission);
|
||||
PartType TC120= new PartTypeImpl("TC120", Transmission);
|
||||
|
||||
PartType XC= new PartTypeImpl("XC", Exterior);
|
||||
PartType XM= new PartTypeImpl("XM", Exterior);
|
||||
PartType XS= new PartTypeImpl("XS", Exterior);
|
||||
|
||||
PartType IN= new PartTypeImpl("IN", Interior);
|
||||
PartType IH= new PartTypeImpl("IH", Interior);
|
||||
PartType IS= new PartTypeImpl("IS", Interior);
|
||||
|
||||
|
||||
CompatibilityManager cm;
|
||||
|
||||
|
||||
|
||||
@BeforeEach
|
||||
public void init(){
|
||||
|
||||
cm = new CompatibilityManagerImpl();
|
||||
|
||||
Set<PartType> EH120Requirement = new HashSet<PartType>();
|
||||
EH120Requirement.add(TC120);
|
||||
|
||||
Set<PartType> TA5Incompatibilities = new HashSet<PartType>();
|
||||
TA5Incompatibilities.add(EG100);
|
||||
|
||||
Set<PartType> TSF7Incompatibilities = new HashSet<PartType>();
|
||||
TSF7Incompatibilities.add(EG100);
|
||||
TSF7Incompatibilities.add(EG133);
|
||||
TSF7Incompatibilities.add(ED110);
|
||||
|
||||
Set<PartType> TC120Requirement = new HashSet<PartType>();
|
||||
TC120Requirement.add(EH120);
|
||||
|
||||
Set<PartType> XCIncompatibilities = new HashSet<PartType>();
|
||||
XCIncompatibilities.add(EG210);
|
||||
|
||||
Set<PartType> XMIncompatibilities = new HashSet<PartType>();
|
||||
XMIncompatibilities.add(EG100);
|
||||
|
||||
Set<PartType> XSIncompatibilities = new HashSet<PartType>();
|
||||
XSIncompatibilities.add(EG100);
|
||||
Set<PartType> XSRequirement = new HashSet<PartType>();
|
||||
XSRequirement.add(IS);
|
||||
|
||||
Set<PartType> ISIncompatibilities = new HashSet<PartType>();
|
||||
ISIncompatibilities.add(EG100);
|
||||
ISIncompatibilities.add(TM5);
|
||||
Set<PartType> ISRequirement = new HashSet<PartType>();
|
||||
ISRequirement.add(XS);
|
||||
|
||||
cm.addRequirements(EH120, EH120Requirement);
|
||||
cm.addIncompatibilities(TA5, TA5Incompatibilities);
|
||||
cm.addIncompatibilities(TSF7, TSF7Incompatibilities);
|
||||
cm.addRequirements(TC120, TC120Requirement);
|
||||
cm.addIncompatibilities(XC, XCIncompatibilities);
|
||||
cm.addIncompatibilities(XM, XMIncompatibilities);
|
||||
cm.addIncompatibilities(XS, XSIncompatibilities);
|
||||
cm.addRequirements(XS, XSRequirement);
|
||||
cm.addIncompatibilities(IS, ISIncompatibilities);
|
||||
cm.addRequirements(IS, ISRequirement);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Incompatibilities_Simple_1(){
|
||||
assertTrue(cm.getIncompatibilities(TA5).contains(EG100));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_multiple_Incompatibilities_Simple_2(){
|
||||
assertTrue(
|
||||
cm.getIncompatibilities(TSF7).contains(EG100)&&
|
||||
cm.getIncompatibilities(TSF7).contains(EG133)&&
|
||||
cm.getIncompatibilities(TSF7).contains(ED110)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Requirements_3(){
|
||||
assertTrue(cm.getRequirements(EH120).contains(TC120));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A <-> B
|
||||
* if A -> B then B -> A
|
||||
*/
|
||||
@Test
|
||||
public void test_Incompatibilities_Complex_4(){
|
||||
System.out.println("size EG100 incompatibilities : "+cm.getIncompatibilities(EG100).size());
|
||||
assertTrue(cm.getIncompatibilities(EG100).contains(IS));
|
||||
assertTrue(cm.getIncompatibilities(EG100).contains(XS));
|
||||
}
|
||||
|
||||
/*
|
||||
* if A require B
|
||||
* then A is incompatible with all incompatible of B
|
||||
*/
|
||||
@Test
|
||||
public void test_Require_Incompatibilities_Complex_5(){
|
||||
assertTrue(cm.getIncompatibilities(XS).contains(EG100));
|
||||
System.out.println("size XS incompatibilities : " + cm.getIncompatibilities(XS).size());
|
||||
assertTrue(cm.getIncompatibilities(XS).contains(TM5));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Require Require Require
|
||||
* if A -> B && B -> C then A -> C
|
||||
*/
|
||||
@Test
|
||||
public void test_Incompatibilities_Complex_7(){
|
||||
cm.addRequirements(TC120, Set.of(XC));
|
||||
assertTrue(cm.getRequirements(TC120).contains(XC));
|
||||
assertTrue(cm.getRequirements(EH120).contains(XC));
|
||||
cm.removeRequirement(TC120, XC);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Empty_Requirements_5(){
|
||||
assertTrue(cm.getRequirements(ED180).isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Remove_and_restore_Incompatibilities_6(){
|
||||
assertTrue(cm.getIncompatibilities(XM).contains(EG100));
|
||||
cm.removeIncompatibility(XM, EG100);
|
||||
assertFalse(cm.getIncompatibilities(XM).contains(EG100));
|
||||
Set<PartType> setEG100 = new HashSet<PartType>();
|
||||
setEG100.add(EG100);
|
||||
cm.addIncompatibilities(XM, setEG100);
|
||||
assertTrue(cm.getIncompatibilities(XM).contains(EG100));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Remove_Empty_7(){
|
||||
assertTrue(cm.getIncompatibilities(EH120).isEmpty());
|
||||
cm.removeIncompatibility(EH120, EG100);
|
||||
assertTrue(cm.getIncompatibilities(EH120).isEmpty()); }
|
||||
|
||||
@Test
|
||||
public void test_Remove_and_restore_Requirements_8(){
|
||||
assertTrue(cm.getRequirements(EH120).contains(TC120));
|
||||
cm.removeRequirement(EH120, TC120);
|
||||
assertFalse(cm.getRequirements(EH120).contains(TC120));
|
||||
Set<PartType> setTC120 = new HashSet<PartType>();
|
||||
setTC120.add(TC120);
|
||||
cm.addRequirements(EH120, setTC120);
|
||||
assertTrue(cm.getRequirements(EH120).contains(TC120));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_remove_incompatibilities_but_no_removable(){
|
||||
assertTrue(cm.getIncompatibilities(EG100).contains(IS));
|
||||
cm.removeIncompatibility(EG100, IS);
|
||||
assertTrue(cm.getIncompatibilities(EG100).contains(IS));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_Add_and_restore_Incompatibilities_9(){
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(EG100));
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(EG133));
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
|
||||
cm.removeIncompatibility(TSF7, EG100);
|
||||
assertFalse(cm.getIncompatibilities(TSF7).contains(EG100));
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(EG133));
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
|
||||
Set<PartType> setEG100 = new HashSet<PartType>();
|
||||
setEG100.add(EG100);
|
||||
cm.addIncompatibilities(TSF7, setEG100);
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(EG100));
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(EG133));
|
||||
assertTrue(cm.getIncompatibilities(TSF7).contains(ED110));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_contradiction(){
|
||||
CompatibilityManager cm2 = new CompatibilityManagerImpl();
|
||||
PartType eg= new PartTypeImpl("Eg", Engine);
|
||||
PartType tr= new PartTypeImpl("Tr", Transmission);
|
||||
|
||||
Set<PartType> egIncompatibilities = new HashSet<PartType>();
|
||||
egIncompatibilities.add(tr);
|
||||
cm2.addIncompatibilities(eg, egIncompatibilities);
|
||||
|
||||
Set<PartType> efRequirement = new HashSet<PartType>();
|
||||
efRequirement.add(eg);
|
||||
cm2.addRequirements(tr, efRequirement);
|
||||
|
||||
|
||||
assertFalse(cm2.getIncompatibilities(eg).contains(eg));
|
||||
assertTrue(cm2.getRequirements(tr).contains(eg));
|
||||
assertTrue(cm2.getIncompatibilities(tr).contains(tr)); //tr Require eg, eg Incompatible tr, -> eg Incompatible eg
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isComplete_empty_config(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
assertFalse(config1.isComplete());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void test_isComplete(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TM5);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
|
||||
assertTrue(config1.isComplete());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isNotComplete(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TM5);
|
||||
config1.selectPart(XS);
|
||||
|
||||
assertFalse(config1.isComplete());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isNotValide_empty_config(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isNotValide_not_complete(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TM5);
|
||||
config1.selectPart(XS);
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isValid_empty_cm(){
|
||||
CompatibilityManager cm2 = new CompatibilityManagerImpl();
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm2);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TM5);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
|
||||
assertTrue(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isValid(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TS6);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IS);
|
||||
|
||||
assertTrue(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_isNotValid(){
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm);
|
||||
config1.selectPart(EG210);
|
||||
config1.selectPart(TM5);
|
||||
config1.selectPart(XS);
|
||||
config1.selectPart(IH);
|
||||
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test_contradiction_config(){
|
||||
CompatibilityManager cm2 = new CompatibilityManagerImpl();
|
||||
PartType eg= new PartTypeImpl("Eg", Engine);
|
||||
PartType tr= new PartTypeImpl("Tr", Transmission);
|
||||
PartType ex= new PartTypeImpl("Ex", Exterior);
|
||||
PartType in= new PartTypeImpl("In", Interior);
|
||||
|
||||
Set<PartType> egIncompatibilities = new HashSet<PartType>();
|
||||
egIncompatibilities.add(tr);
|
||||
cm2.addIncompatibilities(eg, egIncompatibilities);
|
||||
|
||||
Set<PartType> efRequirement = new HashSet<PartType>();
|
||||
efRequirement.add(eg);
|
||||
cm2.addRequirements(eg, efRequirement);
|
||||
|
||||
ConfigurationImpl config1 = new ConfigurationImpl(cm2);
|
||||
config1.selectPart(eg);
|
||||
config1.selectPart(tr);
|
||||
config1.selectPart(ex);
|
||||
config1.selectPart(in);
|
||||
|
||||
assertFalse(config1.isValid());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user