Maybe the incompatible will be useful
This commit is contained in:
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@@ -4,9 +4,7 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="12bd6c53-8ba7-454c-a61e-7a76cc3b801b" name="Changes" comment="">
|
<list default="true" id="12bd6c53-8ba7-454c-a61e-7a76cc3b801b" name="Changes" comment="" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
@@ -23,6 +21,9 @@
|
|||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="ProblemsViewState">
|
||||||
|
<option name="selectedTabId" value="ProjectErrors" />
|
||||||
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
"associatedIndex": 1
|
"associatedIndex": 1
|
||||||
}</component>
|
}</component>
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
"keyToString": {
|
"keyToString": {
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"git-widget-placeholder": "dev__v1",
|
"git-widget-placeholder": "dev__v1",
|
||||||
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"kotlin-language-version-configured": "true",
|
"kotlin-language-version-configured": "true",
|
||||||
"last_opened_file_path": "C:/Users/vumin/Desktop/M1/ALO/cartailor",
|
"last_opened_file_path": "C:/Users/vumin/Desktop/M1/ALO/cartailor",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
@@ -90,6 +92,7 @@
|
|||||||
<workItem from="1729507889060" duration="386000" />
|
<workItem from="1729507889060" duration="386000" />
|
||||||
<workItem from="1729595321874" duration="25000" />
|
<workItem from="1729595321874" duration="25000" />
|
||||||
<workItem from="1729743145740" duration="122000" />
|
<workItem from="1729743145740" duration="122000" />
|
||||||
|
<workItem from="1729757559608" duration="166000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -2,27 +2,26 @@ package src.fr.impl;
|
|||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import src.fr.api.PartType;
|
import src.fr.api.PartType;
|
||||||
|
import src.fr.api.CompatibilityManager;
|
||||||
|
|
||||||
|
|
||||||
public class CompatibilityCheckerImpl implements src.fr.api.CompatibilityChecker {
|
public class CompatibilityCheckerImpl implements src.fr.api.CompatibilityChecker {
|
||||||
|
private CompatibilityManager compatibilityManager;
|
||||||
|
|
||||||
private HashMap<PartType, Set<PartType>> incompatibilities;
|
public CompatibilityCheckerImpl( CompatibilityManager compatibilityManager){
|
||||||
private HashMap<PartType, Set<PartType>> requirements;
|
this.compatibilityManager=compatibilityManager;
|
||||||
|
|
||||||
public CompatibilityCheckerImpl( HashMap<PartType, Set<PartType>> incompatibilities, HashMap<PartType, Set<PartType>> requirements){
|
|
||||||
this.incompatibilities=incompatibilities;
|
|
||||||
this.requirements= requirements;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<PartType> getIncompatibilities(PartType reference) {
|
public Set<PartType> getIncompatibilities(PartType reference) {
|
||||||
return this.incompatibilities.get(reference);
|
return this.compatibilityManager.getIncompatibilities(reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<PartType> getRequirements(PartType reference) {
|
public Set<PartType> getRequirements(PartType reference) {
|
||||||
return this.requirements.get(reference);
|
return this.compatibilityManager.getRequirements(reference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package src.fr.impl;
|
package src.fr.impl;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -128,48 +129,54 @@ public class CompatibilityManagerImpl implements src.fr.api.CompatibilityManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// A - incompatible B + B require C => A incompatbile C
|
// A -> B -> C -> A, D -> B
|
||||||
// This is B require C
|
//bool verify requirement (1) or incompatible (0)
|
||||||
protected Set<PartType> getIncompability_middle(PartType reference){
|
private void Femeture_Transivite(PartType reference, Set<PartType> result, Set<PartType> visited, boolean bool){
|
||||||
return this.requirements.getOrDefault(reference, new HashSet<PartType>());
|
//Condition de quitter la boucle
|
||||||
|
if(visited.contains(reference)){
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
visited.add(reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
Set<PartType> list = null;
|
||||||
|
if(bool==true){ // requirement
|
||||||
|
//Get all requirement of A (in example is B)
|
||||||
|
list = this.requirements.get(reference);
|
||||||
|
}else{ //incompatible
|
||||||
|
list = this.incompatibilities.get(reference);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(list != null){ // list = {B}
|
||||||
|
for(PartType pt: list){
|
||||||
|
if(!result.contains(pt)){
|
||||||
|
result.add(pt);
|
||||||
|
}
|
||||||
|
Femeture_Transivite(pt,result,visited,bool);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void check_All_Catalog(PartType reference, Set<PartType> result, boolean bool){
|
||||||
|
if(bool){ //
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<PartType> getIncompatibilities(PartType reference) {
|
public Set<PartType> getIncompatibilities(PartType reference) {
|
||||||
// Il faut verifier ref est existé dans Hashmap
|
Set<PartType> result = new HashSet<>();
|
||||||
//return this.incompatibilities.get(reference);
|
Femeture_Transivite(reference, result,new HashSet<>(),false);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//A incompatible B
|
|
||||||
Set<PartType> parts = this.incompatibilities.getOrDefault(reference, new HashSet<PartType>());
|
|
||||||
|
|
||||||
// A incompatible C
|
|
||||||
//Get all incomptability with transivity
|
|
||||||
if (parts != null){
|
|
||||||
for( PartType p: parts){
|
|
||||||
parts.addAll(this.getIncompability_middle(p));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return parts;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//Same but B incompatible C
|
|
||||||
protected Set<PartType> getRequirement_middle(PartType reference){
|
|
||||||
return this.incompatibilities.getOrDefault(reference, new HashSet<PartType>());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<PartType> getRequirements(PartType reference) {
|
public Set<PartType> getRequirements(PartType reference) {
|
||||||
Set<PartType> parts = this.requirements.getOrDefault(reference, new HashSet<PartType>());
|
Set<PartType> result = new HashSet<>();
|
||||||
|
Femeture_Transivite(reference, result,new HashSet<>(),true);
|
||||||
// A incompatible C
|
return result;
|
||||||
//Get all incomptability with transivity
|
|
||||||
if (parts != null){
|
|
||||||
for( PartType p: parts){
|
|
||||||
parts.addAll(this.getRequirement_middle(p));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return parts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user