Ejemplo n.º 1
0
 /// <summary>
 /// Is root node?
 /// </summary>
 /// <param name="node">Node to check</param>
 /// <returns>True if the node is a root node and reverse</returns>
 public static bool isRootNode(DecisionTreeNode node)
 {
     try
     {
         if (node == null)
             return false;
         return (node.NODE_ID == "0" && node.NODE_TYPE == (int) DecisionTreeNodeType.Model);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Is leaf node?
 /// </summary>
 /// <param name="node">Node to check</param>
 /// <returns>True if the node is a leaf node and reverse</returns>
 public static bool isLeafNode(DecisionTreeNode node)
 {
     try
     {
         if (node == null)
             return false;
         return (node.NODE_TYPE == (int) DecisionTreeNodeType.Distribution && node.CHILDREN_CARDINALITY == 0);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Get parent node
 /// </summary>
 /// <param name="node">The node you want to get its parent</param>
 /// <returns>The parent node</returns>
 public static DecisionTreeNode getParentNode(DecisionTreeNode node)
 {
     try
     {
         if (!isRootNode(node))
             return node.DecisionTreeNode_Parent;
         else
             return null;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Get child nodes
 /// </summary>
 /// <param name="node">The node you want to get its childs</param>
 /// <returns>Array of node childs</returns>
 public static DecisionTreeNode[] getChildNodes(DecisionTreeNode node)
 {
     try
     {
         if (!isLeafNode(node))
             return node.DecisionTreeNode_Childs.ToArray();
         else
             return null;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
 public DecisionTreeAnalysisResult(NodeDescription NodeDescription, DecisionTreeNode Node)
 {
     _NodeDescription = NodeDescription;
     _Node = Node;
 }
 public NodeDescription(DecisionTreeNode node)
 {
     _NodeCaptions = new List<NodeCaption>();
     while (!DecisionTreeAnalysis.isRootNode(node.DecisionTreeNode_Parent))
     {
         _NodeCaptions.Add(new NodeCaption(node.NODE_CAPTION));
         node = node.DecisionTreeNode_Parent;
     }
 }