/// /// <summary> * does this ColorPool have Color elements with identical Name or RawName /// * eattributes return false if no Color elements with identical Name or /// * RawName tags exist </summary> /// public virtual VString getDuplicateColors() { VElement v = getChildElementVector(ElementName.COLOR, null, null, true, 0, false); SupportClass.HashSetSupport <string> vName = new SupportClass.HashSetSupport <string>(); int nCols = v.Count; VString vRet = new VString(); for (int i = 0; i < nCols; i++) { JDFColor color = (JDFColor)v[i]; string colorName = color.getName(); if (vName.Contains(colorName)) { vRet.appendUnique(colorName); } string rawName = color.get8BitName(); if (vName.Contains(rawName)) { vRet.appendUnique(colorName); } vName.Add(colorName); vName.Add(rawName); } return(vRet.Count == 0 ? null : vRet); }
/// <summary> Finds a 2-approximation for a minimal vertex cover of the specified /// graph. The algorithm promises a cover that is at most double the size /// of a minimal cover. The algorithm takes O(|E|) time. /// /// <p> /// For more details see Jenny Walter, CMPU-240: Lecture notes for Language /// Theory and Computation, Fall 2002, Vassar College, <a /// href="http://www.cs.vassar.edu/~walter/cs241index/lectures/PDF/approx.pdf"> /// /// http://www.cs.vassar.edu/~walter/cs241index/lectures/PDF/approx.pdf</a>. /// </p> /// /// </summary> /// <param name="g">the graph for which vertex cover approximation is to be found. /// /// </param> /// <returns> a set of vertices which is a vertex cover for the specified /// graph. /// </returns> public virtual SupportClass.SetSupport find2ApproximationCover(Graph g) { // C <-- {} //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.SetSupport cover = new SupportClass.HashSetSupport(); // G'=(V',E') <-- G(V,E) Subgraph sg = new Subgraph(g, null, null); // while E' is non-empty while (sg.edgeSet().Count > 0) { // let (u,v) be an arbitrary edge of E' //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'" Edge e = (Edge)sg.edgeSet().GetEnumerator().Current; // C <-- C U {u,v} System.Object u = e.Source; System.Object v = e.Target; cover.Add(u); cover.Add(v); // remove from E' every edge incident on either u or v sg.removeVertex(u); sg.removeVertex(v); } return(cover); // return C }
/// <summary> Populates the given Segment object with data from the given XML Element.</summary> /// <throws> HL7Exception if the XML Element does not have the correct name and structure </throws> /// <summary> for the given Segment, or if there is an error while setting individual field values. /// </summary> public virtual void parse(Segment segmentObject, System.Xml.XmlElement segmentElement) { SupportClass.HashSetSupport done = new SupportClass.HashSetSupport(); System.Xml.XmlNodeList all = segmentElement.ChildNodes; for (int i = 0; i < all.Count; i++) { System.String elementName = all.Item(i).Name; if (System.Convert.ToInt16(all.Item(i).NodeType) == (short)System.Xml.XmlNodeType.Element && !done.Contains(elementName)) { done.Add(elementName); int index = elementName.IndexOf('.'); if (index >= 0 && elementName.Length > index) { //properly formatted element System.String fieldNumString = elementName.Substring(index + 1); int fieldNum = System.Int32.Parse(fieldNumString); parseReps(segmentObject, segmentElement, elementName, fieldNum); } else { } } } //set data type of OBX-5 if (segmentObject.GetType().FullName.IndexOf("OBX") >= 0) { Varies.fixOBX5(segmentObject, Factory); } }
/// <summary> Finds a greedy approximation for a minimal vertex cover of a specified /// graph. At each iteration, the algorithm picks the vertex with the /// highest degree and adds it to the cover, until all edges are covered. /// /// <p> /// The algorithm works on undirected graphs, but can also work on directed /// graphs when their edge-directions are ignored. To ignore edge /// directions you can use {@link /// org._3pq.jgrapht.GraphHelper#undirectedGraph(Graph)} or {@link /// org._3pq.jgrapht.graph.AsUndirectedGraph}. /// </p> /// /// </summary> /// <param name="g">the graph for which vertex cover approximation is to be found. /// /// </param> /// <returns> a set of vertices which is a vertex cover for the specified /// graph. /// </returns> public virtual SupportClass.SetSupport findGreedyCover(UndirectedGraph g) { // C <-- {} //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.SetSupport cover = new SupportClass.HashSetSupport(); // G' <-- G UndirectedGraph sg = new UndirectedSubgraph(g, null, null); // compare vertices in descending order of degree VertexDegreeComparator comp = new VertexDegreeComparator(sg); // while G' != {} while (sg.edgeSet().Count > 0) { // v <-- vertex with maximum degree in G' System.Object v = SupportClass.CollectionsSupport.Max(sg.vertexSet(), comp); // C <-- C U {v} cover.Add(v); // remove from G' every edge incident on v, and v itself sg.removeVertex(v); } return(cover); }
private void initMyArgs(string[] argv, string strSwitchParameter, string strArgumentParameter, string strRequiredParameter) { string[] argvLocal = argv; if (argvLocal == null) { argvLocal = new string[0]; } m_switchParameterString = strSwitchParameter; m_argumentParameterString = strArgumentParameter; m_requiredParameterString = strRequiredParameter; m_argV = new VString(argvLocal); m_onlyArgs = new VString(); // cut of the "-" from the options, but don't remove it from file names for (int i = 0; i < argvLocal.Length; i++) { string tempString = argvLocal[i]; if (tempString.StartsWith("-")) { string whazzLeft = tempString.Substring(1); while (whazzLeft.Length > 0) { string flag = whazzLeft.Substring(0, 1); if (m_switchParameterString != null && m_switchParameterString.IndexOf(flag) >= 0) { m_flags.Add(flag); whazzLeft = whazzLeft.Substring(1); } else if (m_argumentParameterString != null && m_argumentParameterString.IndexOf(flag) >= 0) { string wl2 = whazzLeft.Substring(1); if (wl2.Length == 0 && argvLocal.Length > i + 1) { wl2 = argvLocal[i + 1]; i++; } m_Parameters.Add(flag, wl2); whazzLeft = ""; } else { // oops... don't know it; skip it whazzLeft = whazzLeft.Substring(1); if (!flag.Equals("-")) { Console.WriteLine("unknown flag:" + flag); } } } } else { m_onlyArgs.Add(tempString); } } }
/// <summary> Calls <code>loadProperties()</code> if it has not been called before for /// the given file. If the given property file has already been loaded, this /// method does nothing. /// </summary> public static void loadOnce(System.String propertyFileName) { if (!files.Contains(propertyFileName)) { loadProperties(propertyFileName); files.Add(propertyFileName); } }
public virtual void testReduceMapSet() { JDFAttributeMap m1 = new JDFAttributeMap("a1", "v1"); m1.put("a2", "v2"); JDFAttributeMap m2 = new JDFAttributeMap("a1", "v1"); SupportClass.HashSetSupport <string> keys = new SupportClass.HashSetSupport <string>(); keys.Add("a1"); m1.reduceMap(keys); Assert.AreEqual(m1, m2); }
/// /// <summary> * create a HashSet from a List (Vector...) </summary> /// * @param <a> the data typeof the sets /// * </param> /// * <param name="list"> </param> /// * <returns> a Set created from list </returns> /// public static SupportClass.SetSupport <a> toHashSet <a>(List <a> list) { if (list == null) { return(null); } SupportClass.SetSupport <a> s = new SupportClass.HashSetSupport <a>(); for (int i = 0; i < list.Count; i++) { s.Add(list[i]); } return(s); }
/// /// <summary> * create a HashSet from an Array </summary> /// * @param <a> the data typeof the sets /// * </param> /// * <param name="l"> </param> /// * <returns> a Set created from list </returns> /// public static SupportClass.SetSupport <a> toHashSet <a>(a[] l) { if (l == null) { return(null); } SupportClass.SetSupport <a> s = new SupportClass.HashSetSupport <a>(); for (int i = 0; i < l.Length; i++) { s.Add(l[i]); } return(s); }
/// /// <summary> * gets a set with all entries of the Vstring /// * @return </summary> /// public virtual SupportClass.SetSupport <string> getSet() { // Java to C# Conversion - QUESTION: Need to implement LinkedHashSet? SupportClass.HashSetSupport <string> @set = new SupportClass.HashSetSupport <string>(); // new LinkedHashSet<string>(); IEnumerator <string> it = GetEnumerator(); while (it.MoveNext()) { @set.Add(it.Current); } return(@set); }
public virtual void testUniqueID() { // Java to C# Conversion, Test taking too long, reduce count from original 200,000 for now SupportClass.HashSetSupport m = new SupportClass.HashSetSupport(); for (int i = 0; i < 1000; i++) { string s = JDFElement.uniqueID(0); if (m.Contains(s)) { Assert.Fail("oops"); } m.Add(s); } }
/// <summary> Populates the given Segment object with data from the given XML Element. </summary> /// <summary> for the given Segment, or if there is an error while setting individual field /// values. </summary> /// /// <param name="segmentObject"> The segment object. </param> /// <param name="segmentElement"> Element describing the segment. </param> public virtual void Parse(ISegment segmentObject, System.Xml.XmlElement segmentElement) { SupportClass.HashSetSupport done = new SupportClass.HashSetSupport(); // for (int i = 1; i <= segmentObject.NumFields(); i++) { // String elementName = makeElementName(segmentObject, i); // done.add(elementName); // parseReps(segmentObject, segmentElement, elementName, i); // } System.Xml.XmlNodeList all = segmentElement.ChildNodes; for (int i = 0; i < all.Count; i++) { System.String elementName = all.Item(i).Name; if (System.Convert.ToInt16(all.Item(i).NodeType) == (short)System.Xml.XmlNodeType.Element && !done.Contains(elementName)) { done.Add(elementName); int index = elementName.IndexOf('.'); if (index >= 0 && elementName.Length > index) { //properly formatted element System.String fieldNumString = elementName.Substring(index + 1); int fieldNum = System.Int32.Parse(fieldNumString); this.ParseReps(segmentObject, segmentElement, elementName, fieldNum); } else { log.Debug( "Child of segment " + segmentObject.GetStructureName() + " doesn't look like a field: " + elementName); } } } //set data type of OBX-5 if (segmentObject.GetType().FullName.IndexOf("OBX") >= 0) { Varies.fixOBX5(segmentObject, this.Factory); } }
/// /// <summary> * unify - make VElement unique, retaining initial order </summary> /// public virtual void unify() { SupportClass.HashSetSupport @set = new SupportClass.HashSetSupport(); int size = Count; for (int i = 0; i < size; i++) { KElement e = this.item(i); if (@set.Contains(e)) { this.RemoveAt(i); i--; size--; } else { @set.Add(e); } } }
/// /// <summary> * unify - make VString unique, retaining initial order </summary> /// public virtual void unify() { SupportClass.HashSetSupport <string> @set = new SupportClass.HashSetSupport <string>(); int size = Count; for (int i = 0; i < size; i++) { string s = this.stringAt(i); if (@set.Contains(s)) { this.RemoveAt(i); i--; size--; } else { @set.Add(s); } } }
/// <summary> Populates the given Segment object with data from the given XML Element.</summary> /// <throws> HL7Exception if the XML Element does not have the correct name and structure </throws> /// <summary> for the given Segment, or if there is an error while setting individual field values. /// </summary> public virtual void parse(Segment segmentObject, System.Xml.XmlElement segmentElement) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.HashSetSupport done = new SupportClass.HashSetSupport(); // for (int i = 1; i <= segmentObject.numFields(); i++) { // String elementName = makeElementName(segmentObject, i); // done.add(elementName); // parseReps(segmentObject, segmentElement, elementName, i); // } //UPGRADE_TODO: Method 'org.w3c.dom.Node.getChildNodes' was converted to 'System.Xml.XmlNode.ChildNodes' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" System.Xml.XmlNodeList all = segmentElement.ChildNodes; for (int i = 0; i < all.Count; i++) { System.String elementName = all.Item(i).Name; if (System.Convert.ToInt16(all.Item(i).NodeType) == (short)System.Xml.XmlNodeType.Element && !done.Contains(elementName)) { done.Add(elementName); int index = elementName.IndexOf('.'); if (index >= 0 && elementName.Length > index) { //properly formatted element System.String fieldNumString = elementName.Substring(index + 1); int fieldNum = System.Int32.Parse(fieldNumString); parseReps(segmentObject, segmentElement, elementName, fieldNum); } else { log.debug("Child of segment " + segmentObject.getStructureName() + " doesn't look like a field: " + elementName); } } } //set data type of OBX-5 if (segmentObject.GetType().FullName.IndexOf("OBX") >= 0) { Varies.fixOBX5(segmentObject, Factory); } }
/// <summary> Populates the given Segment object with data from the given XML Element.</summary> /// <throws> HL7Exception if the XML Element does not have the correct name and structure. </throws> /// <summary> for the given Segment, or if there is an error while setting individual field values. /// </summary> public virtual void Parse(ISegment segmentObject, XmlElement segmentElement, ParserOptions parserOptions) { parserOptions = parserOptions ?? DefaultParserOptions; var done = new SupportClass.HashSetSupport(); // for (int i = 1; i <= segmentObject.NumFields(); i++) { // String elementName = makeElementName(segmentObject, i); // done.add(elementName); // parseReps(segmentObject, segmentElement, elementName, i); // } var all = segmentElement.ChildNodes; for (var i = 0; i < all.Count; i++) { var elementName = all.Item(i).Name; if (Convert.ToInt16(all.Item(i).NodeType) == (short)XmlNodeType.Element && !done.Contains(elementName)) { done.Add(elementName); var index = elementName.IndexOf('.'); if (index >= 0 && elementName.Length > index) { // properly formatted element var fieldNumString = elementName.Substring(index + 1); var fieldNum = int.Parse(fieldNumString); ParseReps(segmentObject, segmentElement, elementName, fieldNum); } else { Log.Debug("Child of segment " + segmentObject.GetStructureName() + " doesn't look like a field: " + elementName); } } } // set data type of OBX-5 if (segmentObject.GetType().FullName.IndexOf("OBX") >= 0) { Varies.FixOBX5(segmentObject, Factory, parserOptions); } }
/// /// <summary> * get the list of QueueEntryDef/@QueueEntryIDs strings as a set /// * </summary> /// * <returns> the set of QueueEntryIDs, null if no QueueEntryDef is specified </returns> /// public virtual SupportClass.SetSupport <string> getQueueEntryDefSet() { SupportClass.HashSetSupport <string> @set = null; VElement v = getChildElementVector(ElementName.QUEUEENTRYDEF, null); if (v != null) { int siz = v.Count; @set = siz == 0 ? null : new SupportClass.HashSetSupport <string>(); for (int i = 0; i < siz; i++) { string qeid = ((JDFQueueEntryDef)v[i]).getQueueEntryID(); if (!isWildCard(qeid)) { @set.Add(qeid); } } } return(@set != null && @set.Count > 0 ? @set : null); }
public virtual void testAppendAnchor() { JDFDoc doc = new JDFDoc("JDF"); JDFElement e = doc.getJDFRoot(); SupportClass.HashSetSupport m = new SupportClass.HashSetSupport(); KElement e2 = e.appendElement("e2"); // Java to C# Conversion - Divide number of tests by 1000 for now for (int i = 0; i < 10; i++) { JDFElement appendElement = (JDFElement)e2.appendElement("FooBar"); string s = appendElement.appendAnchor(null); if (m.Contains(s)) { Assert.Fail("oops"); } Assert.AreEqual(s, appendElement.getID()); Assert.IsTrue(s.IndexOf("..") < 0); m.Add(s); } }
/// <summary> Returns a set of all vertices that are in the maximally connected /// component together with the specified vertex. For more on maximally /// connected component, see <a /// href="http://www.nist.gov/dads/HTML/maximallyConnectedComponent.html"> /// http://www.nist.gov/dads/HTML/maximallyConnectedComponent.html</a>. /// /// </summary> /// <param name="vertex">the vertex for which the connected set to be returned. /// /// </param> /// <returns> a set of all vertices that are in the maximally connected /// component together with the specified vertex. /// </returns> public virtual SupportClass.SetSupport connectedSetOf(System.Object vertex) { SupportClass.SetSupport connectedSet = (SupportClass.SetSupport)m_vertexToConnectedSet[vertex]; if (connectedSet == null) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" connectedSet = new SupportClass.HashSetSupport(); BreadthFirstIterator i = new BreadthFirstIterator(m_graph, vertex); //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'" while (i.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'" connectedSet.Add(i.Current); } m_vertexToConnectedSet[vertex] = connectedSet; } return(connectedSet); }
/// <summary> Populates the given Segment object with data from the given XML Element.</summary> /// <throws> HL7Exception if the XML Element does not have the correct name and structure </throws> /// <summary> for the given Segment, or if there is an error while setting individual field values. /// </summary> public virtual void parse(Segment segmentObject, System.Xml.XmlElement segmentElement) { //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.HashSetSupport done = new SupportClass.HashSetSupport(); // for (int i = 1; i <= segmentObject.numFields(); i++) { // String elementName = makeElementName(segmentObject, i); // done.add(elementName); // parseReps(segmentObject, segmentElement, elementName, i); // } //UPGRADE_TODO: Method 'org.w3c.dom.Node.getChildNodes' was converted to 'System.Xml.XmlNode.ChildNodes' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073'" System.Xml.XmlNodeList all = segmentElement.ChildNodes; for (int i = 0; i < all.Count; i++) { System.String elementName = all.Item(i).Name; if (System.Convert.ToInt16(all.Item(i).NodeType) == (short) System.Xml.XmlNodeType.Element && !done.Contains(elementName)) { done.Add(elementName); int index = elementName.IndexOf('.'); if (index >= 0 && elementName.Length > index) { //properly formatted element System.String fieldNumString = elementName.Substring(index + 1); int fieldNum = System.Int32.Parse(fieldNumString); parseReps(segmentObject, segmentElement, elementName, fieldNum); } else { log.debug("Child of segment " + segmentObject.getStructureName() + " doesn't look like a field: " + elementName); } } } //set data type of OBX-5 if (segmentObject.GetType().FullName.IndexOf("OBX") >= 0) { Varies.fixOBX5(segmentObject, Factory); } }
/// <summary> Populates the given Segment object with data from the given XML Element.</summary> /// <throws> HL7Exception if the XML Element does not have the correct name and structure </throws> /// <summary> for the given Segment, or if there is an error while setting individual field values. /// </summary> public virtual void parse(Segment segmentObject, System.Xml.XmlElement segmentElement) { SupportClass.HashSetSupport done = new SupportClass.HashSetSupport(); System.Xml.XmlNodeList all = segmentElement.ChildNodes; for (int i = 0; i < all.Count; i++) { System.String elementName = all.Item(i).Name; if (System.Convert.ToInt16(all.Item(i).NodeType) == (short) System.Xml.XmlNodeType.Element && !done.Contains(elementName)) { done.Add(elementName); int index = elementName.IndexOf('.'); if (index >= 0 && elementName.Length > index) { //properly formatted element System.String fieldNumString = elementName.Substring(index + 1); int fieldNum = System.Int32.Parse(fieldNumString); parseReps(segmentObject, segmentElement, elementName, fieldNum); } else { } } } //set data type of OBX-5 if (segmentObject.GetType().FullName.IndexOf("OBX") >= 0) { Varies.fixOBX5(segmentObject, Factory); } }
public virtual void export(Movie m) { // define the header Header h = new Header(); h.version = m.version; h.compressed = Header.useCompression(m.version); h.size = m.size; h.rate = m.framerate; handler.header(h); // movie-wide tags if (m.fileAttributes != null) { if (m.metadata != null) { m.fileAttributes.hasMetadata = true; } m.fileAttributes.visit(handler); // FileAttributes MUST be first tag after header! } if (m.metadata != null) { m.metadata.visit(handler); } if (m.enableDebugger != null) { m.enableDebugger.visit(handler); } if (m.uuid != null) { new DebugID(m.uuid).visit(handler); } if (m.protect != null) { m.protect.visit(handler); } if (m.scriptLimits != null) { m.scriptLimits.visit(handler); } if (m.bgcolor != null) { m.bgcolor.visit(handler); } if (m.productInfo != null) { m.productInfo.visit(handler); } if (m.sceneAndFrameLabelData != null) { m.sceneAndFrameLabelData.visit(handler); } // finally, output the frames bool associateRootClass = (m.topLevelClass != null); //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 = m.frames.GetEnumerator(); i.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'" Frame frame = (Frame)i.Current; if (frame.label != null) { frame.label.visit(handler); } if (!(frame.imports.Count == 0)) { //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 j = frame.imports.GetEnumerator(); j.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'" ImportAssets importAssets = (ImportAssets)j.Current; importAssets.visit(handler); } } // definitions needed in this frame //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 j = frame.References; j.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'" DefineTag ref_Renamed = (DefineTag)j.Current; define(ref_Renamed); } // exports if (frame.hasExports()) { ExportAssets exportAssets = new ExportAssets(); //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 j = frame.exportIterator(); j.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'" DefineTag tag = (DefineTag)j.Current; exportAssets.exports.Add(tag); } exportAssets.visit(handler); } // TODO: Review this... temporarily special casing fonts here as they should not be // included in ExportAssets as they are not required to be exported by name! // fonts if (frame.hasFonts()) { //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 k = frame.fontsIterator(); k.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'" DefineFont tag = (DefineFont)k.Current; // We may have already visited this font because of symbolClasses. if (!done.Contains(tag)) { tag.visit(handler); done.Add(tag); } } } // abc tags //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 j = frame.doABCs.GetEnumerator(); j.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'" Tag tag = (Tag)j.Current; tag.visit(handler); } SymbolClass classes = new SymbolClass(); if (frame.hasSymbolClasses()) { SupportClass.MapSupport.PutAll(classes.class2tag, frame.symbolClass.class2tag); } if (associateRootClass) { // only works on frame 1 classes.topLevelClass = m.topLevelClass; // Why do we do this on every frame's symclass? } if (associateRootClass || frame.hasSymbolClasses()) { classes.visit(handler); } associateRootClass = false; // control tags //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 j = frame.controlTags.GetEnumerator(); j.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'" Tag tag = (Tag)j.Current; tag.visit(handler); } // then frame actions //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 j = frame.doActions.GetEnumerator(); j.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'" ActionList list = (ActionList)j.Current; new DoAction(list).visit(handler); } // oh yeah, then showFrame! new ShowFrame().visit(handler); } handler.finish(); }
/// /// * <param name="testRoot"> </param> /// * <param name="testlists"> </param> /// * <param name="level"> </param> /// * <param name="mrp"> </param> /// * <param name="irp"> </param> /// * <param name="resLinkPool"> </param> /// * <param name="goodElems"> </param> /// * <param name="badElems"> </param> /// * <param name="devCaps"> /// * @return </param> /// public virtual void analyzeDevCaps(KElement testRoot, EnumFitsValue testlists, EnumValidationLevel level, KElement mrp, KElement irp, SupportClass.HashSetSupport goodElems, Hashtable badElems, bool ignoreExtensions) { EnumAvailability av = getModuleAvailability(); KElement xpathRoot = testRoot; VElement vElemResources = null; if (testRoot is JDFNode) { JDFNode jdfNode = (JDFNode)testRoot; vElemResources = getMatchingElementsFromNode(jdfNode); xpathRoot = jdfNode.getResourceLinkPool(); if (xpathRoot == null) { xpathRoot = testRoot; } } else { vElemResources = getMatchingElementsFromJMF((JDFMessage)testRoot); } int svElemResources = vElemResources == null ? 0 : vElemResources.Count; EnumContext context = getContext(); KElement r = null; if (EnumValidationLevel.isRequired(level) && svElemResources < getMinOccurs() && EnumAvailability.Installed.Equals(av)) { if (EnumContext.Element.Equals(context) || EnumContext.JMF.Equals(context)) { r = mrp.appendElement("MissingElement"); r.setAttribute("XPath", xpathRoot.buildXPath(null, 1) + "/" + getName()); } else { EnumUsage linkUsage = getLinkUsage(); string procUsage = getProcessUsage(); r = mrp.appendElement("MissingResourceLink"); if (linkUsage != null) { r.setAttribute("Usage", linkUsage.getName()); } if (procUsage != null && procUsage.Length > 0) { r.setAttribute("ProcessUsage", procUsage); } r.setAttribute("XPath", xpathRoot.buildXPath(null, 1) + "/" + getName()); } r.setAttribute("Name", getName()); r.setAttribute("CapXPath", getName()); r.setAttribute("Occurrences", svElemResources, null); r.setAttribute("MinOccurs", getMinOccurs(), null); } else if (svElemResources > getMaxOccurs() || !EnumAvailability.Installed.Equals(av)) { if (context.Equals(EnumContext.Element) || context.Equals(EnumContext.JMF)) { r = irp.appendElement("ManyElement"); r.setAttribute("XPath", testRoot.buildXPath(null, 1) + "/" + getName()); } else { EnumUsage linkUsage = getLinkUsage(); string procUsage = getProcessUsage(); r = irp.appendElement("ManyResourceLink"); if (linkUsage != null) { r.setAttribute("Usage", linkUsage.getName()); } if (procUsage != null && procUsage.Length > 0) { r.setAttribute("ProcessUsage", procUsage); } r.setAttribute("XPath", xpathRoot.buildXPath(null, 1) + "/" + getName()); } r.setAttribute("Name", getName()); r.setAttribute("CapXPath", getName()); r.setAttribute("Occurrences", svElemResources, null); r.setAttribute("MaxOccurs", getMaxOccurs(), null); r.setAttribute("Availability", av == null ? "None" : av.getName()); } if (vElemResources != null) { for (int j = 0; j < svElemResources; j++) { KElement elem = vElemResources.item(j); if (!goodElems.Contains(elem)) { KElement report = devCapReport(elem, testlists, level, ignoreExtensions, irp); // InvalidResources if (report == null) { goodElems.Add(elem); KElement badReport = (KElement)badElems[elem]; if (badReport != null) { badReport.deleteNode(); } } else { badElems.Add(elem, report); } } } } }
/// <summary> Finds a 2-approximation for a minimal vertex cover of the specified /// graph. The algorithm promises a cover that is at most double the size /// of a minimal cover. The algorithm takes O(|E|) time. /// /// <p> /// For more details see Jenny Walter, CMPU-240: Lecture notes for Language /// Theory and Computation, Fall 2002, Vassar College, <a /// href="http://www.cs.vassar.edu/~walter/cs241index/lectures/PDF/approx.pdf"> /// /// http://www.cs.vassar.edu/~walter/cs241index/lectures/PDF/approx.pdf</a>. /// </p> /// /// </summary> /// <param name="g">the graph for which vertex cover approximation is to be found. /// /// </param> /// <returns> a set of vertices which is a vertex cover for the specified /// graph. /// </returns> public virtual SupportClass.SetSupport find2ApproximationCover(Graph g) { // C <-- {} //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.SetSupport cover = new SupportClass.HashSetSupport(); // G'=(V',E') <-- G(V,E) Subgraph sg = new Subgraph(g, null, null); // while E' is non-empty while (sg.edgeSet().Count > 0) { // let (u,v) be an arbitrary edge of E' //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'" Edge e = (Edge) sg.edgeSet().GetEnumerator().Current; // C <-- C U {u,v} System.Object u = e.Source; System.Object v = e.Target; cover.Add(u); cover.Add(v); // remove from E' every edge incident on either u or v sg.removeVertex(u); sg.removeVertex(v); } return cover; // return C }
/// <summary> Finds a greedy approximation for a minimal vertex cover of a specified /// graph. At each iteration, the algorithm picks the vertex with the /// highest degree and adds it to the cover, until all edges are covered. /// /// <p> /// The algorithm works on undirected graphs, but can also work on directed /// graphs when their edge-directions are ignored. To ignore edge /// directions you can use {@link /// org._3pq.jgrapht.GraphHelper#undirectedGraph(Graph)} or {@link /// org._3pq.jgrapht.graph.AsUndirectedGraph}. /// </p> /// /// </summary> /// <param name="g">the graph for which vertex cover approximation is to be found. /// /// </param> /// <returns> a set of vertices which is a vertex cover for the specified /// graph. /// </returns> public virtual SupportClass.SetSupport findGreedyCover(UndirectedGraph g) { // C <-- {} //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.SetSupport cover = new SupportClass.HashSetSupport(); // G' <-- G UndirectedGraph sg = new UndirectedSubgraph(g, null, null); // compare vertices in descending order of degree VertexDegreeComparator comp = new VertexDegreeComparator(sg); // while G' != {} while (sg.edgeSet().Count > 0) { // v <-- vertex with maximum degree in G' System.Object v = SupportClass.CollectionsSupport.Max(sg.vertexSet(), comp); // C <-- C U {v} cover.Add(v); // remove from G' every edge incident on v, and v itself sg.removeVertex(v); } return cover; }
/// <summary> Checks whether the specified Macintosh web browser is currently /// running. You should only call this function if you have already /// checked that you are running on a Mac. /// /// </summary> /// <param name="browserName">a name, e.g. "Safari", "Firefox", "Camino" /// </param> /// <returns> true if currently running /// </returns> private SupportClass.SetSupport runningApplications() { String running = executeAppleScript(new String[]{"tell application \"System Events\"", " name of processes", "end tell"}, null); String[] apps = running.split(", "); //$NON-NLS-1$ //UPGRADE_TODO: Class 'java.util.HashSet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashSet'" SupportClass.SetSupport retval = new SupportClass.HashSetSupport(); for (int i = 0; i < apps.Length; ++i) retval.Add(apps[i]); return retval; }