GetEnumerator() public méthode

public GetEnumerator ( ) : IEnumerator
Résultat IEnumerator
Exemple #1
0
        protected void SetUp()
        {
            provider = new TestProvider();
            al       = provider.Customers;
            h        = new System.Collections.Hashtable();

            SupportClass.PutElement(h, "Bar", "this is from a hashtable!");
            SupportClass.PutElement(h, "Foo", "this is from a hashtable too!");

            /*
             *  lets set up a vector of objects to test late introspection. See ASTMethod.java
             */

            vec = new System.Collections.ArrayList();

            vec.Add(new System.String("string1".ToCharArray()));
            vec.Add(new System.String("string2".ToCharArray()));

            /*
             *  set up 3 chained contexts, and add our data
             *  throught the 3 of them.
             */

            context2 = new VelocityContext();
            context1 = new VelocityContext(context2);
            context  = new VelocityContext(context1);

            context.Put("provider", provider);
            context1.Put("name", "jason");
            context2.Put("providers", provider.Customers2);
            context.Put("list", al);
            context1.Put("hashtable", h);
            context2.Put("hashmap", new Hashtable());
            context2.Put("search", provider.Search);
            context.Put("relatedSearches", provider.RelSearches);
            context1.Put("searchResults", provider.RelSearches);
            context2.Put("stringarray", provider.Array);
            context.Put("vector", vec);
            context.Put("mystring", new System.String("".ToCharArray()));
            context.Put("runtime", new FieldMethodizer("NVelocity.Runtime.RuntimeSingleton"));
            context.Put("fmprov", new FieldMethodizer(provider));
            context.Put("Floog", "floogie woogie");
            context.Put("boolobj", new BoolObj());

            /*
             *  we want to make sure we test all types of iterative objects
             *  in #foreach()
             */

            System.Object[] oarr   = new System.Object[] { "a", "b", "c", "d" };
            int[]           intarr = new int[] { 10, 20, 30, 40, 50 };

            context.Put("collection", vec);
            context2.Put("iterator", vec.GetEnumerator());
            context1.Put("map", h);
            context.Put("obarr", oarr);
            context.Put("enumerator", vec.GetEnumerator());
            context.Put("intarr", intarr);
        }
Exemple #2
0
 public void calc()
 {
     if (required())
     {
         C.IEnumerator en = table.GetEnumerator();
         TableItem     y  = (TableItem)en.Current;
         // Рассчет количества дней
         countDays(y, this.RasshetDate);
         // Расчет процентов за пользование денежными средствами
         procentyZaPolzDenSredstvami(y);
         // Количество месяцев
         countMonths(y);
         // Сумма ущерба
         summaUscherba(y);
         // Сумма изъятых средств
         summaIzyatyhSredstv(en);
         // Общая сумма процентов за весь период
         summaProzentovZaPeriod(en);
         // Сумма ущерба за период
         summaUscherbaZaPeriod(en);
         // Неустойка за неудовлетворение претензии
         neustoika();
         // Моральный ущерб
         moralUscherb();
         // Итого без учета штрафа
         itogoBezShtrafa();
         // Штраф 50% от суммы
         shtraf50();
         // Итоговая сумма к возмещению
         itogo();
     }
     else
     {
     }
 }
Exemple #3
0
 public void alertStateObservers(int changeFlags)
 {
     for (IEnumerator e = observers.GetEnumerator(); e.MoveNext();)
     {
         ((FormElementStateListener)e.Current).formElementStateChanged(this, changeFlags);
     }
 }
Exemple #4
0
		protected virtual void Delete(ITestableReplicationProviderInside provider)
		{
			ArrayList toDelete = new ArrayList();
			IEnumerator rr = provider.GetStoredObjects(typeof(R0)).GetEnumerator();
			while (rr.MoveNext())
			{
				object o = rr.Current;
				IReflectClass claxx = ReplicationReflector().ForObject(o);
				SetFieldsToNull(o, claxx);
				toDelete.Add(o);
			}
			object commitObject = null;
			for (IEnumerator iterator = toDelete.GetEnumerator(); iterator.MoveNext(); )
			{
				object o = iterator.Current;
				//System.out.println("o = " + o);
				provider.Delete(o);
				commitObject = o;
			}
			if (commitObject != null)
			{
				provider.Commit();
			}
			else
			{
				provider.Commit();
			}
		}
		//
		// handlers management
		//
		#region mark TouchDispatcher - Helpers
		bool removeDelegate(System.Object del, ArrayList fromQueue)
		{
			System.Object handlerToRemove = null;
			
			var enumerator = fromQueue.GetEnumerator();
			while (enumerator.MoveNext()) {
				System.Object handlerOrDelegate = enumerator.Current;
				
				if( handlerOrDelegate is CCTouchHandler ) {
					// it is a handler
					if (del == ((CCTouchHandler)handlerOrDelegate).delegate_) {
						handlerToRemove = handlerOrDelegate;
						break;
					}
				} else {
					// it is a delegate
					if (del == handlerOrDelegate) {
						handlerToRemove = handlerOrDelegate;
						break;
					}
				}
			}
			
			if( handlerToRemove!=null ) {
				fromQueue.Remove(handlerToRemove);
				return true;
			}
			
			return false;
		}
Exemple #6
0
        public GameState(Game game_i)
        {
            game = game_i;
            playerList = game.Players.GetEnumerator();

            playerList.MoveNext();
            currentPlayer = (Gpremacy.Player)playerList.Current;

            //previousTerritory = null;
            //arrowOn = false;

            commandList = new ArrayList();
            networkCommands = new Queue();

            states = new ArrayList();
            states.Add(new Orig_Play1Upkeep(game));
            states.Add(new Orig_Play2Sell(game));
            states.Add(new Orig_Play3Attack(game));
            states.Add(new Orig_Play4Move(game));
            states.Add(new Orig_Play5Build(game));
            states.Add(new Orig_Play6Prospect(game));

              		stateList = states.GetEnumerator();
              		stateList.MoveNext();
              		currentState = (Gpremacy.State)stateList.Current;
              		stateList.MoveNext();
              		nextState = (Gpremacy.State)stateList.Current;

            turnNumber = 1;
            //nextPlayer();
            //nextState();

            GLib.Timeout.Add (1000, new GLib.TimeoutHandler (NetworkExecuteRun));
        }
Exemple #7
0
 public void ProcessFromStringOrderList(string text1)
 {
     IEnumerator enumerator = null;
     ArrayList list = new ArrayList();
     string str = "";
     if (text1.Contains("\r\n"))
     {
         list = CommonFunction.SeperateStringBySymbol(text1, "\r\n");
     }
     else
     {
         list.Add(text1);
     }
     try
     {
         enumerator = list.GetEnumerator();
         while (enumerator.MoveNext())
         {
             str = Conversions.ToString(enumerator.Current);
             this.ProcessFromStringOrder(str);
         }
     }
     finally
     {
         if (enumerator is IDisposable)
         {
             (enumerator as IDisposable).Dispose();
         }
     }
 }
Exemple #8
0
    static int GetEnumerator(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.ArrayList)))
            {
                System.Collections.ArrayList   obj = (System.Collections.ArrayList)ToLua.ToObject(L, 1);
                System.Collections.IEnumerator o   = obj.GetEnumerator();
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(System.Collections.ArrayList), typeof(int), typeof(int)))
            {
                System.Collections.ArrayList obj = (System.Collections.ArrayList)ToLua.ToObject(L, 1);
                int arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                int arg1 = (int)LuaDLL.lua_tonumber(L, 3);
                System.Collections.IEnumerator o = obj.GetEnumerator(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Collections.ArrayList.GetEnumerator"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
		private IEnumerator GetEnumValue(string sEnum)
		{
			if(sEnum == null || sEnum.Trim().Length == 0)
                return null;
			ArrayList list = new ArrayList();
			string sRes = sEnum.Trim();
			int startIndex=0;
			int i= 0;
			
			while(i != -1)
			{
				i= sRes.IndexOf(',', startIndex);
				if(i != -1)
				{
					list.Add(sRes.Substring(startIndex, i - startIndex));
					startIndex = i+1;
					if(startIndex == sRes.Length)
						break;
				}
				else list.Add(sRes.Substring(startIndex));
			}
			

			return list.GetEnumerator();
		}
Exemple #10
0
 public virtual void TestUnCancelledTraversalWithStartingPointInTheTree()
 {
     IList actual = new ArrayList();
     var tree = CreateTree();
     Tree.Traverse(tree, new TreeInt(6), new _ICancellableVisitor4_66(actual));
     IteratorAssert.AreEqual(CreateList(6).GetEnumerator(), actual.GetEnumerator());
 }
Exemple #11
0
        /// <summary>
        /// Removes all the elements from the specified collection that are contained in the target collection.
        /// </summary>
        /// <param name="target">Collection where the elements will be removed.</param>
        /// <param name="c">Elements to Remove from the target collection.</param>
        /// <returns>true</returns>
        public static bool RemoveAll(System.Collections.ICollection target, System.Collections.ICollection c)
        {
            System.Collections.ArrayList   al = ToArrayList(c);
            System.Collections.IEnumerator e  = al.GetEnumerator();

            //Reflection. Invoke "RemoveAll" method for proprietary classes or "Remove" for each element in the collection
            System.Reflection.MethodInfo method;
            try
            {
                method = target.GetType().GetMethod("RemoveAll");

                if (method != null)
                {
                    method.Invoke(target, new System.Object[] { al });
                }
                else
                {
                    method = target.GetType().GetMethod("Remove");
                    System.Reflection.MethodInfo methodContains = target.GetType().GetMethod("Contains");

                    while (e.MoveNext() == true)
                    {
                        while ((bool)methodContains.Invoke(target, new System.Object[] { e.Current }) == true)
                        {
                            method.Invoke(target, new System.Object[] { e.Current });
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            return(true);
        }
        private ArrayList getMissingFilesForWidget(LinkedList<FileInfo> filesCurWidget, ArrayList files)
        {
            IEnumerator ienumf = filesCurWidget.GetEnumerator();

            ArrayList missingFiles = new ArrayList();
            bool found = false;
            while (ienumf.MoveNext())
            {
                FileInfo finfo = (FileInfo)ienumf.Current;

                found = false;
                IEnumerator ienuml = files.GetEnumerator();
                while (ienuml.MoveNext())
                {
                    string localPath = (string)ienuml.Current;
                    if (localPath == Utils.normalizePathname(finfo.localPath))
                    {
                        found = true;
                        break;
                    }
                }

                if ( !found )
                {
                    missingFiles.Add(finfo.localPath);
                }
            }

            return missingFiles;
        }
Exemple #13
0
      static void Main(string[] args) 
      {
         // Create an ArrayList
         ArrayList al = new ArrayList();

         // Add some elements
         al.Add("foo");
         al.Add(3.7);
         al.Add(5);
         al.Add(false);

         // List them
         Console.WriteLine("Count={0}",al.Count);
         for(int i = 0; i < al.Count; i++)
            Console.WriteLine("al[{0}]={1}", i, al[i]);

         // Remove the element at index 1
         al.RemoveAt(1);

         // List them
         Console.WriteLine("Count={0}",al.Count);
         for(int i = 0; i < al.Count; i++)
            Console.WriteLine("al[{0}]={1}", i, al[i]);
            
            IEnumerator ie = al.GetEnumerator();
	    
	    while(ie.MoveNext())
	       Console.WriteLine(ie.Current);
      }
 void handleUpdate(UpdateSet update) {
    ArrayList vmUpdates = new ArrayList();
    ArrayList hostUpdates = new ArrayList();
    PropertyFilterUpdate[] pfus = update.filterSet; 
    for(int pfui=0; pfui<pfus.Length; ++ pfui) {
       ObjectUpdate[] ous = pfus[pfui].objectSet;
       for(int oui=0; oui<ous.Length; ++oui) {
          if(ous[oui].obj.type.Equals("VirtualMachine")) {
             vmUpdates.Add(ous[oui]);
          } else if(ous[oui].obj.type.Equals("HostSystem")) {
             hostUpdates.Add(ous[oui]);
          }
       }
    }      
    if(vmUpdates.Count > 0) {
       Console.WriteLine("Virtual Machine updates:");
       for (IEnumerator vmi = vmUpdates.GetEnumerator(); vmi.MoveNext(); )
       {
          handleObjectUpdate((ObjectUpdate)vmi.Current);
       }
    }      
    if(hostUpdates.Count > 0) {
       Console.WriteLine("Host updates:");
       for (IEnumerator vmi = hostUpdates.GetEnumerator(); vmi.MoveNext(); )
       {
           handleObjectUpdate((ObjectUpdate)vmi.Current);
       }
    }
 }
 public static IntPtr CFArrayFromManageArrayList(ArrayList arrySrc)
 {
     if (arrySrc == null)
     {
         return IntPtr.Zero;
     }
     IntPtr theArray = CFArrayCreateMutable(kCFAllocatorDefault, arrySrc.Count, kCFTypeArrayCallBacks);
     IEnumerator enumerator = arrySrc.GetEnumerator();
     try
     {
         while (enumerator.MoveNext())
         {
             object current = enumerator.Current;
             if (current != null)
             {
                 CFArrayAppendValue(theArray, CFTypeFromManagedType(current));
             }
         }
     }
     finally
     {
         IDisposable disposable = enumerator as IDisposable;
         if (disposable != null)
         {
             disposable.Dispose();
         }
     }
     return theArray;
 }
 //return how closely an input string resembles a single memory entry
 protected int calculateMatchRate(ArrayList input, ArrayList memory)
 {
     int matchRate = 0;
     IEnumerator i = input.GetEnumerator();
     IEnumerator m = memory.GetEnumerator();
     while(i.MoveNext())
     {
         while(m.MoveNext())
         {
             SortedList isNewWord = new SortedList();
             string cc = (string)i.Current;
             string bb = (string)m.Current;
             cc.ToLower();
             bb.ToLower();
             //mehrfachwertung für ein wort vermeiden z.b. eine 3 für 3x "ich"
             if(!isNewWord.Contains(bb))
             {
                 isNewWord.Add(bb, bb);
                 if(cc == bb)
                 {
                     matchRate++;
                 }
             }
             isNewWord.Clear();
         }
     }
     return matchRate;
 }
            public ArrayList insert(ArrayList list1, ArrayList list2)
            {
                ArrayList result = new ArrayList();

                IEnumerator left = list1.GetEnumerator();
                IEnumerator right = list2.GetEnumerator();
                left.MoveNext();
                right.MoveNext();

                while (!(isDone(left) && isDone(right)))
                {
                    if (!isDone(left))
                    {
                        result = addIfDoesntExist(result, left.Current);
                        left.MoveNext();
                    }

                    if (!isDone(right))
                    {
                        result = addIfDoesntExist(result, right.Current);
                        right.MoveNext();
                    }
                }

                return result;
            }
Exemple #18
0
        static void Main()
        {
            //Start DB Connection
            Database.init();
            Database.AddLog("Starting Up");

            //Is this the first run?
            if (Database.GetSetting("FirstRun", "YAMS") != "true") YAMS.Util.FirstRun();
            Database.SaveSetting("AdminPassword", "password");

            Database.AddLog("Reading minecraft servers!", "app", "debug");
            MySqlDataReader readerServers = Database.GetServers();
            ArrayList ServerIDs = new ArrayList();
            while (readerServers.Read())
            {
                int ServerID = Convert.ToInt32(readerServers.GetString("ServerID"));
                ServerIDs.Add(ServerID);
            }
            readerServers.Close();

            System.Collections.IEnumerator enu = ServerIDs.GetEnumerator();
            while (enu.MoveNext())
            {
                int ServerID = Convert.ToInt32(enu.Current);
                MCServer myServer = new MCServer(ServerID);
                Core.Servers.Add(ServerID, myServer);
            }

            //Start Webserver
            WebServer.Init();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmMain());
        }
Exemple #19
0
 private AccNode parseLines(ArrayList accLines)
 {
     AccNode parent = null;
     IEnumerator it = accLines.GetEnumerator();
     AccNode an = BuildNode(parent, ref it, 0);
     return an;
 }
Exemple #20
0
        //return how closely an input string resembles a single memory entry
        //break because dont want to count same word re-occurences
        protected int calculateMatchRate(ArrayList input, ArrayList memory)
        {
            int matchRate = 0;
            string cc     = "";
            string bb     = "";

            IEnumerator i = input.GetEnumerator();
            while(i.MoveNext())
            {
                cc = (string)i.Current;
                cc = cc.ToLower();

                IEnumerator m = memory.GetEnumerator();
                while(m.MoveNext())
                {
                    bb = (string)m.Current;
                    bb = bb.ToLower();
                    if(cc == bb)
                    {
                        matchRate++; break;
                    }
                }

            }
            return matchRate;
        }
Exemple #21
0
		public SearchAgent(Problem p, Search search) 
		{
			actionList = search.search(p);
			actionIterator = actionList.GetEnumerator();
			searchMetrics = search.getMetrics();

		}
 public ArrayQueue()
 {
     lock(this)
     {
         m_Array = new ArrayList();
         m_Enum = m_Array.GetEnumerator();
     }
 }
		private static IEnumerator Reverse(IEnumerable en)
		{
			var al = new ArrayList();
			foreach (object item in en)
				al.Add(item);
			al.Reverse();
			return al.GetEnumerator();
		}
Exemple #24
0
 /// <summary>
 /// Gets the IEnumerator for the binary search tree instance.
 /// </summary>
 /// <returns></returns>
 public IEnumerator GetEnumerator()
 {
     // dump the contents of the BST's Inorder traversal into an ArrayList and
     // then return this ArrayList's enumerator
     System.Collections.ArrayList contents = new System.Collections.ArrayList(_count);
     InorderTraversalBuildup(_root, contents);
     return(contents.GetEnumerator());
 }
Exemple #25
0
		public static void AreEqual(object[] expected, IEnumerator iterator)
		{
			ArrayList v = new ArrayList();
			for (int i = 0; i < expected.Length; i++)
			{
				v.Add(expected[i]);
			}
			AreEqual(v.GetEnumerator(), iterator);
		}
Exemple #26
0
		//a hash Of Lists { variable: ListOfDomainValues
		public Domain(ArrayList variables) 
		{
			this.hash = new Hashtable();
			IEnumerator varIter = variables.GetEnumerator();
			while (varIter.MoveNext()) 
			{
				hash.Add(varIter.Current, new ArrayList());
			}
		}
Exemple #27
0
 protected ArrayList removeRedundantEntries(ArrayList a)
 {
     IEnumerator i = a.GetEnumerator();
     while(i.MoveNext())
     {
         ;
     }
     return a;
 }
Exemple #28
0
		public IEnumerator GetEnumerator()
		{
			ArrayList arrayList = new ArrayList();
			foreach (DictionaryEntry dictionaryEntry1 in this.orders)
			{
				foreach (DictionaryEntry dictionaryEntry2 in (IEnumerable) dictionaryEntry1.Value)
					arrayList.Add(dictionaryEntry2.Value);
			}
			return arrayList.GetEnumerator();
		}
 public GenCode(ReadFromXml r)
 {
     readxml = r;
     cList = readxml.getConnectionList();
     dList = readxml.getDeviceList();
     nList = readxml.GetNodeList();
     cEnum = cList.GetEnumerator();
     dEnum = dList.GetEnumerator();
     nEnum = nList.GetEnumerator();
 }
            public IEnumerator GetEnumerator()
            {
                ArrayList al = new ArrayList ();

                foreach (object o in m_ht.Values)
                {
                    al.Add (o);
                }

                return al.GetEnumerator ();
            }
		IEnumerator IEnumerable.GetEnumerator ()
		{
			ArrayList ret = new ArrayList (nodeList.Count);
			
			foreach (XmlNode node in nodeList) {
				if (node.NodeType == XmlNodeType.Element)
					ret.Add (new XmlHierarchyData (node));
			}
			
			return ret.GetEnumerator ();
		}
		public IEnumerator GetEnumerator ()
		{
			ArrayList instructions = new ArrayList ();
			Instruction instruction = _firstInstruction;
			while (true) {
				instructions.Add (instruction);
				if (instruction == _lastInstruction) break;
				instruction = instruction.Next;
			}
			return instructions.GetEnumerator ();
		}
Exemple #33
0
		private bool ContainsSlotFor(ArrayList result, int id)
		{
			for (IEnumerator pairIter = result.GetEnumerator(); pairIter.MoveNext(); )
			{
				Pair pair = ((Pair)pairIter.Current);
				if ((((int)pair.first)) == id)
				{
					return true;
				}
			}
			return false;
		}
		public void writeEntry(ArrayList entry)
		{
			mutex.WaitOne();

			IEnumerator line = entry.GetEnumerator();
			while (line.MoveNext())
				Console.WriteLine(line.Current);

			Console.WriteLine();

			mutex.ReleaseMutex();
		}
Exemple #35
0
 protected override System.Collections.IEnumerator GetStrings()
 {
     ArrayList TargetList = new ArrayList();
     foreach (Target Canidate in this.Project.Targets)
     {
         if (this.LookForMatch(Canidate.Name, this.IncludeRegexs) & !this.LookForMatch(Canidate.Name, this.ExcludeRegexs))
         {
             TargetList.Add(Canidate.Name);
         }
     }
     return TargetList.GetEnumerator();
 }
Exemple #36
0
        public static string BuildTable(int NumRows, int NumCells, ArrayList values)
        {
            StringBuilder sb = new StringBuilder();
            int totalValues = NumRows * NumCells;
            //pad with blanks
            for (int i = values.Count; i <= totalValues; i++)
            {
                values.Add("");
                //Console.WriteLine("padding...");
            }
            IEnumerator enumer = values.GetEnumerator();
            enumer.MoveNext();

            int j = 1;
            // write table contents
            for (int k = 1; k <= NumRows; k++)
            {
                sb.Append("\\trowd\\trautofit1\\intbl");
                j = 1;
                for (int i = 1; i <= NumCells; i++)
                {
                    sb.Append("\\cellx" + j);
                    j = j + 1;
                }

                sb.Append("{");

                //DATA FIELDS
                for (int i = 1; i <= NumCells; i++)
                {
                    //Console.WriteLine(enumer.Current);
                    sb.Append("\\pard " + enumer.Current.ToString() + "\\cell \\pard");
                    enumer.MoveNext();

                }

                sb.Append("}");

                sb.Append("{");

                sb.Append("\\trowd\\trautofit1\\intbl\\trqc");
                j = 1;
                for (int i = 1; i <= NumCells; i++)
                {
                    sb.Append("\\clpadt100\\clpadft3\\clpadr100\\clpadfr3\\clwWidth1\\clftsWidth\\clwWidth1\\clftsWidth1\\clbrdrt\\brdrs\\brdrw10\\clbrdrl\\brdrs\\brdrw10\\clbrdrb\\brdrs\\brdrw10\\clbrdrr\\brdrs\\brdrw10\\clNoWrap\\cellx" + j);
                    j = j + 1;
                }
                sb.Append("\\row }");

            }
            return "\n\\pard\\par\n{" + sb.ToString() + "}\n\\pard\n";
        }
Exemple #37
0
 static public int GetEnumerator(IntPtr l)
 {
     try {
         System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l);
         var ret = self.GetEnumerator();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #38
0
 /* (non-Javadoc)
  * @see java.io.InputStream#close()
  */
 public override void Close()
 {
     if (currentStream == -1)
     {
         throw new System.IO.IOException("Cannot read from unprepared MultiInputStream!");
     }
     System.Collections.IEnumerator en = streams.GetEnumerator();
     //UPGRADE_TODO: Method 'java.util.Enumeration.hasMoreElements' 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_javautilEnumerationhasMoreElements'"
     while (en.MoveNext())
     {
         //UPGRADE_TODO: Method 'java.util.Enumeration.nextElement' 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_javautilEnumerationnextElement'"
         ((System.IO.Stream)en.Current).Close();
     }
 }
        /// <summary>
        /// Removes all the elements from the specified collection that are contained in the target collection.
        /// </summary>
        /// <param name="target">Collection where the elements will be removed.</param>
        /// <param name="c">Elements to remove from the target collection.</param>
        /// <returns>true</returns>
        public static bool RemoveAll(System.Collections.ICollection target, System.Collections.ICollection c)
        {
            System.Collections.ArrayList   al = ToArrayList(c);
            System.Collections.IEnumerator e  = al.GetEnumerator();

            //Reflection. Invoke "removeAll" method for proprietary classes or "Remove" for each element in the collection
            System.Reflection.MethodInfo method;
            try
            {
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                method = Type_WP_8_1.Type.GetMethod(target.GetType(), "removeAll");
#else
                method = target.GetType().GetMethod("removeAll");
#endif
                if (method != null)
                {
                    method.Invoke(target, new System.Object[] { al });
                }
                else
                {
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                    method = Type_WP_8_1.Type.GetMethod(target.GetType(), "Remove");
#else
                    method = target.GetType().GetMethod("Remove");
#endif
#if NETFX_CORE && UNITY_METRO && !UNITY_EDITOR
                    System.Reflection.MethodInfo methodContains = Type_WP_8_1.Type.GetMethod(target.GetType(), "Contains");
#else
                    System.Reflection.MethodInfo methodContains = target.GetType().GetMethod("Contains");
#endif

                    while (e.MoveNext() == true)
                    {
                        while ((bool)methodContains.Invoke(target, new System.Object[] { e.Current }) == true)
                        {
                            method.Invoke(target, new System.Object[] { e.Current });
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                throw ex;
            }
            return(true);
        }
Exemple #40
0
 static public int GetEnumerator__Int32__Int32(IntPtr l)
 {
     try {
         System.Collections.ArrayList self = (System.Collections.ArrayList)checkSelf(l);
         System.Int32 a1;
         checkType(l, 2, out a1);
         System.Int32 a2;
         checkType(l, 3, out a2);
         var ret = self.GetEnumerator(a1, a2);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Exemple #41
0
    //<snippet1>
    // This method demonstrates retrieving line numbers that
    // indicate the location of a particular word
    // contained in a RichTextBox. The line numbers are zero-based.

    private void Button1_Click(System.Object sender, System.EventArgs e)
    {
        // Reset the results box.
        TextBox1.Text = "";

        // Get the word to search from TextBox2.
        string searchWord = TextBox2.Text;

        int index = 0;

        //Declare an ArrayList to store line numbers.
        System.Collections.ArrayList lineList = new System.Collections.ArrayList();
        do
        {
            // Find occurrences of the search word, incrementing
            // the start index.
            index = RichTextBox1.Find(searchWord, index + 1, RichTextBoxFinds.MatchCase);
            if (index != -1)

            // Find the word's line number and add the line
            // number to the arrayList.
            {
                lineList.Add(RichTextBox1.GetLineFromCharIndex(index));
            }
        }while((index != -1));

        // Iterate through the list and display the line numbers in TextBox1.
        System.Collections.IEnumerator myEnumerator = lineList.GetEnumerator();
        if (lineList.Count <= 0)
        {
            TextBox1.Text = searchWord + " was not found";
        }
        else
        {
            TextBox1.SelectedText = searchWord + " was found on line(s):";
            while (myEnumerator.MoveNext())
            {
                TextBox1.SelectedText = myEnumerator.Current + " ";
            }
        }
    }
        /// <summary>
        /// 목록 전체 기록을 위한 WriteEntry 구현
        /// </summary>
        /// <param name="entry"></param>
        public void WriteEntry(System.Collections.ArrayList entry)
        {
            try
            {
                mutex.WaitOne();

                System.Collections.IEnumerator line = entry.GetEnumerator();
                while (line.MoveNext())
                {
                    output.WriteLine(line.Current);
                }
                output.WriteLine();
                output.Flush();

                mutex.ReleaseMutex();
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.Message);
            }
        }
        /// <summary>
        /// 목록 전체 기록을 위한 WriteEntry 구현
        /// </summary>
        /// <param name="entry"></param>
        public void WriteEntry(System.Collections.ArrayList entry)
        {
            try
            {
                mutex.WaitOne();

                System.Collections.IEnumerator line = entry.GetEnumerator();
                while (line.MoveNext())
                {
                    output.WriteLine(line.Current);
                }
                output.WriteLine();
                output.Flush();

                mutex.ReleaseMutex();
            }
            catch (Exception e)
            {
#if DEBUG_PRINT_ENABLE
                MyClass_Dprint.debugPrint(e.Message);
#endif
            }
        }
        private System.Collections.IList lazyFindBiconnectedSets()
        {
            if (biconnectedSets_Renamed_Field == null)
            {
                biconnectedSets_Renamed_Field = new System.Collections.ArrayList();

                IList inspector = new ConnectivityInspector(graph).connectedSets();
                System.Collections.IEnumerator connectedSets = inspector.GetEnumerator();

                while (connectedSets.MoveNext())
                {
                    object obj = ((DictionaryEntry)connectedSets.Current).Value;
                    if (!(obj is CSGraphT.SupportClass.HashSetSupport))
                    {
                        continue;
                    }
                    CSGraphT.SupportClass.SetSupport connectedSet = (CSGraphT.SupportClass.SetSupport)obj;
                    if (connectedSet.Count == 1)
                    {
                        continue;
                    }

                    org._3pq.jgrapht.Graph subgraph = new Subgraph(graph, connectedSet, null);

                    // do DFS

                    // Stack for the DFS
                    System.Collections.ArrayList vertexStack = new System.Collections.ArrayList();

                    CSGraphT.SupportClass.SetSupport visitedVertices = new CSGraphT.SupportClass.HashSetSupport();
                    IDictionary parent      = new System.Collections.Hashtable();
                    IList       dfsVertices = new System.Collections.ArrayList();

                    CSGraphT.SupportClass.SetSupport treeEdges = new CSGraphT.SupportClass.HashSetSupport();

                    System.Object currentVertex = subgraph.vertexSet()[0];//.ToArray()[0];

                    vertexStack.Add(currentVertex);
                    visitedVertices.Add(currentVertex);

                    while (!(vertexStack.Count == 0))
                    {
                        currentVertex = SupportClass.StackSupport.Pop(vertexStack);

                        System.Object parentVertex = parent[currentVertex];

                        if (parentVertex != null)
                        {
                            Edge edge = subgraph.getEdge(parentVertex, currentVertex);

                            // tree edge
                            treeEdges.Add(edge);
                        }

                        visitedVertices.Add(currentVertex);

                        dfsVertices.Add(currentVertex);

                        System.Collections.IEnumerator edges = subgraph.edgesOf(currentVertex).GetEnumerator();
                        while (edges.MoveNext())
                        {
                            // find a neighbour vertex of the current vertex
                            Edge edge = (Edge)edges.Current;

                            if (!treeEdges.Contains(edge))
                            {
                                System.Object nextVertex = edge.oppositeVertex(currentVertex);

                                if (!visitedVertices.Contains(nextVertex))
                                {
                                    vertexStack.Add(nextVertex);

                                    parent[nextVertex] = currentVertex;
                                }
                                else
                                {
                                    // non-tree edge
                                }
                            }
                        }
                    }

                    // DFS is finished. Now create the auxiliary graph h
                    // Add all the tree edges as vertices in h
                    SimpleGraph h = new SimpleGraph();

                    h.addAllVertices(treeEdges);

                    visitedVertices.Clear();

                    CSGraphT.SupportClass.SetSupport connected = new CSGraphT.SupportClass.HashSetSupport();

                    for (System.Collections.IEnumerator it = dfsVertices.GetEnumerator(); it.MoveNext();)
                    {
                        System.Object v = it.Current;

                        visitedVertices.Add(v);

                        // find all adjacent non-tree edges
                        for (System.Collections.IEnumerator adjacentEdges = subgraph.edgesOf(v).GetEnumerator(); adjacentEdges.MoveNext();)
                        {
                            Edge l = (Edge)adjacentEdges.Current;
                            if (!treeEdges.Contains(l))
                            {
                                h.addVertex(l);
                                System.Object u = l.oppositeVertex(v);

                                // we need to check if (u,v) is a back-edge
                                if (!visitedVertices.Contains(u))
                                {
                                    while (u != v)
                                    {
                                        System.Object pu = parent[u];
                                        Edge          f  = subgraph.getEdge(u, pu);

                                        h.addEdge(f, l);

                                        if (!connected.Contains(f))
                                        {
                                            connected.Add(f);
                                            u = pu;
                                        }
                                        else
                                        {
                                            u = v;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    ConnectivityInspector connectivityInspector = new ConnectivityInspector(h);

                    biconnectedSets_Renamed_Field.Add(connectivityInspector.connectedSets());
                }
            }

            return(biconnectedSets_Renamed_Field);
        }
Exemple #45
0
 public IEnumerator GetEnumerator()
 {
     return(m_Entries.GetEnumerator());
 }
Exemple #46
0
        private void init_Avail_data()
        {
            System.Collections.Generic.Dictionary <long, string> dictionary = new System.Collections.Generic.Dictionary <long, string>();
            if (this.m_groupID >= 0L)
            {
                GroupInfo groupByID  = GroupInfo.GetGroupByID(this.m_groupID);
                string    memberList = groupByID.GetMemberList();
                if (memberList != null && memberList.Length > 0)
                {
                    string[] array = memberList.Split(new string[]
                    {
                        ","
                    }, System.StringSplitOptions.RemoveEmptyEntries);
                    string[] array2 = array;
                    for (int i = 0; i < array2.Length; i++)
                    {
                        string value = array2[i];
                        long   key   = (long)System.Convert.ToInt32(value);
                        dictionary.Add(key, "");
                    }
                }
            }
            this.dgvAvail.DataSource = null;
            this.Avail_tb            = new DataTable();
            this.Avail_tb.Columns.Add("objID", typeof(string));
            this.Avail_tb.PrimaryKey = new DataColumn[]
            {
                this.Avail_tb.Columns[0]
            };
            string groupType;

            if ((groupType = this.m_groupType) != null)
            {
                if (cct == null)
                {
                    cct = new System.Collections.Generic.Dictionary <string, int>(7)
                    {
                        {
                            "zone",
                            0
                        },

                        {
                            "rack",
                            1
                        },

                        {
                            "allrack",
                            2
                        },

                        {
                            "dev",
                            3
                        },

                        {
                            "alldev",
                            4
                        },

                        {
                            "outlet",
                            5
                        },

                        {
                            "alloutlet",
                            6
                        }
                    };
                }
                int num;
                if (cct.TryGetValue(groupType, out num))
                {
                    switch (num)
                    {
                    case 0:
                    {
                        this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string));
                        System.Collections.ArrayList   allZone    = ZoneInfo.getAllZone();
                        System.Collections.IEnumerator enumerator = allZone.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                ZoneInfo zoneInfo = (ZoneInfo)enumerator.Current;
                                string   text     = zoneInfo.ZoneID.ToString();
                                if (!dictionary.ContainsKey(zoneInfo.ZoneID))
                                {
                                    string[] values = new string[]
                                    {
                                        text,
                                        zoneInfo.ZoneName
                                    };
                                    this.Avail_tb.Rows.Add(values);
                                }
                            }
                            return;
                        }
                        finally
                        {
                            System.IDisposable disposable = enumerator as System.IDisposable;
                            if (disposable != null)
                            {
                                disposable.Dispose();
                            }
                        }
                        break;
                    }

                    case 1:
                    case 2:
                        break;

                    case 3:
                    case 4:
                        goto IL_401;

                    case 5:
                    case 6:
                        goto IL_50F;

                    default:
                        return;
                    }
                    this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string));
                    this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string));
                    System.Collections.ArrayList   allZone2        = ZoneInfo.getAllZone();
                    System.Collections.ArrayList   allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty();
                    System.Collections.IEnumerator enumerator2     = allRack_NoEmpty.GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            RackInfo rackInfo = (RackInfo)enumerator2.Current;
                            if (!dictionary.ContainsKey(rackInfo.RackID))
                            {
                                string displayRackName = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
                                string text2           = rackInfo.RackID.ToString();
                                bool   flag            = false;
                                string text3           = "";
                                foreach (ZoneInfo zoneInfo2 in allZone2)
                                {
                                    text3 = zoneInfo2.ZoneName;
                                    string[] source = zoneInfo2.RackInfo.Split(new char[]
                                    {
                                        ','
                                    });
                                    if (source.Contains(text2))
                                    {
                                        flag = true;
                                        break;
                                    }
                                }
                                string[] values;
                                if (flag)
                                {
                                    values = new string[]
                                    {
                                        text2,
                                        displayRackName,
                                        text3
                                    };
                                }
                                else
                                {
                                    values = new string[]
                                    {
                                        text2,
                                        displayRackName,
                                        ""
                                    };
                                }
                                this.Avail_tb.Rows.Add(values);
                            }
                        }
                        return;
                    }
                    finally
                    {
                        System.IDisposable disposable3 = enumerator2 as System.IDisposable;
                        if (disposable3 != null)
                        {
                            disposable3.Dispose();
                        }
                    }
IL_401:
                    this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string));
                    this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string));
                    System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice();
                    using (System.Collections.Generic.List <DeviceInfo> .Enumerator enumerator4 = allDevice.GetEnumerator())
                    {
                        while (enumerator4.MoveNext())
                        {
                            DeviceInfo current = enumerator4.Current;
                            if (!dictionary.ContainsKey((long)current.DeviceID))
                            {
                                string   deviceName       = current.DeviceName;
                                string   text4            = current.DeviceID.ToString();
                                RackInfo rackByID         = RackInfo.getRackByID(current.RackID);
                                string   displayRackName2 = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
                                string[] values           = new string[]
                                {
                                    text4,
                                    deviceName,
                                    displayRackName2
                                };
                                this.Avail_tb.Rows.Add(values);
                            }
                        }
                        return;
                    }
IL_50F:
                    this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMOutlet, new string[0]), typeof(string));
                    this.Avail_tb.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string));
                    allDevice = DeviceOperation.GetAllDevice();
                    foreach (DeviceInfo current2 in allDevice)
                    {
                        System.Collections.Generic.List <PortInfo> portInfo = current2.GetPortInfo();
                        foreach (PortInfo current3 in portInfo)
                        {
                            if (!dictionary.ContainsKey((long)current3.ID))
                            {
                                string[] values = new string[]
                                {
                                    current3.ID.ToString(),
                                          current3.PortName,
                                          current2.DeviceName
                                };
                                this.Avail_tb.Rows.Add(values);
                            }
                        }
                    }
                }
            }
        }
Exemple #47
0
        private void FillList()
        {
            this.dgvGpmember.DataSource = null;
            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("objID", typeof(string));
            switch (this.cboType.SelectedIndex)
            {
            case 0:
            {
                dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string));
                System.Collections.ArrayList   allZone    = ZoneInfo.getAllZone();
                System.Collections.IEnumerator enumerator = allZone.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        ZoneInfo zoneInfo = (ZoneInfo)enumerator.Current;
                        string   text     = zoneInfo.ZoneID.ToString();
                        string[] values   = new string[]
                        {
                            text,
                            zoneInfo.ZoneName
                        };
                        dataTable.Rows.Add(values);
                    }
                    goto IL_46A;
                }
                finally
                {
                    System.IDisposable disposable = enumerator as System.IDisposable;
                    if (disposable != null)
                    {
                        disposable.Dispose();
                    }
                }
                break;
            }

            case 1:
                break;

            case 2:
                goto IL_285;

            case 3:
                goto IL_36E;

            default:
                goto IL_46A;
            }
            dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string));
            dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMZone, new string[0]), typeof(string));
            System.Collections.ArrayList   allZone2        = ZoneInfo.getAllZone();
            System.Collections.ArrayList   allRack_NoEmpty = RackInfo.GetAllRack_NoEmpty();
            System.Collections.IEnumerator enumerator2     = allRack_NoEmpty.GetEnumerator();
            try
            {
                while (enumerator2.MoveNext())
                {
                    RackInfo rackInfo        = (RackInfo)enumerator2.Current;
                    string   displayRackName = rackInfo.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
                    string   text2           = rackInfo.RackID.ToString();
                    bool     flag            = false;
                    string   text3           = "";
                    foreach (ZoneInfo zoneInfo2 in allZone2)
                    {
                        text3 = zoneInfo2.ZoneName;
                        string[] source = zoneInfo2.RackInfo.Split(new char[]
                        {
                            ','
                        });
                        if (source.Contains(text2))
                        {
                            flag = true;
                            break;
                        }
                    }
                    string[] values;
                    if (flag)
                    {
                        values = new string[]
                        {
                            text2,
                            displayRackName,
                            text3
                        };
                    }
                    else
                    {
                        values = new string[]
                        {
                            text2,
                            displayRackName,
                            ""
                        };
                    }
                    dataTable.Rows.Add(values);
                }
                goto IL_46A;
            }
            finally
            {
                System.IDisposable disposable3 = enumerator2 as System.IDisposable;
                if (disposable3 != null)
                {
                    disposable3.Dispose();
                }
            }
IL_285:
            dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string));
            dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMRack, new string[0]), typeof(string));
            System.Collections.Generic.List <DeviceInfo> allDevice = DeviceOperation.GetAllDevice();
            using (System.Collections.Generic.List <DeviceInfo> .Enumerator enumerator4 = allDevice.GetEnumerator())
            {
                while (enumerator4.MoveNext())
                {
                    DeviceInfo current          = enumerator4.Current;
                    string     deviceName       = current.DeviceName;
                    string     text4            = current.DeviceID.ToString();
                    RackInfo   rackByID         = RackInfo.getRackByID(current.RackID);
                    string     displayRackName2 = rackByID.GetDisplayRackName(EcoGlobalVar.RackFullNameFlag);
                    string[]   values           = new string[]
                    {
                        text4,
                        deviceName,
                        displayRackName2
                    };
                    dataTable.Rows.Add(values);
                }
                goto IL_46A;
            }
IL_36E:
            dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMOutlet, new string[0]), typeof(string));
            dataTable.Columns.Add(EcoLanguage.getMsg(LangRes.Group_NMDev, new string[0]), typeof(string));
            allDevice = DeviceOperation.GetAllDevice();
            foreach (DeviceInfo current2 in allDevice)
            {
                System.Collections.Generic.List <PortInfo> portInfo = current2.GetPortInfo();
                foreach (PortInfo current3 in portInfo)
                {
                    string[] values = new string[]
                    {
                        current3.ID.ToString(),
                                  current3.PortName,
                                  current2.DeviceName
                    };
                    dataTable.Rows.Add(values);
                }
            }
IL_46A:
            this.dgvGpmember.DataSource = dataTable;
            this.dgvGpmember.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.dgvGpmember.Columns[0].Visible = false;
            int selectedIndex = this.cboType.SelectedIndex;

            if (selectedIndex == 0)
            {
                this.dgvGpmember.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                return;
            }
            this.dgvGpmember.Columns[1].Width        = 140;
            this.dgvGpmember.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
        }
Exemple #48
0
 public IEnumerator GetEnumerator()
 {
     // TODO:  Add ControlListView.GetEnumerator implementation
     return(controlList.GetEnumerator());
 }