示例#1
0
 public ClassroomVM(ClassRoom classroom, Department[] departments) : this(departments)
 {
     numberOfClassroom.Value = classroom.NumberOfClassroom;
     codeOfClassroom.Value   = classroom.CodeOfClassroom;
     specific.Value          = Specifics.Single(s => s == classroom.Specific);
     department.Value        = departments.Single(f => f.CodeOfDepartment == classroom.Department.CodeOfDepartment);
 }
        // specifics support
        public Specifics Specs()
        {
            Specifics specs = new Specifics();

            specs.Add("bonus", "firm-ground");
            specs.Add("EC/s", Lib.HumanReadableRate(ec_rate));
            specs.Add("deployable", deploy.Length > 0 ? "yes" : "no");
            return(specs);
        }
        /**
         * Construct a new graph. The graph can either be directed or undirected, depending on the
         * specified edge factory.
         *
         * @param ef the edge factory of the new graph.
         * @param directed if true the graph will be directed, otherwise undirected
         * @param allowMultipleEdges whether to allow multiple edges or not.
         * @param allowLoops whether to allow edges that are self-loops or not.
         * @param weighted whether the graph is weighted, i.e. the edges support a weight attribute
         *
         * @throws NullPointerException if the specified edge factory is <code>
         * null</code>.
         */
        protected AbstractBaseGraph(
            EdgeFactory <V, E> ef, bool directed, bool allowMultipleEdges, bool allowLoops,
            bool weighted)
        {
            Contract.Requires(ef != null);

            this.edgeFactory           = ef;
            this.allowingLoops         = allowLoops;
            this.allowingMultipleEdges = allowMultipleEdges;
            this.directed = directed;
            this.weighted = weighted;

            this.specifics = createSpecifics(directed);
            Contract.Requires(specifics != null);

            this.intrusiveEdgesSpecifics = createIntrusiveEdgesSpecifics(weighted);
            Contract.Requires(intrusiveEdgesSpecifics != null);
        }
        // specifics support
        public Specifics Specs()
        {
            var specs = new Specifics();

            specs.Add("Name", ResearchAndDevelopment.GetExperiment(experiment).experimentTitle);
            specs.Add("Data rate", Lib.HumanReadableDataRate(data_rate));
            specs.Add("EC required", Lib.HumanReadableRate(ec_rate));
            if (crew.Length > 0)
            {
                specs.Add("Operator", new CrewSpecs(crew).Info());
            }
            specs.Add(string.Empty);
            specs.Add("<color=#00ffff>Situations:</color>", string.Empty);
            var tokens = Lib.Tokenize(situations, ',');

            foreach (string s in tokens)
            {
                specs.Add(Lib.BuildString("• <b>", s, "</b>"));
            }
            return(specs);
        }
示例#5
0
        /// <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");
            }
        }
示例#6
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> 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> 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;
		}