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); }
/// <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)); }
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")); }
/// /// <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); }
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); } } }
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); } } }
// // * (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)); }