GetEnumerator() public method

public GetEnumerator ( ) : IEnumerator
return IEnumerator
Example #1
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();
         }
     }
 }
Example #2
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();
			}
		}
		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();
		}
Example #4
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());
 }
Example #5
0
 private AccNode parseLines(ArrayList accLines)
 {
     AccNode parent = null;
     IEnumerator it = accLines.GetEnumerator();
     AccNode an = BuildNode(parent, ref it, 0);
     return an;
 }
		//
		// 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;
		}
Example #7
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;
        }
Example #8
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);
      }
Example #9
0
 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);
       }
    }
 }
Example #10
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());
        }
Example #11
0
 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;
 }
        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;
        }
 //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;
 }
Example #14
0
		public SearchAgent(Problem p, Search search) 
		{
			actionList = search.search(p);
			actionIterator = actionList.GetEnumerator();
			searchMetrics = search.getMetrics();

		}
Example #15
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));
        }
            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;
            }
Example #17
0
 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();
		}
Example #19
0
 protected ArrayList removeRedundantEntries(ArrayList a)
 {
     IEnumerator i = a.GetEnumerator();
     while(i.MoveNext())
     {
         ;
     }
     return a;
 }
Example #20
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());
			}
		}
Example #21
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);
		}
Example #22
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 ();
            }
Example #25
0
		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 ();
		}
Example #26
0
		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 ();
		}
		public void writeEntry(ArrayList entry)
		{
			mutex.WaitOne();

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

			Console.WriteLine();

			mutex.ReleaseMutex();
		}
Example #28
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;
		}
Example #29
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();
 }
Example #30
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";
        }