public TrueEntityRange(ITrueEntity trueEntity)
 {
     if (trueEntity == null)
     {
         throw new NullReferenceException("trueEntity");
     }
     _TrueEntity = trueEntity;
 }
Beispiel #2
0
 public static bool TryToTrueEntity(IEntity entity, out ITrueEntity trueEntity)
 {
     if (entity is ChangeableEntity)
     {
         trueEntity = (entity as ChangeableEntity).Change() as ITrueEntity;
     }
     else
     {
         trueEntity = entity as ITrueEntity;
     }
     return(trueEntity != null);
 }
Beispiel #3
0
        public IRelationshipSet <T> GetEndingWith(ITrueEntity end)
        {
            IRelationshipSet <T> temp = new RelationshipSet <T>();

            foreach (T t in this.GetItems())
            {
                if (t.Entities != null && t.Entities.Count != 0 && t.Entities[1].Equals(end))
                {
                    temp.Add(t);
                }
            }
            return(temp);
        }
 /// <summary>
 /// Adds ITrueEntity to the graph.
 /// </summary>
 /// <param name="trueEntity"></param>
 public void Add(ITrueEntity trueEntity)
 {
     if (trueEntity is IClassEntity)
     {
         Add(trueEntity as IClassEntity);
     }
     else if (trueEntity is IPropertyEntity)
     {
         Add(trueEntity as IPropertyEntity);
     }
     else if (trueEntity is IIndividualEntity)
     {
         Add(trueEntity as IIndividualEntity);
     }
     else if (trueEntity is IDatatypeEntity)
     {
         Add(trueEntity as IDatatypeEntity);
     }
     else
     {
         throw new ArgumentException("Unsopported subtype of ITrueEntity : " + trueEntity.GetType(), "trueEntity");
     }
 }
 public void Add(ITrueEntity trueEntity)
 {
     Graph.Add(trueEntity);
 }
Beispiel #6
0
        private int RelationshipLength(IRelationshipSet <IRelationship> relationships, ITrueEntity begin, ITrueEntity end)
        {
            if (begin.Equals(end))
            {
                return(0);
            }

            int length = -1;

            foreach (IRelationship rel in relationships.GetBeginningWith(begin).GetItems())
            {
                int temp = RelationshipLength(relationships, rel.Entities[1], end);
                if (temp > length)
                {
                    length = temp;
                }
            }

            return(length >= 0 ? length + 1 : -1);
        }