[Monodevelop-patches-list] r627 - trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy

commit-watcher at mono-cvs.ximian.com commit-watcher at mono-cvs.ximian.com
Sat Jan 24 13:14:53 EST 2004


Author: benm
Date: 2004-01-24 13:14:53 -0500 (Sat, 24 Jan 2004)
New Revision: 627

Modified:
   trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs
Log:
use arrays here; that way when we do foreach later it is much faster

Modified: trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs	2004-01-24 18:14:00 UTC (rev 626)
+++ trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/HighlightingStrategy/HighlightRuleSet.cs	2004-01-24 18:14:53 UTC (rev 627)
@@ -19,7 +19,8 @@
 	public class HighlightRuleSet
 	{
 		LookupTable keyWords;
-		ArrayList   spans = new ArrayList();
+		Span [] spans;
+		
 		LookupTable prevMarkers;
 		LookupTable nextMarkers;
 		IHighlightingStrategy highlighter = null;
@@ -32,7 +33,7 @@
 		
 		string      reference  = null;
 		
-		public ArrayList Spans {
+		public Span [] Spans {
 			get {
 				return spans;
 			}
@@ -107,6 +108,7 @@
 		
 		public HighlightRuleSet(XmlElement el)
 		{
+			ArrayList   spans = new ArrayList ();
 			XmlNodeList nodes = el.GetElementsByTagName("KeyWords");
 			
 			if (el.Attributes["name"] != null) {
@@ -136,8 +138,6 @@
 				}
 			}
 			
-//			Spans       = new LookupTable(!IgnoreCase);
-
 			keyWords    = new LookupTable(!IgnoreCase);
 			prevMarkers = new LookupTable(!IgnoreCase);
 			nextMarkers = new LookupTable(!IgnoreCase);
@@ -153,7 +153,7 @@
 			
 			nodes = el.GetElementsByTagName("Span");
 			foreach (XmlElement el2 in nodes) {
-				Spans.Add(new Span(el2));
+				spans.Add(new Span(el2));
 				/*
 				Span span = new Span(el2);
 				Spans[span.Begin] = span;*/
@@ -170,6 +170,8 @@
 				NextMarker next = new NextMarker(el2);
 				nextMarkers[next.What] = next;
 			}
+			
+			this.spans = (Span []) spans.ToArray (typeof (Span));
 		}
 	}
 }




More information about the Monodevelop-patches-list mailing list