예제 #1
0
파일: Relatable.cs 프로젝트: ngaspar/SMACK
        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
파일: Relatable.cs 프로젝트: ngaspar/SMACK
 //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;
 }