예제 #1
0
 public virtual void testToHashSetArray()
 {
     string[] a = { "a", "b" };
     SupportClass.SetSupport <string> s = ContainerUtil.toHashSet(a);
     Assert.IsTrue(s.Contains("a"));
     Assert.IsTrue(s.Contains("b"));
     Assert.IsFalse(s.Contains("c"));
     Assert.AreEqual(s.Count, a.Length);
 }
예제 #2
0
        /// <summary> Tests if there is a path from the specified source vertex to the
        /// specified target vertices. For a directed graph, direction is ignored
        /// for this interpretation of path.
        ///
        /// <p>
        /// Note: Future versions of this method might not ignore edge directions
        /// for directed graphs.
        /// </p>
        ///
        /// </summary>
        /// <param name="sourceVertex">one end of the path.
        /// </param>
        /// <param name="targetVertex">another end of the path.
        ///
        /// </param>
        /// <returns> <code>true</code> if and only if there is a path from the source
        /// vertex to the target vertex.
        /// </returns>
        public virtual bool pathExists(System.Object sourceVertex, System.Object targetVertex)
        {
            /*
             * TODO: Ignoring edge direction for directed graph may be
             * confusing. For directed graphs, consider Dijkstra's algorithm.
             */
            SupportClass.SetSupport sourceSet = connectedSetOf(sourceVertex);

            return(sourceSet.Contains(targetVertex));
        }
예제 #3
0
        public virtual void testGetSet()
        {
            VString v = new VString();

            v.Add("a");
            v.Add("c");
            v.Add("b");
            SupportClass.SetSupport <string> s = v.getSet();
            Assert.AreEqual(v.Count, s.Count);
            Assert.IsTrue(s.Contains("c"));
        }
예제 #4
0
        ///
        ///	 <summary> * return true if the queuentry matches this filter
        ///	 *
        ///	 * @return </summary>
        ///
        public virtual bool matches(JDFQueueEntry qe)
        {
            if (qe == null)
            {
                return(false);
            }

            if (EnumQueueEntryDetails.None.Equals(getQueueEntryDetails()))
            {
                return(false);
            }

            SupportClass.SetSupport <string> qeDefs = getQueueEntryDefSet();
            if (qeDefs != null && !qeDefs.Contains(qe.getQueueEntryID()))
            {
                return(false);
            }

            qeDefs = getDeviceIDSet();
            if (qeDefs != null && !qeDefs.Contains(qe.getDeviceID()))
            {
                return(false);
            }

            if (hasAttribute(AttributeName.GANGNAMES) && !getGangNames().Contains(qe.getGangName()))
            {
                return(false);
            }

            if (hasAttribute(AttributeName.STATUSLIST) && !getStatusList().Contains(qe.getQueueEntryStatus()))
            {
                return(false);
            }

            return(true);
        }
예제 #5
0
        private void  addVerticesUsingFilter(SupportClass.SetSupport vertexSet, SupportClass.SetSupport filter)
        {
            System.Object v;

            //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'"
            for (System.Collections.IEnumerator i = vertexSet.GetEnumerator(); i.MoveNext();)
            {
                v = ((DictionaryEntry)i.Current).Value;

                // note the use of short circuit evaluation
                if (filter == null || filter.Contains(v))
                {
                    addVertex(v);
                }
            }
        }
예제 #6
0
        private void  addEdgesUsingFilter(SupportClass.SetSupport edgeSet, SupportClass.SetSupport filter)
        {
            Edge e;
            bool containsVertices;
            bool edgeIncluded;

            //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'"
            for (System.Collections.IEnumerator i = edgeSet.GetEnumerator(); i.MoveNext();)
            {
                e = (Edge)((DictionaryEntry)i.Current).Value;

                containsVertices = containsVertex(e.Source) && containsVertex(e.Target);

                // note the use of short circuit evaluation
                edgeIncluded = (filter == null) || filter.Contains(e);

                if (containsVertices && edgeIncluded)
                {
                    addEdge(e);
                }
            }
        }
예제 #7
0
파일: FileUtil.cs 프로젝트: cip4/JDFLibNet
            //
            //		 * (non-Javadoc)
            //		 *
            //		 * @see java.io.FileFilter#accept(java.io.File)
            //
            public virtual bool accept(FileInfo checkFile)
            {
                if ((checkFile == null) || !checkFile.Exists)
                {
                    return(false);
                }
                if (m_extension == null)
                {
                    return(true);
                }
                string xt = UrlUtil.extension(checkFile.FullName);

                if (xt == null)
                {
                    xt = "";
                }
                else
                {
                    xt = xt.ToLower();
                }

                return(m_extension.Contains(xt));
            }