/// <summary> Creates a new listenable graph. If the <code>reuseEvents</code> flag is /// set to <code>true</code> this class will reuse previously fired events /// and will not create a new object for each event. This option increases /// performance but should be used with care, especially in multithreaded /// environment. /// /// </summary> /// <param name="g">the backing graph. /// </param> /// <param name="reuseEvents">whether to reuse previously fired event objects /// instead of creating a new event object for each event. /// /// </param> /// <throws> IllegalArgumentException if the backing graph is already a </throws> /// <summary> listenable graph. /// </summary> public DefaultListenableGraph(Graph g, bool reuseEvents) : base(g) { m_reuseEvents = reuseEvents; m_reuseableEdgeEvent = new FlyweightEdgeEvent(this, -1, null); m_reuseableVertexEvent = new FlyweightVertexEvent(this, -1, (System.Object)null); // the following restriction could be probably relaxed in the future. if (g is ListenableGraph) { throw new System.ArgumentException("base graph cannot be listenable"); } }
/// <summary> Creates a new iterator for the specified graph. Iteration will start at /// the specified start vertex. If the specified start vertex is /// <code>null</code>, Iteration will start at an arbitrary graph vertex. /// /// </summary> /// <param name="g">the graph to be iterated. /// </param> /// <param name="startVertex">the vertex iteration to be started. /// /// </param> /// <throws> NullPointerException </throws> /// <throws> IllegalArgumentException </throws> public CrossComponentIterator(Graph g, System.Object startVertex) { InitBlock(); if (g == null) { throw new System.NullReferenceException("graph must not be null"); } m_specifics = createGraphSpecifics(g); m_vertexIterator = g.vertexSet().GetEnumerator(); setCrossComponentTraversal(startVertex == null); m_reusableEdgeEvent = new FlyweightEdgeEvent(this, null); m_reusableVertexEvent = new FlyweightVertexEvent(this, (System.Object)null); if (startVertex == null) { // pick a start vertex if graph not empty //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" if (m_vertexIterator.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" m_startVertex = ((DictionaryEntry)m_vertexIterator.Current).Value; } else { m_startVertex = null; } } else if (g.containsVertex(startVertex)) { m_startVertex = startVertex; } else { throw new System.ArgumentException("graph must contain the start vertex"); } }
/// <summary> Creates a new listenable graph. If the <code>reuseEvents</code> flag is /// set to <code>true</code> this class will reuse previously fired events /// and will not create a new object for each event. This option increases /// performance but should be used with care, especially in multithreaded /// environment. /// /// </summary> /// <param name="g">the backing graph. /// </param> /// <param name="reuseEvents">whether to reuse previously fired event objects /// instead of creating a new event object for each event. /// /// </param> /// <throws> IllegalArgumentException if the backing graph is already a </throws> /// <summary> listenable graph. /// </summary> public DefaultListenableGraph(Graph g, bool reuseEvents):base(g) { m_reuseEvents = reuseEvents; m_reuseableEdgeEvent = new FlyweightEdgeEvent(this, - 1, null); m_reuseableVertexEvent = new FlyweightVertexEvent(this, - 1, (System.Object) null); // the following restriction could be probably relaxed in the future. if (g is ListenableGraph) { throw new System.ArgumentException("base graph cannot be listenable"); } }
/// <summary> Creates a new iterator for the specified graph. Iteration will start at /// the specified start vertex. If the specified start vertex is /// <code>null</code>, Iteration will start at an arbitrary graph vertex. /// /// </summary> /// <param name="g">the graph to be iterated. /// </param> /// <param name="startVertex">the vertex iteration to be started. /// /// </param> /// <throws> NullPointerException </throws> /// <throws> IllegalArgumentException </throws> public CrossComponentIterator(Graph g, System.Object startVertex) { InitBlock(); if (g == null) { throw new System.NullReferenceException("graph must not be null"); } m_specifics = createGraphSpecifics(g); m_vertexIterator = g.vertexSet().GetEnumerator(); setCrossComponentTraversal(startVertex == null); m_reusableEdgeEvent = new FlyweightEdgeEvent(this, null); m_reusableVertexEvent = new FlyweightVertexEvent(this, (System.Object) null); if (startVertex == null) { // pick a start vertex if graph not empty //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'" if (m_vertexIterator.MoveNext()) { //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'" m_startVertex = ((DictionaryEntry)m_vertexIterator.Current).Value; } else { m_startVertex = null; } } else if (g.containsVertex(startVertex)) { m_startVertex = startVertex; } else { throw new System.ArgumentException("graph must contain the start vertex"); } }