Exemple #1
0
 public IEnumerable<Edge> Apply(Vertex source)
 {
     foreach (var kvp in Logic(source, Graph))
     {
         yield return kvp;
     }
 }
Exemple #2
0
        public IEnumerable<Edge> Apply(Vertex source)
        {
            foreach (var kvp_iter in Logic(source.Object))
            {
                var kvp = kvp_iter; // just make resharper happeh
                Func<Vertex> createVertex = () => new Vertex(kvp.Value, ++_idFactory, source.DistanceFromRoot + 1);

                if (kvp.Value == null)
                {
                    yield return new Edge(kvp.Key, source, createVertex());
                }
                else
                {
                    var contains = SafetyTools.SafeEval(() => _cache.ContainsKey(kvp.Value), true);
                    if (!contains)
                    {
                        SafetyTools.SafeDo(() => _cache.Add(kvp.Value, createVertex()));
                    }

                    var vertex = SafetyTools.SafeEval(() => _cache[kvp.Value], createVertex);
                    yield return new Edge(kvp.Key, source, vertex);
                }
            }
        }
Exemple #3
0
 public bool IsValid(Vertex v)
 {
     return !Logic(v.Object).IsEmpty();
 }
Exemple #4
0
 public bool IsValid(Vertex v)
 {
     return !Logic(v, Graph).IsEmpty();
 }