예제 #1
0
        private IEnumerable <MockObject> WalkGraph(int depth, bool includeSelf, MockGraphContext context, Dictionary <Guid, MockObject> visited)
        {
            if (includeSelf)
            {
                if (!visited.ContainsKey(Uuid))
                {
                    visited[Uuid] = this;
                    yield return(this);
                }
            }
            if (depth <= 0)
            {
                yield break;
            }

            foreach (var @object in SourcesAndTargets(context))
            {
                if (!visited.ContainsKey(@object.Uuid))
                {
                    visited[@object.Uuid] = @object;
                    yield return(@object);

                    if (depth > 1)
                    {
                        foreach (var node in @object.WalkGraph(depth - 1, false, context, visited))
                        {
                            yield return(node);
                        }
                    }
                }
            }
        }
예제 #2
0
 public MockSubscriptionInfo(v12.Datatypes.Object.SubscriptionInfo subscriptionInfo)
 {
     RequestUuid       = subscriptionInfo.RequestUuid;
     IncludeObjectData = subscriptionInfo.IncludeObjectData;
     Format            = subscriptionInfo.Format;
     Context           = new MockGraphContext(subscriptionInfo);
 }
예제 #3
0
 public IEnumerable <MockObject> SecondarySourcesAndTargets(MockGraphContext context)
 {
     if (context.IncludeSecondarySources)
     {
         foreach (var @object in SecondarySources.Values)
         {
             yield return(@object);
         }
     }
     if (context.IncludeSecondaryTargets)
     {
         foreach (var @object in SecondaryTargets.Values)
         {
             yield return(@object);
         }
     }
 }
예제 #4
0
 public IEnumerable <EtpDataObjectType> SupportedPrimarySourceAndTargetTypes(MockGraphContext context)
 {
     if (context.IncludeSources)
     {
         if (context.NavigatePrimaryEdges)
         {
             foreach (var dataObjectType in SupportedSourceTypes)
             {
                 yield return(dataObjectType);
             }
         }
     }
     if (context.IncludeTargets)
     {
         if (context.NavigatePrimaryEdges)
         {
             foreach (var dataObjectType in SupportedTargetTypes)
             {
                 yield return(dataObjectType);
             }
         }
     }
 }
예제 #5
0
        public IEnumerable <MockObject> WalkGraph(MockGraphContext context)
        {
            var visited = new Dictionary <Guid, MockObject>();

            foreach (var @object in WalkGraph(context.Depth, context.IncludeSelf, context, visited))
            {
                yield return(@object);
            }

            if (context.IncludeSecondarySources || context.IncludeSecondaryTargets)
            {
                foreach (var @object in visited.Values.ToList())
                {
                    foreach (var secondary in @object.SecondarySourcesAndTargets(context))
                    {
                        if (!visited.ContainsKey(secondary.Uuid))
                        {
                            visited[secondary.Uuid] = secondary;
                            yield return(secondary);
                        }
                    }
                }
            }
        }
예제 #6
0
 public MockSubscriptionInfo(EtpVersion version, MockObject mockObject, Guid requestUuid)
 {
     RequestUuid       = requestUuid;
     IncludeObjectData = true;
     Context           = new MockGraphContext(mockObject.Uri(version));
 }
예제 #7
0
 public MockSubscriptionInfo(string uri, Guid namespaceId)
 {
     RequestUuid       = GuidUtility.Create(namespaceId, uri);
     IncludeObjectData = false;
     Context           = new MockGraphContext(new EtpUri(uri));
 }
예제 #8
0
 public MockSubscriptionInfo(v11.Datatypes.Object.NotificationRequestRecord request)
 {
     RequestUuid       = request.RequestUuid;
     IncludeObjectData = request.IncludeObjectData;
     Context           = new MockGraphContext(request);
 }
예제 #9
0
 public MockSubscriptionInfo(Common.Datatypes.ChannelData.IChannelDescribeSubscription subscription)
 {
     RequestUuid       = subscription.RequestUuid;
     IncludeObjectData = false;
     Context           = new MockGraphContext(subscription);
 }