Esempio n. 1
0
        private void  cleanReservedMessages()
        {
            lock (this)
            {
                System.Collections.IEnumerator it     = new SupportClass.HashSetSupport(myAvailableMessages.Keys).GetEnumerator();
                System.Collections.IList       remove = new System.Collections.ArrayList();
                while (it.MoveNext())
                {
                    System.String         ackId = (System.String)it.Current;
                    ExpiringTransportable et    = (ExpiringTransportable)myAvailableMessages[ackId];
                    if ((System.DateTime.Now.Ticks - 621355968000000000) / 10000 > et.expiryTime)
                    {
                        //myAvailableMessages.Remove(it.Current);
                        remove.Add(it.Current);

                        //send to an Application
                        NuGenTransportable out_Renamed = myContext.Router.processMessage(et.transportable);
                        sendAppResponse(out_Renamed);
                    }

                    foreach (object item in remove)
                    {
                        myAvailableMessages.Remove(item);
                    }
                }
            }
        }
 public override string ToString()
 {
     var builder = new StringBuilder();
     System.Collections.IEnumerator keyIterator = new SupportClass.HashSetSupport(table.Keys).GetEnumerator();
     while (keyIterator.MoveNext())
     {
         var key = (QName) keyIterator.Current;
         builder.Append("Dictionary: Global");
         builder.Append(key).Append("=").Append(table[key]).Append("\n");
     }
     return builder.ToString();
 }
Esempio n. 3
0
        public override string ToString()
        {
            var builder = new StringBuilder();

            System.Collections.IEnumerator keyIterator = new SupportClass.HashSetSupport(table.Keys).GetEnumerator();
            while (keyIterator.MoveNext())
            {
                var key = (QName)keyIterator.Current;
                builder.Append("Dictionary: Global");
                builder.Append(key).Append("=").Append(table[key]).Append("\n");
            }
            return(builder.ToString());
        }
 public override string ToString()
 {
     var builder = new StringBuilder();
     foreach (QName type in dictionary.Keys)
     {
         builder.Append("Dictionary: Type=" + type);
         System.Collections.IDictionary templateMap = dictionary[type];
         System.Collections.IEnumerator keyIterator = new SupportClass.HashSetSupport(templateMap.Keys).GetEnumerator();
         while (keyIterator.MoveNext())
         {
             System.Object key = keyIterator.Current;
             builder.Append(key).Append("=").Append(templateMap[key]).Append("\n");
         }
     }
     return builder.ToString();
 }
Esempio n. 5
0
        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        public static bool hashMapEquals(System.Collections.Hashtable a, System.Collections.Hashtable b)
        {
            if (a.Count != b.Count)
            {
                return(false);
            }
            else if (a is OrderedMap != b is OrderedMap)
            {
                return(false);
            }
            else
            {
                for (Object keyA: a.keySet())
                {
                    //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                    if (!equals(a[keyA], b[keyA]))
                    {
                        return(false);
                    }
                }

                if (a is OrderedMap && b is OrderedMap)
                {
                    //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'"
                    System.Collections.IEnumerator ea = new SupportClass.HashSetSupport(a.Keys).GetEnumerator();
                    //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'"
                    System.Collections.IEnumerator eb = new SupportClass.HashSetSupport(b.Keys).GetEnumerator();

                    //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 (ea.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'"
                        System.Object keyA = ea.Current;
                        //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'"
                        System.Object keyB = eb.Current;

                        if (!keyA.Equals(keyB))
                        {
                            //must use built-in equals for keys, as that's what HashMap uses
                            return(false);
                        }
                    }
                }

                return(true);
            }
        }
        public override string ToString()
        {
            var builder = new StringBuilder();

            foreach (QName type in dictionary.Keys)
            {
                builder.Append("Dictionary: Type=" + type);
                System.Collections.IDictionary templateMap = dictionary[type];
                System.Collections.IEnumerator keyIterator = new SupportClass.HashSetSupport(templateMap.Keys).GetEnumerator();
                while (keyIterator.MoveNext())
                {
                    System.Object key = keyIterator.Current;
                    builder.Append(key).Append("=").Append(templateMap[key]).Append("\n");
                }
            }
            return(builder.ToString());
        }
Esempio n. 7
0
        /// <summary>Closes the given connection & removes from hash - to be called when there are 0 references to it </summary>
        private void  close(NuGenConnection c)
        {
            c.close();

            //remove from "connections"
            System.Collections.IEnumerator keys = new SupportClass.HashSetSupport(connections.Keys).GetEnumerator();
            bool removed = false;

            while (keys.MoveNext() && !removed)
            {
                System.Object key = keys.Current;
                System.Object val = connections[key];
                if (val.GetHashCode() == c.GetHashCode())
                {
                    connections.Remove(key);
                    numRefs.Remove(key);
                    removed = true;
                }
            }
        }
Esempio n. 8
0
        /// <summary> Removes expired message reservations from the reservation list.  </summary>
        private void  cleanReservations()
        {
            lock (this)
            {
                System.Collections.IEnumerator it     = new SupportClass.HashSetSupport(myReservations.Keys).GetEnumerator();
                System.Collections.IList       remove = new System.Collections.ArrayList();
                while (it.MoveNext())
                {
                    System.String ackId  = (System.String)it.Current;
                    System.Int64  expiry = (System.Int64)myReservations[ackId];
                    if ((System.DateTime.Now.Ticks - 621355968000000000) / 10000 > (long)expiry)
                    {
                        //myReservations.Remove(it.Current);
                        remove.Add(it.Current);
                    }
                }

                foreach (object item in remove)
                {
                    myReservations.Remove(item);
                }
            }
        }
Esempio n. 9
0
        /// <summary> Discards expired accept acknowledgements (these are used in retry protocol; see send()).   </summary>
        private void  cleanAcceptAcks()
        {
            lock (this)
            {
                System.Collections.IEnumerator it     = new SupportClass.HashSetSupport(myAcceptAcks.Keys).GetEnumerator();
                System.Collections.IList       remove = new System.Collections.ArrayList();
                while (it.MoveNext())
                {
                    System.String         ackId = (System.String)it.Current;
                    ExpiringTransportable et    = (ExpiringTransportable)myAcceptAcks[ackId];
                    if ((System.DateTime.Now.Ticks - 621355968000000000) / 10000 > et.expiryTime)
                    {
                        //myAcceptAcks.Remove(it.Current);
                        remove.Add(it.Current);
                    }
                }

                foreach (object item in remove)
                {
                    myAcceptAcks.Remove(item);
                }
            }
        }
Esempio n. 10
0
        protected internal static PropertyValue[] ToPropertyValues(IDictionary properties)
        {
            PropertyValue[] propertyValues = new PropertyValue[properties.Count];
            int             i = 0;

            for (IEnumerator iter = new SupportClass.HashSetSupport(properties).GetEnumerator(); iter.MoveNext();)
            {
                if (iter.Current != null)
                {
                    DictionaryEntry entry        = (DictionaryEntry)iter.Current;
                    Object          valueRenamed = entry.Value;
                    var             renamed      = valueRenamed as IDictionary;
                    if (renamed != null)
                    {
                        // recursively Convert nested Map to PropertyValue[]
                        IDictionary subProperties = renamed;
                        valueRenamed = ToPropertyValues(subProperties);
                    }
                    propertyValues[i++] = Property((String)entry.Key, valueRenamed);
                }
            }
            return(propertyValues);
        }
Esempio n. 11
0
 private static void  setGroupSuccessors(System.Collections.IDictionary theSuccessors, System.String theSegName)
 {
     for (System.Collections.IEnumerator it = new SupportClass.HashSetSupport(theSuccessors.Keys).GetEnumerator(); it.MoveNext();)
     {
         StructRef from = (StructRef)it.Current;
         StructRef to   = (StructRef)theSuccessors[from];
         from.setSuccessor(theSegName, to);
     }
     theSuccessors.Clear();
 }
Esempio n. 12
0
        }         // end getGDSkey

        //UPGRADE_TODO: Class 'java.util.HashMap' was converted to 'System.Collections.Hashtable' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMap'"
        private void  checkGDSkeys(Grib1GridDefinitionSection gds, System.Collections.Hashtable gdsCounter)
        {
            // lat/lon grids can have > 1 GDSs
            if (gds.GridType == 0 || gds.GridType == 4)
            {
                return;
            }
            System.String bestKey = "";
            int           count   = 0;

            // find bestKey with the most counts
            //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'"
            //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 it = new SupportClass.HashSetSupport(gdsCounter.Keys).GetEnumerator(); it.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'"
                System.String key = (System.String)it.Current;
                //UPGRADE_TODO: Method 'java.util.HashMap.get' was converted to 'System.Collections.Hashtable.Item' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapget_javalangObject'"
                int gdsCount = System.Int32.Parse((System.String)gdsCounter[key]);
                if (gdsCount > count)
                {
                    count   = gdsCount;
                    bestKey = key;
                }
            }
            // remove best key from gdsCounter, others will be removed from gdsHM
            gdsCounter.Remove(bestKey);
            // remove all GDSs using the gdsCounter
            //UPGRADE_TODO: Method 'java.util.HashMap.keySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilHashMapkeySet'"
            //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 it = new SupportClass.HashSetSupport(gdsCounter.Keys).GetEnumerator(); it.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'"
                System.String key = (System.String)it.Current;
                gdsHM.Remove(key);
            }
            // reset GDS keys in products too
            for (int i = 0; i < products.Count; i++)
            {
                Grib1Product g1p = (Grib1Product)products[i];
                g1p.GDSkey = bestKey;
            }
            return;
        }         // end checkGDSkeys
Esempio n. 13
0
		public override void  symbolClass(SymbolClass tag)
		{
			tagw.writeUI16(tag.class2tag.Count + (tag.topLevelClass != null?1:0));
			//UPGRADE_TODO: Method 'java.util.Map.entrySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilMapentrySet'"
			System.Collections.IEnumerator it = new SupportClass.HashSetSupport(tag.class2tag).GetEnumerator();
			//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 (it.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'"
				System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry) it.Current;
				System.String name = (System.String) e.Key;
				DefineTag ref_Renamed = (DefineTag) e.Value;
				
				int idref = dict.getId(ref_Renamed);
				tagw.writeUI16(idref);
				tagw.writeString(name);
			}
			if (tag.topLevelClass != null)
			{
				tagw.writeUI16(0);
				tagw.writeString(tag.topLevelClass);
			}
			encodeTag(tag);
		}
		/// <summary>Closes the given connection & removes from hash - to be called when there are 0 references to it </summary>
		private void  close(NuGenConnection c)
		{
			c.close();
			
			//remove from "connections"  
			System.Collections.IEnumerator keys = new SupportClass.HashSetSupport(connections.Keys).GetEnumerator();
			bool removed = false;
			while (keys.MoveNext() && !removed)
			{
				System.Object key = keys.Current;
				System.Object val = connections[key];
				if (val.GetHashCode() == c.GetHashCode())
				{
					connections.Remove(key);
					numRefs.Remove(key);
					removed = true;
				}
			}
		}
Esempio n. 15
0
		private static void  setGroupSuccessors(System.Collections.IDictionary theSuccessors, System.String theSegName)
		{
			for (System.Collections.IEnumerator it = new SupportClass.HashSetSupport(theSuccessors.Keys).GetEnumerator(); it.MoveNext(); )
			{
				StructRef from = (StructRef) it.Current;
				StructRef to = (StructRef) theSuccessors[from];
				from.setSuccessor(theSegName, to);
			}
			theSuccessors.Clear();
		}
Esempio n. 16
0
 /// <summary> Construct a JSONObject from a Map.
 /// 
 /// </summary>
 /// <param name="map">A map object that can be used to initialize the contents of
 /// the JSONObject.
 /// </param>
 /// <throws>  JSONException  </throws>
 public JSONObject(System.Collections.IDictionary map)
 {
     this.map = new System.Collections.Hashtable();
     if (map != null)
     {
         System.Collections.IEnumerator i = new SupportClass.HashSetSupport(map).GetEnumerator();
         while (i.MoveNext())
         {
             System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry)i.Current;
             this.map[e.Key] = wrap(e.Value);
         }
     }
 }
Esempio n. 17
0
		internal virtual StreamWriter traceFile()
		{
			if (m_trace == null)
			{
				m_trace = new StreamWriter("mm_debug_api_trace.txt", false, System.Text.Encoding.Default); //$NON-NLS-1$
				try
				{
					m_trace.Write(DateTime.Now.ToString("r"));
				}
				catch (Exception)
				{
					m_trace.Write("Date unknown");
				} //$NON-NLS-1$
				try
				{
					m_trace.Write(s_newline);
					
					// java properties dump
					System.Collections.Specialized.NameValueCollection props = SystemProperties.getProperties();

                    foreach (String value in props)
                    {
                        m_trace.WriteLine(value);
                    }
					
					m_trace.Write(s_newline);
					
					// property dump
					System.Collections.IEnumerator keys = new SupportClass.HashSetSupport(m_prefs.Keys).GetEnumerator();
					while (keys.MoveNext())
					{
						Object key = keys.Current;
						Object value = m_prefs[key];
						m_trace.Write(key.ToString());
						m_trace.Write(" = "); //$NON-NLS-1$
						m_trace.Write(value.ToString());
						m_trace.Write(s_newline);
					}
				}
				catch (Exception e)
				{
                    if (Trace.error)
                    {
                        Console.Error.Write(e.StackTrace);
                        Console.Error.Flush();
                    }
				}
				m_trace.Write(s_newline);
			}
			return m_trace;
		}
Esempio n. 18
0
		public override void  symbolClass(SymbolClass tag)
		{
			open(tag);
			end();
			
			//UPGRADE_TODO: Method 'java.util.Map.entrySet' was converted to 'SupportClass.HashSetSupport' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilMapentrySet'"
			System.Collections.IEnumerator it = new SupportClass.HashSetSupport(tag.class2tag).GetEnumerator();
			//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 (it.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'"
				System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry) it.Current;
				System.String className = (System.String) e.Key;
				DefineTag ref_Renamed = (DefineTag) e.Value;
				indent();
				//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
				out_Renamed.WriteLine("<Symbol idref='" + dict.getId(ref_Renamed) + "' className='" + className + "' />");
			}
			
			if (tag.topLevelClass != null)
			{
				indent();
				//UPGRADE_TODO: Method 'java.io.PrintWriter.println' was converted to 'System.IO.TextWriter.WriteLine' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaioPrintWriterprintln_javalangString'"
				out_Renamed.WriteLine("<Symbol idref='0' className='" + tag.topLevelClass + "' />");
			}
			
			
			close(tag);
		}