当前位置: 首页>>代码示例>>C#>>正文


C# System.Collections.ArrayList.Sort方法代码示例

本文整理汇总了C#中System.Collections.ArrayList.Sort方法的典型用法代码示例。如果您正苦于以下问题:C# System.Collections.ArrayList.Sort方法的具体用法?C# System.Collections.ArrayList.Sort怎么用?C# System.Collections.ArrayList.Sort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.ArrayList的用法示例。


在下文中一共展示了System.Collections.ArrayList.Sort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getAllOutputQueueData

        public virtual OutputQueueData[] getAllOutputQueueData()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();

            if (outputQueue.Count == 0)
                return null;
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);

                }
            }

            ary.Sort();
            object[] data = ary.ToArray();

            OutputQueueData[] retobjs = new OutputQueueData[data.Length];

            for (int i = 0; i < data.Length; i++)
                retobjs[i] =(OutputQueueData)data[i];

            return retobjs;
        }
开发者ID:ufjl0683,项目名称:Center,代码行数:29,代码来源:OutPutDeviceBase.cs

示例2: getOutputdata

        public virtual OutputQueueData getOutputdata()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();

            //int maxPriority = -1000, maxRuleid = -1000;

            //if (outputQueue.Count == 0)
            //    return null;
            //else
            //{

            //    System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
            //    while (ie.MoveNext())
            //    {
            //        OutputQueueData data = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;
            //        if (data.priority > maxPriority)
            //        {
            //            maxPriority = data.priority;
            //            maxRuleid = data.ruleid;
            //        }
            //    }
            //}
            //return (OutputQueueData)outputQueue[maxRuleid];

            if (outputQueue.Count == 0)
                return null;
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);
                    //if (data.priority > maxPriority)
                    //{
                    //  //  mergeGerericDisplayData
                    //    maxPriority = data.priority;
                    //    maxRuleid = data.ruleid;
                    //}
                }
            }

            ary.Sort();
            object[] data = ary.ToArray();
            //if (this.deviceName == "CMS-T78-W-41.6")
            //    Console.WriteLine("stop here");

                return (OutputQueueData)data[data.Length-1];
        }
开发者ID:ufjl0683,项目名称:Center,代码行数:51,代码来源:OutPutDeviceBase.cs

示例3: OutputFollowedByInfo

		/// <summary>
		/// Output each sfm and the sfm that followed it with the number of occurances in the input file.
		/// Each sfm should be listed, except for the case where the last sfm in the file is only used once.
		/// </summary>
		/// <param name="sfmSorted"></param>
		/// <param name="w"></param>
		/// <param name="reader"></param>
		static void OutputFollowedByInfo(System.Collections.ArrayList sfmSorted, BinaryWriter w, Sfm2Xml.SfmFileReaderEx reader)
		{
			StringBuilder sb = new StringBuilder();
			sb.AppendFormat("{0}{1}{2}{3}{4}", nl, "SFM Followed by Info:", nl, "--------------------------------------", nl);
			sb.AppendFormat("{0}({1}){2}", reader.FileName, reader.Count, nl);
			w.Write(MakeBytes(sb.ToString()));

			byte[] a = new byte[] { (byte)' ', (byte)'-', (byte)' ' };
			byte[] b = new byte[] { (byte)'\t', (byte)'=', (byte)' ' };

			Dictionary<string, Dictionary<string, int>> fbInfo = reader.GetFollowedByInfo();
			foreach (string sfm in sfmSorted)
			{
				if (fbInfo.ContainsKey(sfm) == false)	// case where sfm is only used once and is last marker
					continue;

				Dictionary<string, int> kvp = fbInfo[sfm];
				System.Collections.ArrayList sfm2 = new System.Collections.ArrayList(kvp.Keys);
				sfm2.Sort();

				foreach (string sfmNext in sfm2)
				{
					w.Write(MakeBytes(sfm));
					w.Write(a);
					w.Write(MakeBytes(sfmNext));
					w.Write(b);
					w.Write(MakeBytes((kvp[sfmNext]).ToString("N0")));
					w.Write(m_NL);
				}
			}
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:38,代码来源:Program.cs

示例4: WriteHibernateMapping

        /// <summary> Write a HibernateMapping XML Element from attributes in a type. </summary>
        public virtual void WriteHibernateMapping(System.Xml.XmlWriter writer, System.Type type)
        {
            object[] attributes = type.GetCustomAttributes(typeof(HibernateMappingAttribute), false);
            if(attributes.Length == 0)
                return;
            HibernateMappingAttribute attribute = attributes[0] as HibernateMappingAttribute;

            writer.WriteStartElement( "hibernate-mapping" );
            // Attribute: <schema>
            if(attribute.Schema != null)
            writer.WriteAttributeString("schema", GetAttributeValue(attribute.Schema, type));
            // Attribute: <catalog>
            if(attribute.Catalog != null)
            writer.WriteAttributeString("catalog", GetAttributeValue(attribute.Catalog, type));
            // Attribute: <default-cascade>
            if(attribute.DefaultCascade != null)
            writer.WriteAttributeString("default-cascade", GetAttributeValue(attribute.DefaultCascade, type));
            // Attribute: <default-access>
            if(attribute.DefaultAccess != null)
            writer.WriteAttributeString("default-access", GetAttributeValue(attribute.DefaultAccess, type));
            // Attribute: <default-lazy>
            if( attribute.DefaultLazySpecified )
            writer.WriteAttributeString("default-lazy", attribute.DefaultLazy ? "true" : "false");
            // Attribute: <auto-import>
            if( attribute.AutoImportSpecified )
            writer.WriteAttributeString("auto-import", attribute.AutoImport ? "true" : "false");
            // Attribute: <namespace>
            if(attribute.Namespace != null)
            writer.WriteAttributeString("namespace", GetAttributeValue(attribute.Namespace, type));
            // Attribute: <assembly>
            if(attribute.Assembly != null)
            writer.WriteAttributeString("assembly", GetAttributeValue(attribute.Assembly, type));

            WriteUserDefinedContent(writer, type, null, attribute);
            // Element: <meta>
            System.Collections.ArrayList MetaList = FindAttributedMembers( attribute, typeof(MetaAttribute), type );
            foreach( System.Reflection.MemberInfo member in MetaList )
            {
                object[] objects = member.GetCustomAttributes(typeof(MetaAttribute), false);
                System.Collections.ArrayList memberAttribs = new System.Collections.ArrayList();
                memberAttribs.AddRange(objects);
                memberAttribs.Sort();
                foreach(object memberAttrib in memberAttribs)
                    WriteMeta(writer, member, memberAttrib as MetaAttribute, attribute, type);
            }
            WriteUserDefinedContent(writer, type, typeof(MetaAttribute), attribute);
            // Element: <typedef>
            System.Collections.ArrayList TypeDefList = FindAttributedMembers( attribute, typeof(TypeDefAttribute), type );
            foreach( System.Reflection.MemberInfo member in TypeDefList )
            {
                object[] objects = member.GetCustomAttributes(typeof(TypeDefAttribute), false);
                System.Collections.ArrayList memberAttribs = new System.Collections.ArrayList();
                memberAttribs.AddRange(objects);
                memberAttribs.Sort();
                foreach(object memberAttrib in memberAttribs)
                    WriteTypeDef(writer, member, memberAttrib as TypeDefAttribute, attribute, type);
            }
            WriteUserDefinedContent(writer, type, typeof(TypeDefAttribute), attribute);
            // Element: <import>
            WriteNestedImportTypes(writer, type);
            WriteUserDefinedContent(writer, type, typeof(ImportAttribute), attribute);
            // Element: <class>
            WriteNestedClassTypes(writer, type);
            WriteUserDefinedContent(writer, type, typeof(ClassAttribute), attribute);
            // Element: <subclass>
            WriteNestedSubclassTypes(writer, type);
            WriteUserDefinedContent(writer, type, typeof(SubclassAttribute), attribute);
            // Element: <joined-subclass>
            WriteNestedJoinedSubclassTypes(writer, type);
            WriteUserDefinedContent(writer, type, typeof(JoinedSubclassAttribute), attribute);
            // Element: <union-subclass>
            WriteNestedUnionSubclassTypes(writer, type);
            WriteUserDefinedContent(writer, type, typeof(UnionSubclassAttribute), attribute);
            // Element: <resultset>
            System.Collections.ArrayList ResultSetList = FindAttributedMembers( attribute, typeof(ResultSetAttribute), type );
            foreach( System.Reflection.MemberInfo member in ResultSetList )
            {
                object[] objects = member.GetCustomAttributes(typeof(ResultSetAttribute), false);
                System.Collections.ArrayList memberAttribs = new System.Collections.ArrayList();
                memberAttribs.AddRange(objects);
                memberAttribs.Sort();
                foreach(object memberAttrib in memberAttribs)
                    WriteResultSet(writer, member, memberAttrib as ResultSetAttribute, attribute, type);
            }
            WriteUserDefinedContent(writer, type, typeof(ResultSetAttribute), attribute);
            // Element: <query>
            System.Collections.ArrayList QueryList = FindAttributedMembers( attribute, typeof(QueryAttribute), type );
            foreach( System.Reflection.MemberInfo member in QueryList )
            {
                object[] objects = member.GetCustomAttributes(typeof(QueryAttribute), false);
                System.Collections.ArrayList memberAttribs = new System.Collections.ArrayList();
                memberAttribs.AddRange(objects);
                memberAttribs.Sort();
                foreach(object memberAttrib in memberAttribs)
                    WriteQuery(writer, member, memberAttrib as QueryAttribute, attribute, type);
            }
            WriteUserDefinedContent(writer, type, typeof(QueryAttribute), attribute);
            // Element: <sql-query>
            System.Collections.ArrayList SqlQueryList = FindAttributedMembers( attribute, typeof(SqlQueryAttribute), type );
//.........这里部分代码省略.........
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:101,代码来源:HbmWriter.cs

示例5: WriteClass

        /// <summary> Write a Class XML Element from attributes in a type. </summary>
        public virtual void WriteClass(System.Xml.XmlWriter writer, System.Type type)
        {
            object[] attributes = type.GetCustomAttributes(typeof(ClassAttribute), false);
            if(attributes.Length == 0)
                return;
            ClassAttribute attribute = attributes[0] as ClassAttribute;

            writer.WriteStartElement( "class" );
            // Attribute: <entity-name>
            if(attribute.EntityName != null)
            writer.WriteAttributeString("entity-name", GetAttributeValue(attribute.EntityName, type));
            // Attribute: <name>
            if(attribute.Name != null)
            writer.WriteAttributeString("name", GetAttributeValue(attribute.Name, type));
            // Attribute: <proxy>
            if(attribute.Proxy != null)
            writer.WriteAttributeString("proxy", GetAttributeValue(attribute.Proxy, type));
            // Attribute: <lazy>
            if( attribute.LazySpecified )
            writer.WriteAttributeString("lazy", attribute.Lazy ? "true" : "false");
            // Attribute: <schema-action>
            if(attribute.SchemaAction != null)
            writer.WriteAttributeString("schema-action", GetAttributeValue(attribute.SchemaAction, type));
            // Attribute: <table>
            if(attribute.Table != null)
            writer.WriteAttributeString("table", GetAttributeValue(attribute.Table, type));
            // Attribute: <schema>
            if(attribute.Schema != null)
            writer.WriteAttributeString("schema", GetAttributeValue(attribute.Schema, type));
            // Attribute: <catalog>
            if(attribute.Catalog != null)
            writer.WriteAttributeString("catalog", GetAttributeValue(attribute.Catalog, type));
            // Attribute: <subselect>
            if(attribute.Subselect != null)
            writer.WriteAttributeString("subselect", GetAttributeValue(attribute.Subselect, type));
            // Attribute: <discriminator-value>
            if(attribute.DiscriminatorValue != null)
            writer.WriteAttributeString("discriminator-value", GetAttributeValue(attribute.DiscriminatorValue, type));
            // Attribute: <mutable>
            if( attribute.MutableSpecified )
            writer.WriteAttributeString("mutable", attribute.Mutable ? "true" : "false");
            // Attribute: <abstract>
            if( attribute.AbstractSpecified )
            writer.WriteAttributeString("abstract", attribute.Abstract ? "true" : "false");
            // Attribute: <polymorphism>
            if(attribute.Polymorphism != PolymorphismType.Unspecified)
            writer.WriteAttributeString("polymorphism", GetXmlEnumValue(typeof(PolymorphismType), attribute.Polymorphism));
            // Attribute: <where>
            if(attribute.Where != null)
            writer.WriteAttributeString("where", GetAttributeValue(attribute.Where, type));
            // Attribute: <persister>
            if(attribute.Persister != null)
            writer.WriteAttributeString("persister", GetAttributeValue(attribute.Persister, type));
            // Attribute: <dynamic-update>
            if( attribute.DynamicUpdateSpecified )
            writer.WriteAttributeString("dynamic-update", attribute.DynamicUpdate ? "true" : "false");
            // Attribute: <dynamic-insert>
            if( attribute.DynamicInsertSpecified )
            writer.WriteAttributeString("dynamic-insert", attribute.DynamicInsert ? "true" : "false");
            // Attribute: <batch-size>
            if(attribute.BatchSize != -9223372036854775808)
            writer.WriteAttributeString("batch-size", attribute.BatchSize.ToString());
            // Attribute: <select-before-update>
            if( attribute.SelectBeforeUpdateSpecified )
            writer.WriteAttributeString("select-before-update", attribute.SelectBeforeUpdate ? "true" : "false");
            // Attribute: <optimistic-lock>
            if(attribute.OptimisticLock != OptimisticLockMode.Unspecified)
            writer.WriteAttributeString("optimistic-lock", GetXmlEnumValue(typeof(OptimisticLockMode), attribute.OptimisticLock));
            // Attribute: <check>
            if(attribute.Check != null)
            writer.WriteAttributeString("check", GetAttributeValue(attribute.Check, type));
            // Attribute: <rowid>
            if(attribute.RowId != null)
            writer.WriteAttributeString("rowid", GetAttributeValue(attribute.RowId, type));
            // Attribute: <node>
            if(attribute.Node != null)
            writer.WriteAttributeString("node", GetAttributeValue(attribute.Node, type));

            WriteUserDefinedContent(writer, type, null, attribute);
            // Element: <meta>
            System.Collections.ArrayList MetaList = FindAttributedMembers( attribute, typeof(MetaAttribute), type );
            foreach( System.Reflection.MemberInfo member in MetaList )
            {
                object[] objects = member.GetCustomAttributes(typeof(MetaAttribute), false);
                System.Collections.ArrayList memberAttribs = new System.Collections.ArrayList();
                memberAttribs.AddRange(objects);
                memberAttribs.Sort();
                foreach(object memberAttrib in memberAttribs)
                    WriteMeta(writer, member, memberAttrib as MetaAttribute, attribute, type);
            }
            WriteUserDefinedContent(writer, type, typeof(MetaAttribute), attribute);
            // Element: <subselect>
            System.Collections.ArrayList SubselectList = FindAttributedMembers( attribute, typeof(SubselectAttribute), type );
            foreach( System.Reflection.MemberInfo member in SubselectList )
            {
                object[] objects = member.GetCustomAttributes(typeof(SubselectAttribute), false);
                System.Collections.ArrayList memberAttribs = new System.Collections.ArrayList();
                memberAttribs.AddRange(objects);
                memberAttribs.Sort();
//.........这里部分代码省略.........
开发者ID:pruiz,项目名称:nhibernate-contrib-old,代码行数:101,代码来源:HbmWriter.cs

示例6: Flush

		// TODO: would be nice to factor out more of this, eg the
		// FreqProxFieldMergeState, and code to visit all Fields
		// under the same FieldInfo together, up into TermsHash*.
		// Other writers would presumably share alot of this...
		
		public override void  Flush(System.Collections.IDictionary threadsAndFields, SegmentWriteState state)
		{
			
			// Gather all FieldData's that have postings, across all
			// ThreadStates
			System.Collections.ArrayList allFields = new System.Collections.ArrayList();

            System.Collections.IEnumerator it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
			while (it.MoveNext())
			{
				
				System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current;
				
				System.Collections.ICollection fields = (System.Collections.ICollection) entry.Value;
				
				System.Collections.IEnumerator fieldsIt = fields.GetEnumerator();
				
				while (fieldsIt.MoveNext())
				{
					FreqProxTermsWriterPerField perField = (FreqProxTermsWriterPerField) ((System.Collections.DictionaryEntry) fieldsIt.Current).Key;
					if (perField.termsHashPerField.numPostings > 0)
						allFields.Add(perField);
				}
			}
			
			// Sort by field name
            allFields.Sort();
			int numAllFields = allFields.Count;
			
			// TODO: allow Lucene user to customize this consumer:
			FormatPostingsFieldsConsumer consumer = new FormatPostingsFieldsWriter(state, fieldInfos);
			/*
			Current writer chain:
			FormatPostingsFieldsConsumer
			-> IMPL: FormatPostingsFieldsWriter
			-> FormatPostingsTermsConsumer
			-> IMPL: FormatPostingsTermsWriter
			-> FormatPostingsDocConsumer
			-> IMPL: FormatPostingsDocWriter
			-> FormatPostingsPositionsConsumer
			-> IMPL: FormatPostingsPositionsWriter
			*/
			
			int start = 0;
			while (start < numAllFields)
			{
				FieldInfo fieldInfo = ((FreqProxTermsWriterPerField) allFields[start]).fieldInfo;
				System.String fieldName = fieldInfo.name;
				
				int end = start + 1;
				while (end < numAllFields && ((FreqProxTermsWriterPerField) allFields[end]).fieldInfo.name.Equals(fieldName))
					end++;
				
				FreqProxTermsWriterPerField[] fields = new FreqProxTermsWriterPerField[end - start];
				for (int i = start; i < end; i++)
				{
					fields[i - start] = (FreqProxTermsWriterPerField) allFields[i];
					
					// Aggregate the storePayload as seen by the same
					// field across multiple threads
					fieldInfo.storePayloads |= fields[i - start].hasPayloads;
				}
				
				// If this field has postings then add them to the
				// segment
				AppendPostings(fields, consumer);
				
				for (int i = 0; i < fields.Length; i++)
				{
					TermsHashPerField perField = fields[i].termsHashPerField;
					int numPostings = perField.numPostings;
					perField.Reset();
					perField.ShrinkHash(numPostings);
					fields[i].Reset();
				}
				
				start = end;
			}

            it = new System.Collections.Hashtable(threadsAndFields).GetEnumerator();
			while (it.MoveNext())
			{
				System.Collections.DictionaryEntry entry = (System.Collections.DictionaryEntry) it.Current;
				FreqProxTermsWriterPerThread perThread = (FreqProxTermsWriterPerThread) entry.Key;
				perThread.termsHashPerThread.Reset(true);
			}
			
			consumer.Finish();
		}
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:94,代码来源:FreqProxTermsWriter.cs

示例7: CheckHits_Renamed

		/// <summary> Tests that a query matches the an expected set of documents using Hits.
		/// 
		/// <p>
		/// Note that when using the Hits API, documents will only be returned
		/// if they have a positive normalized score.
		/// </p>
		/// </summary>
		/// <param name="query">the query to test
		/// </param>
		/// <param name="searcher">the searcher to test the query against
		/// </param>
		/// <param name="defaultFieldName">used for displaing the query in assertion messages
		/// </param>
		/// <param name="results">a list of documentIds that must match the query
		/// </param>
		/// <seealso cref="Searcher.Search(Query)">
		/// </seealso>
		/// <seealso cref="CheckHitCollector">
		/// </seealso>
		public static void  CheckHits_Renamed(Query query, System.String defaultFieldName, Searcher searcher, int[] results)
		{
			if (searcher is IndexSearcher)
			{
				QueryUtils.Check(query, (IndexSearcher) searcher);
			}
			
			Hits hits = searcher.Search(query);
			
			System.Collections.ArrayList correct = new System.Collections.ArrayList(results.Length);
			for (int i = 0; i < results.Length; i++)
			{
				correct.Add(results[i]);
			}

			System.Collections.ArrayList actual = new System.Collections.ArrayList(hits.Length());
			for (int i = 0; i < hits.Length(); i++)
			{
				actual.Add(hits.Id(i));
			}
			
			Assert.AreEqual(correct.Count, actual.Count);
			correct.Sort();
			actual.Sort();
			for (int i = 0; i < correct.Count; i++)
			{
				Assert.AreEqual(correct[i], actual[i]);
			}
			
			QueryUtils.Check(query, searcher);
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:50,代码来源:CheckHits.cs

示例8: csvAllResult

        public static void csvAllResult(System.Collections.Hashtable raceStat, string datFile, infoRace currInfoRace)
        {
            System.Collections.ArrayList sorted = new System.Collections.ArrayList();
            System.Collections.IDictionaryEnumerator tmpRaceStat = raceStat.GetEnumerator();
            while (tmpRaceStat.MoveNext())	//for each player
            {
                raceStats p = (raceStats)tmpRaceStat.Value;
                sorted.Add(p);
            }
            raceStats.modeSort = (int)sortRaceStats.SORT_RESULT;
            sorted.Sort();

            if(!Directory.Exists("Export"))
                System.IO.Directory.CreateDirectory("Export");

            var raceEngine = new DelimitedFileEngine<infoRace>();
            raceEngine.HeaderText = "datFile,currentTrackName,maxSplit,weather,wind,raceLaps,sraceLaps,qualMins,HName,currLap,isToc";
            var raceResults = new List<infoRace>();
            currInfoRace.datFile = datFile;
            raceResults.Add(currInfoRace);
            raceEngine.WriteFile("Export/" + datFile + "_race.csv", raceResults);

            var engine = new DelimitedFileEngine<raceStats>();
            engine.HeaderText = "datFile,UCID,PLID,userName,nickName,Plate,bestSplit1,lapBestSplit1,bestSplit2,lapBestSplit2,bestSplit3,lapBestSplit3,bestLastSplit,lapBestLastSplit,cumuledTime,bestSpeed,lapBestSpeed,numStop,cumuledStime,resultNum,finalPos,finished,finPLID,totalTime,bestLap,lapBestLap,CName,penalty,gridPos,lapsLead,tmpTime,firstTime,avgTime,curBestSplit,curWrSplit,curLapBestSplit,lapStability,curSplit1,curSplit2,curSplit3,yellowFlags,inYellow,blueFlags,inBlue,sFlags,numPen,lastSplit,CurrIdxSplit";

            List<raceStats> results = new List<raceStats>();
            foreach (raceStats r in sorted)
            {
                r.datFile = datFile;
                results.Add(r);
            }

            engine.WriteFile("Export/" + datFile + "_results_race.csv", results);

            List<Lap> lapResults = new List<Lap>();
            foreach (raceStats r in sorted)
            {
                int i = 1;
                foreach (Lap lap in r.lap)
                {
                    lap.datFile = datFile;
                    lap.UCID = r.UCID;
                    lap.PLID = r.PLID;
                    lap.lap = i++;
                    lapResults.Add((Lap)lap);
                }
            }

            var engine2 = new DelimitedFileEngine<Lap>();
            engine2.HeaderText = "datFile,UCID,PLID,lap,split1,split2,split3,lapTime,cumuledTime";
            engine2.WriteFile("Export/" + datFile + "_results_race_laps.csv", lapResults);

            ////this.ContentTypeFilters.Register(ContentType.Csv, CsvSerializer.SerializeToStream, CsvSerializer.DeserializeFromStream);

            ////using (System.IO.StreamWriter sw = new System.IO.StreamWriter("Export/" + datFile + "_results_race.csv"))
            ////{
            //    //int curPos = 0;
            //    for (int i = 0; i < sorted.Count; i++)
            //    {

            //        raceStats p = (raceStats)sorted[i];

            //        //curPos++;
            //        //raceStats p = (raceStats)sorted[i];
            //        //if (i == 0)
            //        //{
            //        //    firstMaxLap = p.lap.Count;
            //        //    firstTotalTime = p.totalTime;
            //        //}
            //        //string resultLine = formatLine;
            //        //resultLine = resultLine.Replace("[RaceResults ", "");
            //        //resultLine = resultLine.Replace("]", "");
            //        //resultLine = resultLine.Replace("{Position}", curPos.ToString());
            //        ////                    resultLine = resultLine.Replace("{Position}", p.resultNum.ToString() );
            //        //resultLine = resultLine.Replace("{PlayerName}", p.nickName.Replace("^0", "").Replace("^1", "").Replace("^2", "").Replace("^3", "").Replace("^4", "").Replace("^5", "").Replace("^6", "").Replace("^7", "").Replace("^8", ""));
            //        //resultLine = resultLine.Replace("{UserName}", p.userName);
            //        //resultLine = resultLine.Replace("{Car}", p.CName);
            //        //// if Racer do not finish
            //        //if (p.resultNum == 999)
            //        //    resultLine = resultLine.Replace("{Gap}", "DNF");
            //        //else
            //        //{
            //        //    if (firstMaxLap == p.lap.Count)
            //        //    {
            //        //        if (i == 0)
            //        //            resultLine = resultLine.Replace("{Gap}", raceStats.LfstimeToString(p.totalTime));
            //        //        else
            //        //        {
            //        //            long tres;
            //        //            tres = p.totalTime - firstTotalTime;
            //        //            resultLine = resultLine.Replace("{Gap}", "+" + raceStats.LfstimeToString(tres));
            //        //        }
            //        //    }
            //        //    else
            //        //        resultLine = resultLine.Replace("{Gap}", "+" + ((int)(firstMaxLap - p.lap.Count)).ToString() + " laps");
            //        //}
            //        //resultLine = resultLine.Replace("{BestLap}", raceStats.LfstimeToString(p.bestLap));
            //        //resultLine = resultLine.Replace("{LapsDone}", p.lap.Count.ToString());
            //        //resultLine = resultLine.Replace("{PitsDone}", p.numStop.ToString());
            //        //resultLine = resultLine.Replace("{Penalty}", p.penalty);
//.........这里部分代码省略.........
开发者ID:ptownsin,项目名称:LFS_Stats_CSV,代码行数:101,代码来源:DoofusExtensions.cs

示例9: ResortToolStripItemCollection

        private void ResortToolStripItemCollection(ToolStripItemCollection coll)
        {
            System.Collections.ArrayList oAList = new System.Collections.ArrayList(coll);
            oAList.Sort(new ToolStripItemComparer());
            coll.Clear();

            foreach (ToolStripItem oItem in oAList)
            {
                coll.Add(oItem);
            }
        }
开发者ID:Theo47,项目名称:depressurizer,代码行数:11,代码来源:MainForm.cs

示例10: WriteSegment

		/// <summary>Creates a segment from all Postings in the Postings
		/// hashes across all ThreadStates & FieldDatas. 
		/// </summary>
		private System.Collections.IList WriteSegment()
		{
			
			System.Diagnostics.Debug.Assert(AllThreadsIdle());
			
			System.Diagnostics.Debug.Assert(nextDocID == numDocsInRAM);
			
			System.String segmentName;
			
			segmentName = segment;
			
			TermInfosWriter termsOut = new TermInfosWriter(directory, segmentName, fieldInfos, writer.GetTermIndexInterval());
			
			IndexOutput freqOut = directory.CreateOutput(segmentName + ".frq");
			IndexOutput proxOut = directory.CreateOutput(segmentName + ".prx");
			
			// Gather all FieldData's that have postings, across all
			// ThreadStates
			System.Collections.ArrayList allFields = new System.Collections.ArrayList();
			System.Diagnostics.Debug.Assert(AllThreadsIdle());
			for (int i = 0; i < threadStates.Length; i++)
			{
				ThreadState state = threadStates[i];
				state.TrimFields();
				int numFields = state.numAllFieldData;
				for (int j = 0; j < numFields; j++)
				{
					ThreadState.FieldData fp = state.allFieldDataArray[j];
					if (fp.numPostings > 0)
						allFields.Add(fp);
				}
			}
			
			// Sort by field name
			allFields.Sort();
			int numAllFields = allFields.Count;
			
			skipListWriter = new DefaultSkipListWriter(termsOut.skipInterval, termsOut.maxSkipLevels, numDocsInRAM, freqOut, proxOut);
			
			int start = 0;
			while (start < numAllFields)
			{
				
				System.String fieldName = ((ThreadState.FieldData) allFields[start]).fieldInfo.name;
				
				int end = start + 1;
				while (end < numAllFields && ((ThreadState.FieldData) allFields[end]).fieldInfo.name.Equals(fieldName))
					end++;
				
				ThreadState.FieldData[] fields = new ThreadState.FieldData[end - start];
				for (int i = start; i < end; i++)
					fields[i - start] = (ThreadState.FieldData) allFields[i];
				
				// If this field has postings then add them to the
				// segment
				AppendPostings(fields, termsOut, freqOut, proxOut);
				
				for (int i = 0; i < fields.Length; i++)
					fields[i].ResetPostingArrays();
				
				start = end;
			}
			
			freqOut.Close();
			proxOut.Close();
			termsOut.Close();
			
			// Record all files we have flushed
			System.Collections.IList flushedFiles = new System.Collections.ArrayList();
			flushedFiles.Add(SegmentFileName(IndexFileNames.FIELD_INFOS_EXTENSION));
			flushedFiles.Add(SegmentFileName(IndexFileNames.FREQ_EXTENSION));
			flushedFiles.Add(SegmentFileName(IndexFileNames.PROX_EXTENSION));
			flushedFiles.Add(SegmentFileName(IndexFileNames.TERMS_EXTENSION));
			flushedFiles.Add(SegmentFileName(IndexFileNames.TERMS_INDEX_EXTENSION));
			
			if (hasNorms)
			{
				WriteNorms(segmentName, numDocsInRAM);
				flushedFiles.Add(SegmentFileName(IndexFileNames.NORMS_EXTENSION));
			}
			
			if (infoStream != null)
			{
				long newSegmentSize = SegmentSize(segmentName);
				System.String message = String.Format(nf, "  oldRAMSize={0:d} newFlushedSize={1:d} docs/MB={2:f} new/old={3:%}",
					new Object[] { numBytesUsed, newSegmentSize, (numDocsInRAM / (newSegmentSize / 1024.0 / 1024.0)), (newSegmentSize / numBytesUsed) });
				infoStream.WriteLine(message);
			}
			
			ResetPostingsData();
			
			nextDocID = 0;
			nextWriteDocID = 0;
			numDocsInRAM = 0;
			files = null;
			
			// Maybe downsize postingsFreeList array
//.........这里部分代码省略.........
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:101,代码来源:DocumentsWriter.cs

示例11: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            player = Wc3o.Game.CurrentPlayer;

            if (Request.QueryString["League"] != null) {

                DataTable ranking = new DataTable();
                ranking.Columns.Add("Rank", typeof(String));
                ranking.Columns.Add("Name", typeof(String));
                ranking.Columns.Add("Score", typeof(String));

                if (Request.QueryString["League"] == "0") {
                    pnlPlayer.Visible = false;
                    pnlAlliance.Visible = true;
                    ranking.Columns.Add("Members", typeof(String));
                    ranking.Columns.Add("Average", typeof(String));

                    System.Collections.ArrayList alliances = new System.Collections.ArrayList();
                    foreach (Alliance a in Wc3o.Game.GameData.Alliances.Values)
                        alliances.Add(a);

                    alliances.Sort(new Wc3o.AllianceScoreComparer());
                    int rank = 1;

                    foreach (Alliance alliance in alliances) {
                        int numberOfMembers = alliance.AcceptedMembers.Count;
                        int score = alliance.Score;
                        if (numberOfMembers > 0 && score > 0) {

                            string rankFormat = "<div>";
                            string userFormat = "<div>";

                            if (player.Alliance == alliance)
                                userFormat = "<div style='color:" + Configuration.Color_Ally + "'>";
                            else
                                userFormat = "<div style='color:" + Configuration.Color_Enemy + "'>";

                            if (rank == 1)
                                rankFormat = "<div style='font-size:19px;'>";
                            else if (rank == 2)
                                rankFormat = "<div style='font-size:17px;'>";
                            else if (rank == 3)
                                rankFormat = "<div style='font-size:15px;'>";
                            else if (rank < 11)
                                rankFormat = "<div style='font-size:13px;'>";
                            else
                                rankFormat = "<div style='font-size:11xp;'>";

                            DataRow row = ranking.NewRow();
                            row["Rank"] = rankFormat + userFormat + Wc3o.Game.Format(rank) + "</div></div>";
                            row["Name"] = "<a href='AllianceInfo.aspx?Alliance=" + alliance.Name + "'>" + rankFormat + userFormat + alliance.FullName + "</div></div></a>";
                            row["Score"] = rankFormat + userFormat + Wc3o.Game.Format(score) + "</div></div>";
                            row["Members"] = rankFormat + userFormat + Wc3o.Game.Format(numberOfMembers) + "</div></div>";
                            row["Average"] = rankFormat + userFormat + Wc3o.Game.Format((int)(alliance.Score / numberOfMembers)) + "</div></div>";
                            ranking.Rows.Add(row);
                            rank++;
                        }
                    }

                    grdAlliance.DataSource = ranking;
                    grdAlliance.DataBind();
                }
                else {
                    pnlPlayer.Visible = true;
                    pnlAlliance.Visible = false;
                    ranking.Columns.Add("Image", typeof(String));

                    int league = int.Parse(Request.QueryString["League"]);
                    List<Player> players = new List<Player>();
                    foreach (Player p in Wc3o.Game.GetPlayers(league))
                        players.Add(p);
                    players.Sort(new PlayerScoreComparer());

                    #region " Checks if the given league is valid "
                    int rankedPlayers = 0;
                    foreach (Player p in Wc3o.Game.GameData.Players.Values)
                        if (p.Score > 0)
                            rankedPlayers++;

                    int maxLeague = Wc3o.Game.GetLeague(rankedPlayers);
                    if (league > maxLeague || league < 0)
                        Response.Redirect("Ranking.aspx?League=" + player.League, true);
                    #endregion

                    #region " Fills lblLeague and lblLeagues "
                    for (int i = 1; i <= maxLeague; i++)
                        if (i != league)
                            lblLeagues.Text += "[<a href='Ranking.aspx?League=" + i.ToString() + "'>League " + i + "</a>] ";
                    lblLeague.Text = Wc3o.Game.Format(league);
                    #endregion

                    foreach (Player p in players) {
                        string rankFormat = "";
                        string userFormat = "";

                        if (player == p)
                            userFormat = "<div style='color:" + Configuration.Color_Player + "'>";
                        else if (player.IsAlly(p))
                            userFormat = "<div style='color:" + Configuration.Color_Ally + "'>";
                        else if (player.CanAttack(p))
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:wc3o-svn,代码行数:101,代码来源:Ranking.aspx.cs

示例12: MostrarColeccionesNoGenerics


//.........这里部分代码省略.........
            for (int i = 0; i < cantidad; i++)
            {
                Console.WriteLine("Elemento {0} = {1}", i, cola.Dequeue());
            }

            Console.ReadLine();

            Console.WriteLine("Cantidad de elementos en la cola = {0}", cola.Count);
            Console.ReadLine();

            Console.Clear();
            Console.WriteLine("******************************");
            Console.WriteLine("******Listas Dinamicas********");
            Console.WriteLine("******************************");
            Console.ReadLine();

            System.Collections.ArrayList vec = new System.Collections.ArrayList();

            vec.Add(1);
            vec.Add(4);
            vec.Add(3);
            vec.Add(2);

            Console.WriteLine("Agrego elementos al ArrayList...");
            Console.WriteLine("Utilizo vec.Add()");
            Console.WriteLine("Orden de los elementos: 1 - 4 - 3 - 2");
            Console.ReadLine();

            Console.WriteLine("Muestro todos los elementos del ArrayList...");
            Console.WriteLine("Recorro con un foreach");
            Console.ReadLine();

            foreach (int elemento in vec)
            {
                Console.WriteLine(elemento);
            }

            Console.ReadLine();

            Console.WriteLine("Ordeno los elementos del ArrayList...");
            Console.WriteLine("Utilizo vec.Sort(). Recorro con un for");
            Console.ReadLine();

            vec.Sort();

            cantidad = vec.Count;

            for (int i = 0; i < cantidad; i++)
            {
                Console.WriteLine("Elemento {0} = {1}", i, vec[i]);
            }

            Console.ReadLine();

            Console.WriteLine("Ordeno los elementos del ArrayList...");
            Console.WriteLine("Utilizo vec.Reverse(). Recorro con un for");
            Console.ReadLine();

            vec.Reverse();

            cantidad = vec.Count;

            for (int i = 0; i < cantidad; i++)
            {
                Console.WriteLine("Elemento {0} = {1}", i, vec[i]);
            }

            Console.ReadLine();

            Console.Clear();
            Console.WriteLine("******************************");
            Console.WriteLine("*********HashTable************");
            Console.WriteLine("******************************");
            Console.ReadLine();

            System.Collections.Hashtable ht = new System.Collections.Hashtable();

            ht.Add(1, "valor 1");
            ht.Add(4, "valor 4");
            ht.Add(3, "valor 3");
            ht.Add(2, "valor 2");

            Console.WriteLine("Agrego elementos al HashTable...");
            Console.WriteLine("Utilizo vec.Add()");
            Console.WriteLine("Orden de los elementos: 1 - 4 - 3 - 2");
            Console.ReadLine();

            Console.WriteLine("Muestro todos los elementos del HashTable...");
            Console.WriteLine("Recorro con un for");
            Console.ReadLine();

            cantidad = ht.Count;

            for (int i = 1; i <= cantidad; i++)
            {
                Console.WriteLine("Elemento {0} = {1}", i, ht[i]);
            }

            Console.ReadLine();
        }
开发者ID:EugeniaPereyra,项目名称:EjemploDeColecciones,代码行数:101,代码来源:FuncionesColecciones.cs

示例13: CheckHits_Renamed_Method

		/// <summary> Tests that a query matches the an expected set of documents using Hits.
		/// 
		/// <p/>
		/// Note that when using the Hits API, documents will only be returned
		/// if they have a positive normalized score.
		/// <p/>
		/// </summary>
		/// <param name="query">the query to test
		/// </param>
		/// <param name="searcher">the searcher to test the query against
		/// </param>
		/// <param name="defaultFieldName">used for displaing the query in assertion messages
		/// </param>
		/// <param name="results">a list of documentIds that must match the query
		/// </param>
		/// <seealso cref="Searcher.Search(Query)">
		/// </seealso>
		/// <seealso cref="checkHitCollector">
		/// </seealso>
		public static void  CheckHits_Renamed_Method(Query query, System.String defaultFieldName, Searcher searcher, int[] results)
		{
			if (searcher is IndexSearcher)
			{
				QueryUtils.Check(query, searcher);
			}
			
			ScoreDoc[] hits = searcher.Search(query, null, 1000).scoreDocs;
			
			System.Collections.ArrayList correct = new System.Collections.ArrayList();
			for (int i = 0; i < results.Length; i++)
			{
                SupportClass.CollectionsHelper.AddIfNotContains(correct, results[i]);
			}
            correct.Sort();
			
			System.Collections.ArrayList actual = new System.Collections.ArrayList();
			for (int i = 0; i < hits.Length; i++)
			{
				SupportClass.CollectionsHelper.AddIfNotContains(actual, hits[i].doc);
			}
            actual.Sort();
			
			Assert.AreEqual(correct, actual, query.ToString(defaultFieldName));
			
			QueryUtils.Check(query, searcher);
		}
开发者ID:Rationalle,项目名称:ravendb,代码行数:46,代码来源:CheckHits.cs

示例14: GetPriorityQueueData

        protected OutputQueueData[] GetPriorityQueueData(System.Collections.IComparer I_compare)
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();
            if (outputQueue.Count == 0)
                return new OutputQueueData[0];
            else
            {

                System.Collections.IEnumerator ie = outputQueue.GetEnumerator();
                while (ie.MoveNext())
                {
                    OutputQueueData quedata = (OutputQueueData)((System.Collections.DictionaryEntry)ie.Current).Value;

                    ary.Add(quedata);
                }

            }

            ary.Sort(I_compare);
            OutputQueueData[] data = new OutputQueueData[ary.Count];
            for (int i = 0; i < ary.Count; i++)
                data[i] = ary[i] as OutputQueueData;

            return data;
        }
开发者ID:ufjl0683,项目名称:Center,代码行数:25,代码来源:OutPutDeviceBase.cs

示例15: GetStandardValues

        /// <summary>
        /// �����ʽ������һ���ṩʱ�����ش�����ת����������ڵ��������͵ı�׼ֵ���ϡ�
        /// </summary>
        /// <param name="context">�ṩ��ʽ�����ĵ� ITypeDescriptorContext����������ȡ�йش��е��ô�ת�����Ļ����ĸ�����Ϣ���˲����������Կ���Ϊ�����á�</param>
        /// <returns>������׼��Чֵ���� TypeConverter.StandardValuesCollection������������Ͳ�֧�ֱ�׼ֵ������Ϊ�����á�</returns>
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            System.Collections.ArrayList list=new System.Collections.ArrayList();

            foreach(System.ComponentModel.IComponent componet in context.Container.Components)
            {
                if(componet is  ButtonEx)
                {
                    list.Add(((ButtonEx)componet).ID);
                }
            }

            list.Sort();

            return new StandardValuesCollection(list.ToArray());
        }
开发者ID:jeasonyoung,项目名称:csharp_ipower,代码行数:21,代码来源:ButtonExConverter.cs


注:本文中的System.Collections.ArrayList.Sort方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。