Пример #1
0
        public void addRelation(Relation newRelation)
        {
            if (this.relations == null)
            {
                this.relations = new List<Relation>();
            }
            else
            {
                //if the object already has this relation
                if (hasRelation(newRelation))
                {
                    return;
                }
            }

            this.relations.Add(newRelation);
        }
Пример #2
0
 //see if this object has a given relation
 public bool hasRelation(Relation relation)
 {
     foreach (Relation relationTemp in this.relations)
     {
         if (relationTemp == relation)
         {
             return true;
         }
     }
     return false;
 }