/// <summary> /// Establishes mappings between validity nodes and the elements they monitor. /// </summary> public void EstablishMappingsToValidityNodes() { if (m_successors.Count > 0) { if (!(m_successors[0] is ValidityNode)) { for (int i = 0; i < m_successors.Count; i++) { m_successors[i] = m_validationService.m_htNodes[m_successors[i]]; } } } if (m_children.Count > 0) { if (!(m_children[0] is ValidityNode)) { for (int i = 0; i < m_children.Count; i++) { m_children[i] = m_validationService.m_htNodes[m_children[i]]; } } } IHasValidity myParent = m_mine.GetParent(); if (m_parent == null && myParent != null) { m_parent = (ValidityNode)m_validationService.m_htNodes[myParent]; } }
/// <summary> /// Notifies the specified object in the graph of its self state change. /// </summary> /// <param name="ihv">The specified object in the graph.</param> public void NotifySelfStateChange(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn != null) { vn.NotifySelfStateChange(ihv.SelfState); } }
/// <summary> /// Gets the invalid child count of the specified object in the graph. /// </summary> /// <param name="ihv">The specified object in the graph.</param> /// <returns>The invalid child count of the specified object in the graph.</returns> public int GetInvalidChildCountOf(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return(int.MinValue); } return(vn.InvalidChildCount); }
/// <summary> /// Gets the aggregate validity state of the children of the specified object in the graph. /// </summary> /// <param name="ihv">The specified object in the graph.</param> /// <returns>The aggregate validity state of the children of the specified object in the graph.</returns> public Validity GetChildValidityState(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return(Validity.Invalid); } return(vn.ChildrenValid?Validity.Valid:Validity.Invalid); }
/// <summary> /// Gets the state of validity of the predecessors of the specified object in the graph. /// </summary> /// <param name="ihv">The specified object in the graph.</param> /// <returns>The state of validity of the predecessors of the specified object in the graph.</returns> public Validity GetPredecessorValidityState(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return(Validity.Invalid); } return(vn.PredecessorsValid?Validity.Valid:Validity.Invalid); }
/// <summary> /// Gets the overall state of the validity of the specified object in the graph. /// </summary> /// <param name="ihv">The specified object in the graph.</param> /// <returns>The</returns> public Validity GetValidityState(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return(Validity.Invalid); } return(vn.OverallValid?Validity.Valid:Validity.Invalid); }
/// <summary> /// Creates a status report that describes the validity state of the graph, at and below the provided node. /// </summary> /// <param name="ihv">The provided node that is to be the root of this report.</param> /// <returns></returns> public string StatusReport(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return("Unknown object - " + ihv); } else { return(vn.Name + " : Self " + vn.SelfValid + ", Preds = " + vn.PredecessorsValid + "(" + vn.InvalidPredecessorCount + ") Children = " + vn.ChildrenValid + "(" + vn.InvalidChildCount + ").\r\n"); } }
/// <summary> /// Gets the parent of the specified object in the graph. /// </summary> /// <param name="ihv">The specified object in the graph.</param> /// <returns>The parent of the specified object in the graph.</returns> public IHasValidity GetParentOf(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return(null); } if (vn.Parent == null) { return(null); } return(vn.Parent.Mine); }
private void AddNode(IHasValidity ihv) { if (!m_htNodes.Contains(ihv)) { ValidityNode vn = new ValidityNode(this, ihv); m_htNodes.Add(ihv, vn); IList list = ihv.GetSuccessors(); if (list.Count > 0) { foreach (object obj in list) { IHasValidity successor = (IHasValidity)obj; AddNode(successor); } } } ihv.StructureChangeHandler += m_structureChangeListener; }
/// <summary> /// Gets the children of the specified object in the graph. /// </summary> /// <param name="ihv">The specified object in the graph.</param> /// <returns>The children of the specified object in the graph.</returns> public IList GetChildrenOf(IHasValidity ihv) { ValidityNode vn = (ValidityNode)m_htNodes[ihv]; if (vn == null) { return(s_empty_List); } ArrayList retval = new ArrayList(); foreach (ValidityNode subNode in vn.Children) { IHasValidity ihv2 = subNode.Mine; retval.Add(ihv2); } return(retval); }