/// <summary> /// // Used for δ(Delta)-rule /// </summary> /// <param name="component"></param> /// <param name="processed"></param> /// <param name="parent"></param> public TableauxNode(Component component, Component processed, TableauxNode parent, char variable) { this.Components = new List <Component>(); this.ActiveVariables = new List <char>() { variable }; this.Rule_Type = RuleType.RuleDelta; this.ParentNode = parent; parent.Branched = false; parent.LeftNode = this; component.Belongs = this; if (parent.ActiveVariables?.Count != 0) { parent.ActiveVariables?.ForEach(x => this.ActiveVariables.Add(x)); } parent.Components.ForEach(node => { if (node != processed) { var newNode = BinaryTree.CloneNode(node, BinaryTree.Object); newNode.Belongs = this; Components.Add(newNode); } }); Components.Add(component); Components.Sort(new ComponentComparer()); }
/// <summary> /// Used for non-branched a-rules & gamma-rule /// </summary> /// <param name="components" /> /// <param name="processed" /> /// <param name="parent" /> /// <param name="ruleType">Alpha or Gamma</param> public TableauxNode(List <Component> components, Component processed, TableauxNode parent, RuleType ruleType) { this.Components = new List <Component>(); this.ActiveVariables = new List <char>(); this.Rule_Type = ruleType; this.ParentNode = parent; parent.Branched = false; parent.LeftNode = this; parent.Components.ForEach(component => { if (component != processed) { component.Belongs = this; this.Components.Add(component); } }); components.ForEach(x => { x.Belongs = this; this.Components.Add(x); }); if (parent.ActiveVariables?.Count != 0 && parent.ActiveVariables != null) { parent.ActiveVariables?.ForEach(x => this.ActiveVariables?.Add(x)); } Components.Sort(new ComponentComparer()); }
/// <summary> /// // Used for branched B-rules /// </summary> /// <param name="node"></param> /// <param name="processed"></param> /// <param name="parent"></param> public TableauxNode(Component node, Component processed, TableauxNode parent, RuleType ruleType) { this.Components = new List <Component>(); this.ActiveVariables = new List <char>(); this.Rule_Type = ruleType; node.Belongs = this; parent.Components.ForEach(component => { if (component != processed) { var newNode = BinaryTree.CloneNode(component, BinaryTree.Object); newNode.Belongs = this; Components.Add(newNode); } }); Components.Add(node); parent.Branched = (ruleType == RuleType.RuleBeta); this.ParentNode = parent; if (parent.LeftNode == null) { parent.LeftNode = this; } else if (parent.RightNode == null && ruleType == RuleType.RuleBeta) { parent.RightNode = this; } if (parent.ActiveVariables?.Count != 0) { parent.ActiveVariables?.ForEach(x => this.ActiveVariables?.Add(x)); } Components.Sort(new ComponentComparer()); }
//Constructors public TableauxNode(Component root, TableauxNode parent = null) { Components = new List <Component>(); this.Rule_Type = RuleType.RuleDefault; this.ParentNode = parent; this.Branched = false; root.Belongs = this; Components.Add(root); if (parent != null) { parent.LeftNode ??= this; } }