protected RelationBase() { href = String.Empty; // for mem perf. we can play with that capacity. In RelationCosmos it is later reducted to // the used size by calling TrimToSize(). outgoingRelations = new RelationHRefList(5); pointInTime = RelationCosmos.UnknownPointInTime; pointInTimeIsAdjustable = true; externalRelations = null; }
/// <summary> /// Returns a list of relations, that are known in RelationCosmos and that /// the relation provided points to. /// </summary> /// <param name="relation">The object implementing RelationBase</param> /// <param name="excludeRelations">List of relations, /// that should be excluded in that check</param> /// <returns>RelationList</returns> public RelationList GetOutgoing(RelationBase relation, IList excludeRelations) { if (relation == null || relation.HRef == null) { return(RelationCosmos.emptyRelationList); } lock (syncRoot) { try { if (excludeRelations == null) { excludeRelations = (IList)RelationCosmos.emptyRelationList; } // check incoming: RelationHRefList list = relation.OutgoingRelations; if (list != null && list.Count > 0) { RelationList returnList = new RelationList(list.Count); foreach (string hrefOut in list) { if (hrefOut != relation.HRef && !RelationListContainsHRef(excludeRelations, hrefOut) && registeredRelations.Contains(hrefOut)) { returnList.Add(registeredRelations[hrefOut]); } } return(returnList); } } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("RelationCosmos.GetOutgoing() exception: " + ex.Message); } return(RelationCosmos.emptyRelationList); } }