/// <summary> /// Private helper for BDD construction. /// </summary> /// <param name="ft"> /// The ft. /// </param> /// <param name="nodeFactory"> /// The node factory. /// </param> /// <returns> /// The <see cref="BDDNode"/>. /// </returns> private BDDNode CreateBDD(FaultTree.FaultTree ft, BDDNodeFactory nodeFactory) { int nextVariable = ft.Reduce(new MinTerminalTransformer()); if (nextVariable == int.MaxValue) { // ft should consist of only terminal node return(nodeFactory.CreateNode(((FaultTreeLiteralNode)ft.Root).Value)); } FaultTree.FaultTree high = ft.DeepCopy().Replace(nextVariable, true).Simplify(); FaultTree.FaultTree low = ft.DeepCopy().Replace(nextVariable, false).Simplify(); BDDNode highNode = this.CreateBDD(high, nodeFactory); BDDNode lowNode = this.CreateBDD(low, nodeFactory); return(nodeFactory.CreateNode(nextVariable, highNode, lowNode)); }
public static int NextId(this FaultTree.FaultTree ft) { return(ft.Reduce(new FaultTreeMaxIdTransformer()) + 1); }
public static int NextBasicEvent(this FaultTree.FaultTree ft) { return(ft.Reduce(new MaxTerminalTransformer()) + 1); }