예제 #1
0
 public bool Test(DataRelationEdge e)
 {
     foreach (DataColumn column in e.Relation.ChildColumns)
     {
         if (!column.AllowDBNull)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
        /// <summary>
        /// Removes an edge from the graph.
        /// 
        /// Complexity: 2 edges removed from the vertex edge list + 1 edge
        /// removed from the edge list.
        /// </summary>
        /// <param name="e">edge to remove</param>
        /// <exception cref="ArgumentNullException">
        /// e is a null reference (Nothing in Visual Basic)
        /// </exception>
        /// <exception cref="EdgeNotFoundException">
        /// <paramref name="e"/> is not part of the graph
        /// </exception>
        public virtual void RemoveEdge(DataRelationEdge e)
        {
            if (e == null)
                throw new ArgumentNullException("e");
            if (!this.ContainsEdge(e))
                throw new EdgeNotFoundException("e");

            this.version++;
            // removing edge from vertices
            DataTableVertex source= (DataTableVertex)e.Source;
            DataRelationEdgeCollection outEdges = this.vertexOutEdges[source];
            if (outEdges==null)
                throw new VertexNotFoundException(source.ToString());
            outEdges.Remove(e);
            DataTableVertex target= (DataTableVertex)e.Target;
            DataRelationEdgeCollection inEdges = this.vertexInEdges[target];
            if (inEdges==null)
                throw new VertexNotFoundException(target.ToString());
            inEdges.Remove(e);
        }
예제 #3
0
 /// <summary>
 /// Tests if a (<see cref="DataRelationEdge"/>) is part of the graph
 /// </summary>
 /// <param name="e">Edge to test</param>
 /// <returns>true if is part of the graph, false otherwize</returns>
 public bool ContainsEdge(DataRelationEdge e)
 {
     foreach(DictionaryEntry di in this.vertexOutEdges)
     {
         DataRelationEdgeCollection es = (DataRelationEdgeCollection)di.Value;
         if (es.Contains(e))
             return true;
     }
     return false;
 }
예제 #4
0
 /// <summary>
 /// Adds an instance of type <see cref="DataRelationEdge"/> to the end of this 
 /// <see cref="DataRelationEdgeCollection"/>.
 /// </summary>
 /// <param name="value">
 /// The Edge to be added to the end of this EdgeCollection.
 /// </param>
 internal void Add(DataRelationEdge value)
 {
     this.List.Add(value);
 }
예제 #5
0
 /// <summary>
 /// Determines whether a specfic <see cref="DataRelationEdge"/> value is in this EdgeCollection.
 /// </summary>
 /// <param name="value">
 /// edge value to locate in this <see cref="DataRelationEdgeCollection"/>.
 /// </param>
 /// <returns>
 /// true if value is found in this collection;
 /// false otherwise.
 /// </returns>
 public bool Contains(DataRelationEdge value)
 {
     return this.List.Contains(value);
 }
예제 #6
0
        /// <summary>
        /// Used for serialization. Not for private use.
        /// </summary>
        /// <param name="e">edge to add.</param>
        internal virtual void AddEdge(DataRelationEdge e)
        {
            if (e==null)
                throw new ArgumentNullException("vertex");
            if (e.GetType().IsAssignableFrom(EdgeProvider.EdgeType))
                throw new ArgumentNullException("vertex type not valid");

            DataTableVertex source= (DataTableVertex)e.Source;
            if (!this.vertexOutEdges.Contains(source))
                throw new VertexNotFoundException(source.ToString());
            DataTableVertex target= (DataTableVertex)e.Target;
            if (!this.vertexOutEdges.Contains(target))
                throw new VertexNotFoundException(target.ToString());

            // if parralel edges are not allowed check if already in the graph
            if (!this.AllowParallelEdges)
            {
                if (ContainsEdge(source,target))
                    throw new ArgumentException("graph does not allow duplicate edges");
            }
            // create edge
            this.EdgeProvider.UpdateEdge(e);
            this.vertexOutEdges[source].Add(e);
            this.vertexInEdges[target].Add(e);
        }
 public bool Test(DataRelationEdge e)
 {
     foreach (DataColumn column in e.Relation.ChildColumns)
     {
         if (!column.AllowDBNull)
             return true;
     }
     return false;
 }