private int HandleNotKnownManOptPos(string firstTokenString, int dependencyType) { if (dependencyType != 0) { if (firstTokenString.Contains("NOT")) { dependencyType |= DependencyType.GetNot(); } if (firstTokenString.Contains("KNOWN")) { dependencyType |= DependencyType.GetKnown(); } if (firstTokenString.Contains("MANDATORY")) { dependencyType |= DependencyType.GetMandatory(); } if (firstTokenString.Contains("OPTIONALLY")) { dependencyType |= DependencyType.GetOptional(); } if (firstTokenString.Contains("POSSIBLY")) { dependencyType |= DependencyType.GetPossible(); } } return(dependencyType); }
public static Node FindTheMostNegative(List <Node> childNodeList, Dictionary <string, Record> recordListOfNodes, List <int> dependencyMatrixAsList) { Node theMostNegative = null; int yesCount = 0; int noCount = 0; float theMostPossibility = 0; int sum = 0; float result = 0; foreach (Node node in childNodeList) { string prefix = ""; int dependencyType = dependencyMatrixAsList[node.GetNodeId()]; if ((dependencyType & DependencyType.GetKnown()) == DependencyType.GetKnown()) { prefix = "known "; } else if ((dependencyType & DependencyType.GetNot()) == DependencyType.GetNot()) { prefix = "not "; } else if ((dependencyType & (DependencyType.GetNot() | DependencyType.GetKnown())) == (DependencyType.GetNot() | DependencyType.GetKnown())) { prefix = "not known "; } Record recordOfNode = recordListOfNodes[prefix + node.GetNodeName()]; yesCount = recordOfNode != null?recordOfNode.GetTrueCount() : 0; noCount = recordOfNode != null?recordOfNode.GetFalseCount() : 0; int yesPlusNoCount = (yesCount + noCount) == 0 ? -1 : (yesCount + noCount); result = (float)noCount / yesPlusNoCount; if (Analysis(result, theMostPossibility, yesPlusNoCount, sum)) { theMostPossibility = result; sum = yesPlusNoCount == -1 ? yesPlusNoCount : yesCount + noCount; theMostNegative = node; } } childNodeList.Remove(theMostNegative); return(theMostNegative); }
public static Node FindTheMostPositive(List <Node> childNodeList, Dictionary <string, Record> recordListOfNodes, List <int> dependencyMatrixAsList) { Node theMostPositive = null; int yesCount = 0; int noCount = 0; int theLargestYesCount = 0; int theSmallestNoCount = 0; foreach (Node node in childNodeList) { string prefix = ""; int? dependencyType = dependencyMatrixAsList[node.GetNodeId()]; if ((dependencyType & DependencyType.GetKnown()) == DependencyType.GetKnown()) { prefix = "known "; } else if ((dependencyType & DependencyType.GetNot()) == DependencyType.GetNot()) { prefix = "not "; } else if ((dependencyType & (DependencyType.GetNot() | DependencyType.GetKnown())) == (DependencyType.GetNot() | DependencyType.GetKnown())) { prefix = "not known "; } Record recordOfNode = recordListOfNodes[prefix + node.GetNodeName()]; yesCount = recordOfNode != null?recordOfNode.GetTrueCount() : 0; noCount = recordOfNode != null?recordOfNode.GetFalseCount() : 0; if ((yesCount > theLargestYesCount) || (yesCount == theLargestYesCount && noCount < theSmallestNoCount)) { theLargestYesCount = yesCount; theSmallestNoCount = noCount; theMostPositive = node; } } childNodeList.Remove(theMostPositive); return(theMostPositive); }