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


C# System.Collections.IList.Add方法代码示例

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


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

示例1: Add

 public virtual void Add( object el )
 {
     //System.out.println("add '"+elementDescription+"' is "+el);
     if ( el == null )
     {
         return;
     }
     if ( elements != null )
     { // if in list, just add
         elements.Add( el );
         return;
     }
     if ( singleElement == null )
     { // no elements yet, track w/o list
         singleElement = el;
         return;
     }
     // adding 2nd element, move to list
     elements = new List<object>( 5 );
     elements.Add( singleElement );
     singleElement = null;
     elements.Add( el );
 }
开发者ID:EightPillars,项目名称:PathwayEditor,代码行数:23,代码来源:RewriteRuleElementStream.cs

示例2: ByteArrayPool

			internal ByteArrayPool(int capacity, int size)
			{
				pool = new System.Collections.ArrayList();
				for (int i = 0; i < capacity; i++)
				{
					pool.Add(new byte[size]);
				}
			}
开发者ID:VirtueMe,项目名称:ravendb,代码行数:8,代码来源:TestPayloads.cs

示例3: GetErrors

        /// <summary>
        /// Returns a page of errors from the databse in descending order 
        /// of logged time.
        /// </summary>

        public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
        {
            if (pageIndex < 0)
                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);

            if (pageSize < 0)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);

            VistaDBConnectionStringBuilder builder = new VistaDBConnectionStringBuilder(_connectionString);


            // Use the VistaDB Direct Data Access objects
            IVistaDBDDA ddaObjects = VistaDBEngine.Connections.OpenDDA();
            // Create a connection object to a VistaDB database
            IVistaDBDatabase vistaDB = ddaObjects.OpenDatabase(_databasePath, builder.OpenMode, builder.Password);
            // Open the table
            IVistaDBTable elmahTable = vistaDB.OpenTable("ELMAH_Error", false, true);

            elmahTable.ActiveIndex = "IX_ELMAH_Error_App_Time_Id";

            if (errorEntryList != null)
            {
                if (!elmahTable.EndOfTable)
                {
                    // move to the correct record
                    elmahTable.First();
                    elmahTable.MoveBy(pageIndex * pageSize);

                    int rowsProcessed = 0;

                    // Traverse the table to get the records we want
                    while (!elmahTable.EndOfTable && rowsProcessed < pageSize)
                    {
                        rowsProcessed++;

                        string id = Convert.ToString(elmahTable.Get("ErrorId").Value, CultureInfo.InvariantCulture);
                        Error error = new Error();

                        error.ApplicationName = (string)elmahTable.Get("Application").Value;
                        error.HostName = (string)elmahTable.Get("Host").Value;
                        error.Type = (string)elmahTable.Get("Type").Value;
                        error.Source = (string)elmahTable.Get("Source").Value;
                        error.Message = (string)elmahTable.Get("Message").Value;
                        error.User = (string)elmahTable.Get("User").Value;
                        error.StatusCode = (int)elmahTable.Get("StatusCode").Value;
                        error.Time = ((DateTime)elmahTable.Get("TimeUtc").Value).ToLocalTime();

                        errorEntryList.Add(new ErrorLogEntry(this, id, error));

                        // move to the next record
                        elmahTable.Next();
                    }
                }
            }
            
            return Convert.ToInt32(elmahTable.RowCount);
        }
开发者ID:kjana83,项目名称:ELMAH,代码行数:62,代码来源:VistaDBErrorLog.cs

示例4: Mark

        /// <summary>
        /// Record the current state of the tree walk which includes
        /// the current node and stack state as well as the lookahead
        /// buffer.
        /// </summary>
        public virtual int Mark()
        {
            if (markers == null)
            {
                markers = new ArrayList();
                markers.Add(null); // depth 0 means no backtracking, leave blank
            }
            markDepth++;
            TreeWalkState state = null;
            if ( markDepth >= markers.Count )
            {
                state = new TreeWalkState();
                markers.Add(state);
            }
            else
            {
                state = (TreeWalkState)markers[markDepth];

            }
            state.absoluteNodeIndex = absoluteNodeIndex;
            state.currentChildIndex = currentChildIndex;
            state.currentNode = currentNode;
            state.previousNode = previousNode;
            state.nodeStackSize = nodeStack.Count;
            state.indexStackSize = indexStack.Count;
            // take snapshot of lookahead buffer
            int n = LookaheadSize;
            int i = 0;
            state.lookahead = new object[n];
            for (int k = 1; k <= n; k++, i++)
            {
                state.lookahead[i] = LT(k);
            }
            lastMarker = markDepth;
            return markDepth;
        }
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:41,代码来源:UnBufferedTreeNodeStream.cs

示例5: CommitPoint

			public CommitPoint(IndexFileDeleter enclosingInstance, SegmentInfos segmentInfos)
			{
				InitBlock(enclosingInstance);
				segmentsFileName = segmentInfos.GetCurrentSegmentFileName();
				int size = segmentInfos.Count;
				files = new System.Collections.ArrayList(size);
				files.Add(segmentsFileName);
				gen = segmentInfos.GetGeneration();
				for (int i = 0; i < size; i++)
				{
					SegmentInfo segmentInfo = segmentInfos.Info(i);
					if (segmentInfo.dir == Enclosing_Instance.directory)
					{
                        System.Collections.IEnumerator filesEnum = segmentInfo.Files().GetEnumerator();
                        while (filesEnum.MoveNext())
                        {
                            files.Add(filesEnum.Current);
                        }
					}
				}
			}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:21,代码来源:IndexFileDeleter.cs

示例6: loadFormats

 private void loadFormats()
 {
     if (formats == null)
     {
         formats = new System.Collections.ArrayList();
         try
         {
             //logger.debug("Starting loading Formats...");
             //UPGRADE_TODO: The differences in the expected value  of parameters for constructor 'java.io.BufferedReader.BufferedReader'  may cause compilation errors.  "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1092'"
             //UPGRADE_WARNING: At least one expression was used more than once in the target code. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1181'"
             //UPGRADE_ISSUE: Method 'java.lang.ClassLoader.getResourceAsStream' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassLoader'"
             //UPGRADE_ISSUE: Method 'java.lang.Class.getClassLoader' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetClassLoader'"
             System.IO.StreamReader reader = new System.IO.StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("NuGenCDKSharp." + IO_FORMATS_LIST));//new System.IO.StreamReader(this.GetType().getClassLoader().getResourceAsStream(IO_FORMATS_LIST), System.Text.Encoding.Default).BaseStream, new System.IO.StreamReader(this.GetType().getClassLoader().getResourceAsStream(IO_FORMATS_LIST), System.Text.Encoding.Default).CurrentEncoding);
             int formatCount = 0;
             while (reader.Peek() != -1)
             {
                 // load them one by one
                 System.String formatName = reader.ReadLine();
                 formatCount++;
                 try
                 {
                     //UPGRADE_ISSUE: Method 'java.lang.ClassLoader.loadClass' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassLoader'"
                     //UPGRADE_ISSUE: Method 'java.lang.Class.getClassLoader' was not converted. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1000_javalangClassgetClassLoader'"
                     ObjectHandle handle = System.Activator.CreateInstance("NuGenCDKSharp", formatName);
                     IResourceFormat format = (IResourceFormat)handle.Unwrap();//System.Activator.CreateInstance(//this.GetType().getClassLoader().loadClass(formatName));
                     if (format is IChemFormat)
                     {
                         formats.Add(format);
                         //logger.info("Loaded IChemFormat: " + format.GetType().FullName);
                     }
                 }
                 //UPGRADE_NOTE: Exception 'java.lang.ClassNotFoundException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
                 catch (System.Exception exception)
                 {
                     //logger.error("Could not find this IResourceFormat: ", formatName);
                     //logger.debug(exception);
                 }
                 //catch (System.Exception exception)
                 //{
                 //    //logger.error("Could not load this IResourceFormat: ", formatName);
                 //    //logger.debug(exception);
                 //}
             }
             //logger.info("Number of loaded formats used in detection: ", formatCount);
         }
         catch (System.Exception exception)
         {
             //logger.error("Could not load this io format list: ", IO_FORMATS_LIST);
             //logger.debug(exception);
         }
     }
 }
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:52,代码来源:WriterFactory.cs

示例7: WalkSerializingFA

        protected virtual void WalkSerializingFA( IList lines, State s )
        {
            if ( markedStates.Contains( s ) )
            {
                return; // already visited this node
            }

            markedStates.Add( s ); // mark this node as completed.

            int normalizedStateNumber = s.stateNumber;
            if ( stateNumberTranslator != null )
            {
                normalizedStateNumber = stateNumberTranslator[s];
            }

            string stateStr = GetStateString( normalizedStateNumber, s );

            // depth first walk each transition, printing its edge first
            for ( int i = 0; i < s.NumberOfTransitions; i++ )
            {
                Transition edge = (Transition)s.GetTransition( i );
                StringBuilder buf = new StringBuilder();
                buf.Append( stateStr );
                if ( edge.IsAction )
                {
                    buf.Append( "-{}->" );
                }
                else if ( edge.IsEpsilon )
                {
                    buf.Append( "->" );
                }
                else if ( edge.IsSemanticPredicate )
                {
                    buf.Append( "-{" + edge.label.SemanticContext + "}?->" );
                }
                else
                {
                    string predsStr = "";
                    if ( edge.target is DFAState )
                    {
                        // look for gated predicates; don't add gated to simple sempred edges
                        SemanticContext preds =
                            ( (DFAState)edge.target ).GetGatedPredicatesInNFAConfigurations();
                        if ( preds != null )
                        {
                            predsStr = "&&{" +
                                preds.GenExpr( grammar.generator,
                                              grammar.generator.Templates, null ).ToString()
                                + "}?";
                        }
                    }
                    buf.Append( "-" + edge.label.ToString( grammar ) + predsStr + "->" );
                }

                int normalizedTargetStateNumber = edge.target.stateNumber;
                if ( stateNumberTranslator != null )
                {
                    normalizedTargetStateNumber = stateNumberTranslator[edge.target];
                }
                buf.Append( GetStateString( normalizedTargetStateNumber, edge.target ) );
                buf.Append( "\n" );
                lines.Add( buf.ToString() );

                // walk this transition
                WalkSerializingFA( lines, edge.target );

                // if this transition is a rule reference, the node "following" this state
                // will not be found and appear to be not in graph.  Must explicitly jump
                // to it, but don't "draw" an edge.
                if ( edge is RuleClosureTransition )
                {
                    WalkSerializingFA( lines, ( (RuleClosureTransition)edge ).followState );
                }
            }
        }
开发者ID:bszafko,项目名称:antlrcs,代码行数:75,代码来源:FASerializer.cs

示例8: ErrorsXmlToList

        private void ErrorsXmlToList(XmlReader reader, IList errorEntryList)
        {
            Debug.Assert(reader != null);

            if (errorEntryList != null)
            {
                while (reader.IsStartElement("error"))
                {
                    string id = reader.GetAttribute("errorId");
                    Error error = ErrorXml.Decode(reader);
                    errorEntryList.Add(new ErrorLogEntry(this, id, error));
                }
            }
        }
开发者ID:kjana83,项目名称:ELMAH,代码行数:14,代码来源:SqlErrorLog.cs

示例9: Files

		/*
		* Return all files referenced by this SegmentInfo.  The
		* returns List is a locally cached List so you should not
		* modify it.
		*/
		
		public System.Collections.IList Files()
		{
			
			if (files != null)
			{
				// Already cached:
				return files;
			}
			
			files = new System.Collections.ArrayList();
			
			bool useCompoundFile = GetUseCompoundFile();
			
			if (useCompoundFile)
			{
				files.Add(name + "." + IndexFileNames.COMPOUND_FILE_EXTENSION);
			}
			else
			{
				System.String[] exts = IndexFileNames.NON_STORE_INDEX_EXTENSIONS;
				for (int i = 0; i < exts.Length; i++)
					AddIfExists(files, name + "." + exts[i]);
			}
			
			if (docStoreOffset != - 1)
			{
				// We are sharing doc stores (stored fields, term
				// vectors) with other segments
				System.Diagnostics.Debug.Assert(docStoreSegment != null);
				if (docStoreIsCompoundFile)
				{
					files.Add(docStoreSegment + "." + IndexFileNames.COMPOUND_FILE_STORE_EXTENSION);
				}
				else
				{
					System.String[] exts = IndexFileNames.STORE_INDEX_EXTENSIONS;
					for (int i = 0; i < exts.Length; i++)
						AddIfExists(files, docStoreSegment + "." + exts[i]);
				}
			}
			else if (!useCompoundFile)
			{
				// We are not sharing, and, these files were not
				// included in the compound file
				System.String[] exts = IndexFileNames.STORE_INDEX_EXTENSIONS;
				for (int i = 0; i < exts.Length; i++)
					AddIfExists(files, name + "." + exts[i]);
			}
			
			System.String delFileName = IndexFileNames.FileNameFromGeneration(name, "." + IndexFileNames.DELETES_EXTENSION, delGen);
			if (delFileName != null && (delGen >= YES || dir.FileExists(delFileName)))
			{
				files.Add(delFileName);
			}
			
			// Careful logic for norms files    
			if (normGen != null)
			{
				for (int i = 0; i < normGen.Length; i++)
				{
					long gen = normGen[i];
					if (gen >= YES)
					{
						// Definitely a separate norm file, with generation:
						files.Add(IndexFileNames.FileNameFromGeneration(name, "." + IndexFileNames.SEPARATE_NORMS_EXTENSION + i, gen));
					}
					else if (NO == gen)
					{
						// No separate norms but maybe plain norms
						// in the non compound file case:
						if (!hasSingleNormFile && !useCompoundFile)
						{
							System.String fileName = name + "." + IndexFileNames.PLAIN_NORMS_EXTENSION + i;
							if (dir.FileExists(fileName))
							{
								files.Add(fileName);
							}
						}
					}
					else if (CHECK_DIR == gen)
					{
						// Pre-2.1: we have to check file existence
						System.String fileName = null;
						if (useCompoundFile)
						{
							fileName = name + "." + IndexFileNames.SEPARATE_NORMS_EXTENSION + i;
						}
						else if (!hasSingleNormFile)
						{
							fileName = name + "." + IndexFileNames.PLAIN_NORMS_EXTENSION + i;
						}
						if (fileName != null && dir.FileExists(fileName))
						{
							files.Add(fileName);
//.........这里部分代码省略.........
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:101,代码来源:SegmentInfo.cs

示例10: GetErrors

        /// <summary>
        /// Returns a page of errors from the databse in descending order 
        /// of logged time.
        /// </summary>

        public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
        {
            if (pageIndex < 0)
                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);

            if (pageSize < 0)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);

            using (OracleConnection connection = new OracleConnection(this.ConnectionString))
            using (OracleCommand command = connection.CreateCommand())
            {
                command.CommandText = _schemaOwner + "pkg_elmah$get_error.GetErrorsXml";
                command.CommandType = CommandType.StoredProcedure;

                OracleParameterCollection parameters = command.Parameters;

                parameters.Add("v_Application", OracleType.NVarChar, _maxAppNameLength).Value = ApplicationName;
                parameters.Add("v_PageIndex", OracleType.Int32).Value = pageIndex;
                parameters.Add("v_PageSize", OracleType.Int32).Value = pageSize;
                parameters.Add("v_TotalCount", OracleType.Int32).Direction = ParameterDirection.Output;
                parameters.Add("v_Results", OracleType.Cursor).Direction = ParameterDirection.Output;

                connection.Open();

                using (OracleDataReader reader = command.ExecuteReader())
                {
                    Debug.Assert(reader != null);

                    if (errorEntryList != null)
                    {
                        while (reader.Read())
                        {
                            string id = reader["ErrorId"].ToString();
                            Guid guid = new Guid(id);

                            Error error = new Error();

                            error.ApplicationName = reader["Application"].ToString();
                            error.HostName = reader["Host"].ToString();
                            error.Type = reader["Type"].ToString();
                            error.Source = reader["Source"].ToString();
                            error.Message = reader["Message"].ToString();
                            error.User = reader["UserName"].ToString();
                            error.StatusCode = Convert.ToInt32(reader["StatusCode"]);
                            error.Time = Convert.ToDateTime(reader["TimeUtc"]).ToLocalTime();

                            errorEntryList.Add(new ErrorLogEntry(this, guid.ToString(), error));
                        }
                    }
                    reader.Close();
                }

                return (int)command.Parameters["v_TotalCount"].Value;
            }
        }
开发者ID:ThePublicTheater,项目名称:NYSF,代码行数:60,代码来源:OracleErrorLog.cs

示例11: Flush

		/// <summary>Flush all pending docs to a new segment </summary>
		internal int Flush(bool closeDocStore)
		{
			lock (this)
			{
				
				System.Diagnostics.Debug.Assert(AllThreadsIdle());
				
				if (segment == null)
				// In case we are asked to flush an empty segment
					segment = writer.NewSegmentName();
				
				newFiles = new System.Collections.ArrayList();
				
				docStoreOffset = numDocsInStore;
				
				int docCount;
				
				System.Diagnostics.Debug.Assert(numDocsInRAM > 0);
				
				if (infoStream != null)
					infoStream.WriteLine("\nflush postings as segment " + segment + " numDocs=" + numDocsInRAM);
				
				bool success = false;
				
				try
				{
					System.Collections.IEnumerator e;

					if (closeDocStore)
					{
						System.Diagnostics.Debug.Assert(docStoreSegment != null);
						System.Diagnostics.Debug.Assert(docStoreSegment.Equals(segment));
						e = Files().GetEnumerator();
						while (e.MoveNext())
							newFiles.Add(e.Current);
						CloseDocStore();
					}
					
					fieldInfos.Write(directory, segment + ".fnm");
					
					docCount = numDocsInRAM;

					e = WriteSegment().GetEnumerator();
					while (e.MoveNext())
						newFiles.Add(e.Current);
					
					success = true;
				}
				finally
				{
					if (!success)
						Abort(null);
				}
				
				return docCount;
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:58,代码来源:DocumentsWriter.cs

示例12: Files

		/* Returns list of files in use by this instance,
		* including any flushed segments. */
		internal System.Collections.IList Files()
		{
			lock (this)
			{
				
				if (files != null)
					return files;
				
				files = new System.Collections.ArrayList();
				
				// Stored fields:
				if (fieldsWriter != null)
				{
					System.Diagnostics.Debug.Assert(docStoreSegment != null);
					files.Add(docStoreSegment + "." + IndexFileNames.FIELDS_EXTENSION);
					files.Add(docStoreSegment + "." + IndexFileNames.FIELDS_INDEX_EXTENSION);
				}
				
				// Vectors:
				if (tvx != null)
				{
					System.Diagnostics.Debug.Assert(docStoreSegment != null);
					files.Add(docStoreSegment + "." + IndexFileNames.VECTORS_INDEX_EXTENSION);
					files.Add(docStoreSegment + "." + IndexFileNames.VECTORS_FIELDS_EXTENSION);
					files.Add(docStoreSegment + "." + IndexFileNames.VECTORS_DOCUMENTS_EXTENSION);
				}
				
				return files;
			}
		}
开发者ID:vikasraz,项目名称:indexsearchutils,代码行数:32,代码来源:DocumentsWriter.cs

示例13: ParseEngine

        /** Fill a list of all NFA states visited during the parse */
        protected virtual void ParseEngine( String startRule,
                                   NFAState start,
                                   NFAState stop,
                                   IIntStream input,
                                   Stack<object> ruleInvocationStack,
                                   IDebugEventListener actions,
                                   IList visitedStates )
        {
            NFAState s = start;
            if ( actions != null )
            {
                actions.EnterRule( s.nfa.grammar.FileName, start.enclosingRule.Name );
            }
            int t = input.LA( 1 );
            while ( s != stop )
            {
                if ( visitedStates != null )
                {
                    visitedStates.Add( s );
                }
                //Console.Out.WriteLine( "parse state " + s.stateNumber + " input=" + s.nfa.grammar.getTokenDisplayName( t ) );
                // CASE 1: decision state
                if ( s.DecisionNumber > 0 && s.nfa.grammar.GetNumberOfAltsForDecisionNFA( s ) > 1 )
                {
                    // decision point, must predict and jump to alt
                    DFA dfa = s.nfa.grammar.GetLookaheadDFA( s.DecisionNumber );
                    //if ( s.nfa.grammar.type != GrammarType.Lexer )
                    //{
                    //    Console.Out.WriteLine( "decision: " +
                    //                   dfa.getNFADecisionStartState().Description +
                    //                   " input=" + s.nfa.grammar.getTokenDisplayName( t ) );
                    //}
                    int m = input.Mark();
                    int predictedAlt = Predict( dfa );
                    if ( predictedAlt == NFA.INVALID_ALT_NUMBER )
                    {
                        String description = dfa.NFADecisionStartState.Description;
                        NoViableAltException nvae =
                            new NoViableAltException( description,
                                                          dfa.DecisionNumber,
                                                          s.stateNumber,
                                                          input );
                        if ( actions != null )
                        {
                            actions.RecognitionException( nvae );
                        }
                        input.Consume(); // recover
                        throw nvae;
                    }
                    input.Rewind( m );
                    int parseAlt =
                        s.TranslateDisplayAltToWalkAlt( predictedAlt );
                    //if ( s.nfa.grammar.type != GrammarType.Lexer )
                    //{
                    //    Console.Out.WriteLine( "predicted alt " + predictedAlt + ", parseAlt " + parseAlt );
                    //}
                    NFAState alt;
                    if ( parseAlt > s.nfa.grammar.GetNumberOfAltsForDecisionNFA( s ) )
                    {
                        // implied branch of loop etc...
                        alt = s.nfa.grammar.nfa.GetState( s.endOfBlockStateNumber );
                    }
                    else
                    {
                        alt = s.nfa.grammar.GetNFAStateForAltOfDecision( s, parseAlt );
                    }
                    s = (NFAState)alt.transition[0].target;
                    continue;
                }

                // CASE 2: finished matching a rule
                if ( s.IsAcceptState )
                { // end of rule node
                    if ( actions != null )
                    {
                        actions.ExitRule( s.nfa.grammar.FileName, s.enclosingRule.Name );
                    }
                    if ( ruleInvocationStack.Count == 0 )
                    {
                        // done parsing.  Hit the start state.
                        //Console.Out.WriteLine( "stack empty in stop state for " + s.enclosingRule );
                        break;
                    }
                    // pop invoking state off the stack to know where to return to
                    NFAState invokingState = (NFAState)ruleInvocationStack.Pop();
                    RuleClosureTransition invokingTransition =
                            (RuleClosureTransition)invokingState.transition[0];
                    // move to node after state that invoked this rule
                    s = invokingTransition.followState;
                    continue;
                }

                Transition trans = s.transition[0];
                Label label = trans.label;
                if ( label.IsSemanticPredicate )
                {
                    FailedPredicateException fpe =
                        new FailedPredicateException( input,
                                                     s.enclosingRule.Name,
//.........这里部分代码省略.........
开发者ID:bszafko,项目名称:antlrcs,代码行数:101,代码来源:Interpreter.cs

示例14: GetErrors

        /// <summary>
        /// Returns a page of errors from the databse in descending order 
        /// of logged time.
        /// </summary>
        public override int GetErrors(int pageIndex, int pageSize, IList errorEntryList)
        {
            if (pageIndex < 0)
                throw new ArgumentOutOfRangeException("pageIndex", pageIndex, null);

            if (pageSize < 0)
                throw new ArgumentOutOfRangeException("pageSize", pageSize, null);

            using (OleDbConnection connection = new OleDbConnection(this.ConnectionString))
            using (OleDbCommand command = connection.CreateCommand())
            {
                command.CommandType = CommandType.Text;
                command.CommandText = "SELECT COUNT(*) FROM ELMAH_Error";

                connection.Open();
                int totalCount = (int)command.ExecuteScalar();

                if (errorEntryList != null && pageIndex * pageSize < totalCount)
                {
                    int maxRecords = pageSize * (pageIndex + 1);
                    if (maxRecords > totalCount)
                    {
                        maxRecords = totalCount;
                        pageSize = totalCount - pageSize * (totalCount / pageSize);
                    }

                    StringBuilder sql = new StringBuilder(1000);
                    sql.Append("SELECT e.* FROM (");
                    sql.Append("SELECT TOP ");
                    sql.Append(pageSize.ToString(CultureInfo.InvariantCulture));
                    sql.Append(" TimeUtc, ErrorId FROM (");
                    sql.Append("SELECT TOP ");
                    sql.Append(maxRecords.ToString(CultureInfo.InvariantCulture));
                    sql.Append(" TimeUtc, ErrorId FROM ELMAH_Error ");
                    sql.Append("ORDER BY TimeUtc DESC, ErrorId DESC) ");
                    sql.Append("ORDER BY TimeUtc ASC, ErrorId ASC) AS i ");
                    sql.Append("INNER JOIN Elmah_Error AS e ON i.ErrorId = e.ErrorId ");
                    sql.Append("ORDER BY e.TimeUtc DESC, e.ErrorId DESC");

                    command.CommandText = sql.ToString();

                    using (OleDbDataReader reader = command.ExecuteReader())
                    {
                        Debug.Assert(reader != null);

                        while (reader.Read())
                        {
                            string id = Convert.ToString(reader["ErrorId"], CultureInfo.InvariantCulture);

                            Error error = new Error();

                            error.ApplicationName = reader["Application"].ToString();
                            error.HostName = reader["Host"].ToString();
                            error.Type = reader["Type"].ToString();
                            error.Source = reader["Source"].ToString();
                            error.Message = reader["Message"].ToString();
                            error.User = reader["UserName"].ToString();
                            error.StatusCode = Convert.ToInt32(reader["StatusCode"]);
                            error.Time = Convert.ToDateTime(reader["TimeUtc"]).ToLocalTime();

                            errorEntryList.Add(new ErrorLogEntry(this, id, error));
                        }

                        reader.Close();
                    }
                }

                return totalCount;
            }
        }
开发者ID:buddydvd,项目名称:elmah-mirror,代码行数:74,代码来源:AccessErrorLog.cs

示例15: Mark

 public virtual int Mark()
 {
     if (markers == null)
     {
         markers = new ArrayList();
         markers.Add(null); // depth 0 means no backtracking, leave blank
     }
     markDepth++;
     CharStreamState state = null;
     if (markDepth >= markers.Count)
     {
         state = new CharStreamState();
         markers.Add(state);
     }
     else
     {
         state = (CharStreamState)markers[markDepth];
     }
     state.p = p;
     state.line = line;
     state.charPositionInLine = charPositionInLine;
     lastMarker = markDepth;
     return markDepth;
 }
开发者ID:nikola-v,项目名称:jaustoolset,代码行数:24,代码来源:ANTLRStringStream.cs


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