public void AddParent(Person parent) { if (!Parents.Contains(parent)) { Parents.Add(parent); } }
private void AddParent(ReadFile readFile) { if (!Parents.Contains(readFile)) { Parents.Add(readFile); } }
public void AddParent(Guid i_gid) { if (!Parents.Contains(i_gid)) { Parents.Add(i_gid); } }
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)); }
/// <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); } } }
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"); } }
/// <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); } }