Пример #1
0
 public void AddParent(Person parent)
 {
     if (!Parents.Contains(parent))
     {
         Parents.Add(parent);
     }
 }
Пример #2
0
 private void AddParent(ReadFile readFile)
 {
     if (!Parents.Contains(readFile))
     {
         Parents.Add(readFile);
     }
 }
Пример #3
0
 public void AddParent(Guid i_gid)
 {
     if (!Parents.Contains(i_gid))
     {
         Parents.Add(i_gid);
     }
 }
Пример #4
0
        public bool IsAdjacent(InstructionNode node)
        {
            // Determining if we are adjacent to a node is simply checking if the
            // children or parents of this node contains the target node.

            return(Children.Contains(node) || Parents.Contains(node));
        }
Пример #5
0
 /// <summary>関係を断つ</summary>
 /// <param name="related">関係者</param>
 public void Remove(INetworkable related)
 {
     if (!Parents.Contains(related) && !Children.Contains(related))
     {
         return;
     }
     Parents  = Parents.Except(new[] { related });
     Children = Children.Except(new[] { related });
     related.Remove(this);
 }
 /// <summary> Method adds a minimally reported aggregation as a parent of this </summary>
 /// <param name="Parent_Aggregation">New child aggregation</param>
 public void Add_Parent_Aggregation(Item_Aggregation_Minimal Parent_Aggregation)
 {
     // If the list is currently null, create it
     if (Parents == null)
     {
         Parents = new List <Item_Aggregation_Minimal> {
             Parent_Aggregation
         };
     }
     else
     {
         // If this does not exist, add it
         if (!Parents.Contains(Parent_Aggregation))
         {
             Parents.Add(Parent_Aggregation);
         }
     }
 }
        /// <summary> Method adds a minimally reported aggregation as a parent of this </summary>
        /// <param name="ParentCode"> Aggregation code for this minimally reported aggregation </param>
        /// <param name="ParentName"> Full name for this minimally reported aggregation </param>
        /// <param name="ParentShortName"> Shortened name for this minimally reported aggregation </param>
        public void Add_Parent_Aggregation(string ParentCode, string ParentName, string ParentShortName)
        {
            // Create the object
            Item_Aggregation_Minimal parentAggregation = new Item_Aggregation_Minimal(ParentCode, ParentName, ParentShortName);

            // If the list is currently null, create it
            if (Parents == null)
            {
                Parents = new List <Item_Aggregation_Minimal> {
                    parentAggregation
                };
            }
            else
            {
                // If this does not exist, add it
                if (!Parents.Contains(parentAggregation))
                {
                    Parents.Add(parentAggregation);
                }
            }
        }
Пример #8
0
 public void FillParentsAndChildren()
 {
     foreach (var item in ParentChildrenRelation)
     {
         // if he is a parent
         if (item.ParentInformation == this.Name || item.ParentInformation == this.Birthday)
         {
             if (!Childs.Contains(NamesBirthdays.Where(x => x.Name == item.ChildInformatio || x.Birthday == item.ChildInformatio).First()))
             {
                 Childs.Add(NamesBirthdays.Where(x => x.Name == item.ChildInformatio || x.Birthday == item.ChildInformatio).First());
             }
         }
         // if he is a child
         if (item.ChildInformatio == this.Name || item.ChildInformatio == this.Birthday)
         {
             if (!Parents.Contains(NamesBirthdays.Where(x => x.Name == item.ParentInformation || x.Birthday == item.ParentInformation).First()))
             {
                 Parents.Add(NamesBirthdays.Where(x => x.Name == item.ParentInformation || x.Birthday == item.ParentInformation).First());
             }
         }
     }
 }
        public void AddParent(Person person)
        {
            if (Parents == null)
            {
                Parents = new List <Person>(ParentLimit)
                {
                    person
                };
            }
            else if (Parents.Count < ParentLimit && !Parents.Contains(person))
            {
                // Same gender parents are allowed now
                //if (Parents.Any(x => x.Gender == person.Gender))
                //    throw new Exception("same gender Parents are disallowed.");

                Parents.Add(person);
            }
            else
            {
                throw new Exception("Parents are already full");
            }
        }
Пример #10
0
        /// <summary>後続する</summary>
        /// <param name="parents">先行</param>
        public void Succeed(IEnumerable <INetworkable> parents)
        {
            Contract.Requires(!parents.Contains(this));
            Contract.Requires(!parents.SelectMany(a => a.Ancestors).Contains(this));

            if (parents.IsNullOrEmpty())
            {
                return;
            }
            if (parents.All(a => Parents.Contains(a)))
            {
                return;
            }
            Parents = Parents.Union(parents);
            if (parents.All(a => a.Parents.Contains(this)))
            {
                return;
            }
            foreach (var parent in parents)
            {
                parent.Precede(this);
            }
        }