public static void getAffectingComponents( SystemComponent selectedComponent, List <SystemComponent> listOfAffectingComponents) { for (int index1 = 0; index1 < Tools.DataBase.Count; ++index1) { if (selectedComponent.getName() != Tools.DataBase[index1].getName()) { for (int index2 = 0; index2 < Tools.DataBase[index1].getFaultsList().Count; ++index2) { for (int index3 = 0; index3 < Tools.DataBase[index1].getFaultsList()[index2].getAffectedComponents().Count; ++index3) { if (selectedComponent.getName() == Tools.DataBase[index1].getFaultsList()[index2].getAffectedComponents()[index3].getName() && Tools.findComponentInListOfComponents(listOfAffectingComponents, Tools.DataBase[index1].getName()) == null) { listOfAffectingComponents.Add(Tools.DataBase[index1]); if (!Tools.isComponentParentIsAlsoHisSon(Tools.DataBase[index1], selectedComponent)) { Tools.getAffectingComponents(Tools.DataBase[index1], listOfAffectingComponents); } } } } } } }
public static void createAffectedComponentsList( SystemComponent selectedComponent, Fault selectedFault, List <SystemComponent> affectedComponents) { affectedComponents.Add(selectedComponent); Tools.getAffeectedComponents(selectedComponent.getName(), selectedFault, affectedComponents); }
public static void getAffeectedComponents( string selectedComponentName, Fault selectedFault, List <SystemComponent> affectedComponents) { for (int index1 = 0; index1 < selectedFault.getAffectedComponents().Count; ++index1) { SystemComponent affectedComponent = selectedFault.getAffectedComponents()[index1]; if (affectedComponent.getName() != selectedComponentName && Tools.findComponentInListOfComponents(selectedFault.getAffectedComponents(), selectedComponentName) == null) { affectedComponents.Add(affectedComponent); for (int index2 = 0; index2 < affectedComponent.getFaultsList().Count; ++index2) { Tools.getAffeectedComponents(affectedComponent.getName(), affectedComponent.getFaultsList()[index2], affectedComponents); } } } }
public static bool isComponentParentIsAlsoHisSon( SystemComponent parent, SystemComponent selectedComponent) { for (int index1 = 0; index1 < selectedComponent.getFaultsList().Count; ++index1) { for (int index2 = 0; index2 < selectedComponent.getFaultsList()[index1].getAffectedComponents().Count; ++index2) { if (parent.getName() == selectedComponent.getFaultsList()[index1].getAffectedComponents()[index2].getName()) { return(true); } } } return(false); }
public bool isEquals(SystemComponent component) { return(this.name == component.getName()); }