static void Main(string[] args) { List <string> ptr = new List <string>(); AlphaNumbericCollector alphaCollector = new AlphaNumbericCollector(); StringCollector stringCollector = new StringCollector(); while (true) { ptr.Add(Console.ReadLine()); if (ptr[ptr.Count - 1] != null) { for (int i = 0; i < ptr[ptr.Count - 1].Length; i++) { if (ptr[ptr.Count - 1][i] >= 0x30 && ptr[ptr.Count - 1][i] <= 0x39) { AlphaOperation alpha_operation = alphaCollector.CollectingMethod; alpha_operation(ptr[ptr.Count - 1]); alphaCollector.Show(); break; } else if (i == ptr[ptr.Count - 1].Length - 1) { StringOperation string_operation = stringCollector.CollectingMethod; string_operation(ptr[ptr.Count - 1]); stringCollector.Show(); break; } } } else { ptr.Remove(ptr[ptr.Count - 1]); } } }
static void Main(string[] args) { AlphaNumbericCollector ncollector = new AlphaNumbericCollector(); StringCollector acollector = new StringCollector(); EventInput input = new EventInput(); input.OnProcessed += ncollector.Numberic; input.OnProcessed += acollector.String; input.Run(); }
/// <summary> /// Collect all strings used into the strings lookup table. /// </summary> private Dictionary <string, uint> CollectStrings() { var collector = new StringCollector(); collector.Collect(dex); strings = new List <string>(collector.Items.Keys); strings.Sort(new StringComparer()); uint index = 0; return(strings.ToDictionary(s => s, s => index++)); }
public static void Main(string[] args) { AlphaNumbericCollector alphaNumbericCollector = new AlphaNumbericCollector(); StringCollector stringCollector = new StringCollector(); StringReceiver stringReceiver = new StringReceiver(); Func <string> PromptRecord = stringReceiver.EnquireRecord; Action <string> ReceiveRecord = stringReceiver.StringReceive; string val; Console.WriteLine("To finish entering, type: end"); Console.WriteLine(); val = PromptRecord(); // stringReceiver.EnquireRecord(); while (val != "end") { Predicate <string> isNumberPresent = IsNumberInString; // Use of Predicate Delegate bool numberPresent = isNumberPresent(val); if (numberPresent) { stringReceiver.StringReceived += alphaNumbericCollector.AddToList; } else { stringReceiver.StringReceived += stringCollector.AddToList; } ReceiveRecord(val); // Used Action type delegate val = PromptRecord(); // Used Func type delegate if (val == "end") { Console.WriteLine(); Console.WriteLine("Data recorded in Classes:"); Console.WriteLine(); DisplayRecords += new EventHandler(alphaNumbericCollector.Dispaly); DisplayRecords += new EventHandler(stringCollector.Dispaly); DisplayRecords.Invoke(); Console.ReadKey(); } } }
static void Main(string[] args) { StringCollector sCollector = new StringCollector(); AlphaNumbericCollector anCollector = new AlphaNumbericCollector(); Console.WriteLine("Please enter a string: "); Message mes1 = sCollector.Process; Message mes2 = anCollector.Process; var s = Console.ReadLine(); if (!s.Any(c => char.IsDigit(c))) { mes1(s); } else { mes2(s); } Console.ReadKey(); }
public static void Main() { StringCollector sCollector = new StringCollector(); AlphaNumericCollector anCollector = new AlphaNumericCollector(); sCollector.OnStringProcessed += OnStringProcess; anCollector.OnStringProcessed += OnStringProcess; while (true) { var s = Console.ReadLine(); if (!s.Any(c => char.IsDigit(c))) { sCollector.Process(s); } else { anCollector.Process(s); } } }
static void Main(string[] args) { string userString; StringCollector stringCollection = new StringCollector(); AlphaNumbericCollector numericCollection = new AlphaNumbericCollector(); AddString addString = stringCollection.AddString; AddString addStringWithDigit = numericCollection.AddString; while (true) { userString = InputHandler.Input(); if (userString.Any(char.IsDigit)) { addStringWithDigit(userString); } else { addString(userString); } } }
public virtual ISet<string> GetStringLiterals() { StringCollector collector = new StringCollector(this); collector.VisitGrammar(ast); return collector.strings; }