Esempio n. 1
0
 /// <summary>
 /// Removes the specified reciprocal relationship from this relationship.
 /// </summary>
 /// <param name="reciprocal">The reciprocal.</param>
 public void RemoveReciprocal(MilestoneRelationship reciprocal)
 {
     if (m_reciprocals.Contains(reciprocal))
     {
         m_reciprocals.Remove(reciprocal);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// A reciprocal is a secondary relationship that should not fire if this one fired.
 /// A good example is a strut where one strut pins A to 5 mins after B, and another pins B to
 /// 5 mins before A.
 /// </summary>
 /// <param name="reciprocal">The reciprocal relationship.</param>
 public void AddReciprocal(MilestoneRelationship reciprocal)
 {
     if (m_reciprocals == s_empty_List)
     {
         m_reciprocals = new ArrayList();
     }
     m_reciprocals.Add(reciprocal);
 }
Esempio n. 3
0
 public void RemoveRelationship(MilestoneRelationship relationship)
 {
     #region Error Checking
     if (m_movementManager != null)
     {
         throw new ApplicationException("Cannot add or remove relationships while a network change is being processed.");
     }
     #endregion
     Relationships.Remove(relationship);
 }
Esempio n. 4
0
 public void AddRelationship(MilestoneRelationship relationship)
 {
     #region Error Checking
     if (m_movementManager != null)
     {
         throw new ApplicationException("Cannot add or remove relationships while a network change is being processed.");
     }
     if (relationship.Dependent != this && relationship.Independent != this)
     {
         throw new ApplicationException("Cannot add a relationship to this milestone that does not involve it.");
     }
     if (Relationships.Contains(relationship))
     {
         return;
     }
     #endregion
     Relationships.Add(relationship);
 }
Esempio n. 5
0
 private static void _CheckForCyclicDependencies(IMilestone prospectiveMover, ref Stack callStack)
 {
     if (!callStack.Contains(prospectiveMover))
     {
         callStack.Push(prospectiveMover);
         foreach (MilestoneRelationship mr in prospectiveMover.Relationships)
         {
             if (mr.Enabled && mr.Independent.Equals(prospectiveMover))
             {
                 foreach (MilestoneRelationship recip in mr.Reciprocals)
                 {
                     recip.PushEnabled(false);
                 }
                 callStack.Push(mr);
                 _CheckForCyclicDependencies(mr.Dependent, ref callStack);
                 foreach (MilestoneRelationship recip in mr.Reciprocals)
                 {
                     recip.PopEnabled();
                 }
             }
         }
     }
     else
     {
         object obj;
         while (callStack.Count > 0)
         {
             obj = callStack.Pop();
             if (obj is IMilestone)
             {
                 IMilestone ms = (IMilestone)obj;
                 Console.WriteLine("Milestone : " + ms);
             }
             else if (obj is MilestoneRelationship)
             {
                 MilestoneRelationship mr = (MilestoneRelationship)obj;
                 Console.WriteLine("Relationship : " + mr);
             }
         }
         Console.WriteLine();
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"></see> to compare with the current <see cref="T:System.Object"></see>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"></see> is equal to the current <see cref="T:System.Object"></see>; otherwise, false.
        /// </returns>
        public override bool Equals(object obj)
        {
            MilestoneRelationship mr = obj as MilestoneRelationship;

            if (mr == null)
            {
                return(false);
            }
            else if (GetType() != mr.GetType())
            {
                return(false);
            }
            else if (Object.Equals(Dependent, mr.Dependent) && Object.Equals(Independent, mr.Independent))
            {
                return(true);
            }
            else
            {
                return(base.Equals(obj));
            }
        }
Esempio n. 7
0
 public MilestoneAdjustmentException(string msg, MilestoneRelationship relationship) : base(msg)
 {
     m_relationship = relationship;
 }