示例#1
0
        /// <summary> Construct a new pseudograph. The pseudograph can either be directed or
        /// undirected, depending on the specified edge factory. A sample edge is
        /// created using the edge factory to see if the factory is compatible with
        /// this class of  graph. For example, if this graph is a
        /// <code>DirectedGraph</code> the edge factory must produce
        /// <code>DirectedEdge</code>s. If this is not the case, an
        /// <code>IllegalArgumentException</code> is thrown.
        ///
        /// </summary>
        /// <param name="ef">the edge factory of the new graph.
        /// </param>
        /// <param name="allowMultipleEdges">whether to allow multiple edges or not.
        /// </param>
        /// <param name="allowLoops">whether to allow edges that are self-loops or not.
        ///
        /// </param>
        /// <throws>  NullPointerException if the specified edge factory is </throws>
        /// <summary>         <code>null</code>.
        /// </summary>
        public AbstractBaseGraph(EdgeFactory ef, bool allowMultipleEdges, bool allowLoops)
        {
            if (ef == null)
            {
                throw new System.NullReferenceException();
            }

            m_vertexMap             = new SupportClass.HashSetSupport();
            m_edgeSet               = new SupportClass.HashSetSupport();
            m_edgeFactory           = ef;
            m_allowingLoops         = allowLoops;
            m_allowingMultipleEdges = allowMultipleEdges;

            m_specifics = createSpecifics();

            Edge e = ef.createEdge(new System.Object(), new System.Object());

            m_factoryEdgeClass = e.GetType();

            m_edgeListFactory = new ArrayListFactory();

            m_unmodifiableEdgeSet   = null;
            m_unmodifiableVertexSet = null;
        }
		/// <summary> Construct a new pseudograph. The pseudograph can either be directed or
		/// undirected, depending on the specified edge factory. A sample edge is
		/// created using the edge factory to see if the factory is compatible with
		/// this class of  graph. For example, if this graph is a
		/// <code>DirectedGraph</code> the edge factory must produce
		/// <code>DirectedEdge</code>s. If this is not the case, an
		/// <code>IllegalArgumentException</code> is thrown.
		/// 
		/// </summary>
		/// <param name="ef">the edge factory of the new graph.
		/// </param>
		/// <param name="allowMultipleEdges">whether to allow multiple edges or not.
		/// </param>
		/// <param name="allowLoops">whether to allow edges that are self-loops or not.
		/// 
		/// </param>
		/// <throws>  NullPointerException if the specified edge factory is </throws>
		/// <summary>         <code>null</code>.
		/// </summary>
		public AbstractBaseGraph(EdgeFactory ef, bool allowMultipleEdges, bool allowLoops)
		{
			if (ef == null)
			{
				throw new System.NullReferenceException();
			}

            m_vertexMap = new SupportClass.HashSetSupport();
            m_edgeSet = new SupportClass.HashSetSupport();
			m_edgeFactory = ef;
			m_allowingLoops = allowLoops;
			m_allowingMultipleEdges = allowMultipleEdges;
			
			m_specifics = createSpecifics();
			
			Edge e = ef.createEdge(new System.Object(), new System.Object());
			m_factoryEdgeClass = e.GetType();
			
			m_edgeListFactory = new ArrayListFactory();

            m_unmodifiableEdgeSet = null;
            m_unmodifiableVertexSet = null;
		}