Example #1
0
        // public override IEnumerable<Edge> GetPropertyEdgesV<V>(V value, Graph g)
        // {
        //   return GetPropertyEdges(value, g);
        // }

        /// <inheritdoc />
        public IEnumerable <Edge> GetPropertyEdges(T value)
        {
            EdgeId   elementId = -1;
            EdgeType edgeType  = MyGraph.EdgeTypes[TypeId];

            if (m_valueIndexUnique == null || m_valueIndexUnique.TryGetValue(value, out elementId) == false)
            {
                BTreeSet <ElementId> elementIds;
                if (m_valueIndex != null && m_valueIndex.TryGetValue(value, out elementIds))
                {
                    foreach (ElementId eId in elementIds)
                    {
                        yield return(edgeType.GetEdge(eId));
                    }
                }
            }
            if (elementId != -1)
            {
                yield return(edgeType.GetEdge(elementId));
            }
        }
Example #2
0
 /// <summary>
 /// Return the edge referenced by the provided object identifier.
 /// If no edge is referenced by that identifier, then return null.
 /// </summary>
 /// <param name="id">the identifier of the edge to retrieved from the graph</param>
 /// <returns>the edge referenced by the provided identifier or null when no such edge exists</returns>
 public IEdge GetEdge(object id)
 {
     if (id == null)
     {
         throw new ArgumentException("id may not be null, it should be a UInt64");
     }
     if (id is UInt64)
     {
         UInt64     fullId     = (UInt64)id;
         EdgeTypeId edgeTypeId = (EdgeTypeId)(fullId >> 32);
         EdgeType   et         = edgeType[edgeTypeId];
         EdgeId     edgeId     = (EdgeId)fullId;
         Edge       edge       = et.GetEdge(edgeId);
         return(edge);
     }
     return(null);
 }
Example #3
0
        /// <summary>
        /// Try to find an <see cref="Edge"/> with a given property value.
        /// </summary>
        /// <param name="value">the property value to look for</param>
        /// <returns>An edge with a matching property value</returns>
        public Edge GetPropertyEdge(T value)
        {
            EdgeId elementId = -1;

            if (m_valueIndexUnique == null || m_valueIndexUnique.TryGetValue(value, out elementId) == false)
            {
                BTreeSet <ElementId> elementIds;
                if (m_valueIndex != null && m_valueIndex.TryGetValue(value, out elementIds))
                {
                    elementId = elementIds.First();
                }
            }
            if (elementId == -1)
            {
                return(null);
            }
            EdgeType edgeType = MyGraph.EdgeTypes[TypeId];

            return(edgeType.GetEdge(elementId));
        }