public override void Reset() { if (cache != null) { iterator = cache.GetEnumerator(); } }
public override bool IncrementToken() { if (cache == null) { // fill cache lazily cache = new System.Collections.Generic.LinkedList<State>(); FillCache(); iterator = cache.GetEnumerator(); } if (!iterator.MoveNext()) { // the cache is exhausted, return false return false; } // Since the TokenFilter can be reset, the tokens need to be preserved as immutable. RestoreState(iterator.Current); return true; }
protected internal override MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty UnpackFromCore(MsgPack.Unpacker unpacker) { MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty result = default(MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty); result = new MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty(); if (unpacker.IsArrayHeader) { int unpacked = default(int); int itemsCount = default(int); itemsCount = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker); System.Collections.Generic.IDictionary <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry> nullable = default(System.Collections.Generic.IDictionary <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry>); if ((unpacked < itemsCount)) { if ((unpacker.Read() == false)) { throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(0); } if (((unpacker.IsArrayHeader == false) && (unpacker.IsMapHeader == false))) { nullable = this._serializer1.UnpackFrom(unpacker); } else { MsgPack.Unpacker disposable = default(MsgPack.Unpacker); disposable = unpacker.ReadSubtree(); try { nullable = this._serializer1.UnpackFrom(disposable); } finally { if (((disposable == null) == false)) { disposable.Dispose(); } } } } if (((nullable == null) == false)) { if ((result.DictPolymorphicKeyAndItem == null)) { this._methodBasePolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty_set_DictPolymorphicKeyAndItem0.Invoke(result, new object[] { nullable }); } else { System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry> > enumerator = nullable.GetEnumerator(); System.Collections.Generic.KeyValuePair <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry> current; try { for ( ; enumerator.MoveNext(); ) { current = enumerator.Current; result.DictPolymorphicKeyAndItem.Add(current.Key, current.Value); } } finally { enumerator.Dispose(); } } } unpacked = (unpacked + 1); } else { int itemsCount0 = default(int); itemsCount0 = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker); for (int i = 0; (i < itemsCount0); i = (i + 1)) { string key = default(string); string nullable0 = default(string); nullable0 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker, typeof(MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty), "MemberName"); if (((nullable0 == null) == false)) { key = nullable0; } else { throw MsgPack.Serialization.SerializationExceptions.NewNullIsProhibited("MemberName"); } if ((key == "DictPolymorphicKeyAndItem")) { System.Collections.Generic.IDictionary <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry> nullable1 = default(System.Collections.Generic.IDictionary <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry>); if ((unpacker.Read() == false)) { throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i); } if (((unpacker.IsArrayHeader == false) && (unpacker.IsMapHeader == false))) { nullable1 = this._serializer1.UnpackFrom(unpacker); } else { MsgPack.Unpacker disposable0 = default(MsgPack.Unpacker); disposable0 = unpacker.ReadSubtree(); try { nullable1 = this._serializer1.UnpackFrom(disposable0); } finally { if (((disposable0 == null) == false)) { disposable0.Dispose(); } } } if (((nullable1 == null) == false)) { if ((result.DictPolymorphicKeyAndItem == null)) { this._methodBasePolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicKeyAndItemPrivateSetterCollectionProperty_set_DictPolymorphicKeyAndItem0.Invoke(result, new object[] { nullable1 }); } else { System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry> > enumerator0 = nullable1.GetEnumerator(); System.Collections.Generic.KeyValuePair <MsgPack.Serialization.FileSystemEntry, MsgPack.Serialization.FileSystemEntry> current0; try { for ( ; enumerator0.MoveNext(); ) { current0 = enumerator0.Current; result.DictPolymorphicKeyAndItem.Add(current0.Key, current0.Value); } } finally { enumerator0.Dispose(); } } } } else { unpacker.Skip(); } } } return(result); }
public virtual void CopyTo(SoftFluent.Samples.Thinktecture.IdentityServer.UserClaimCollection collection, bool deep) { if ((typeof(System.ICloneable).IsAssignableFrom(typeof(SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim)) == false)) { deep = false; } System.Collections.Generic.IEnumerator <SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim> enumerator = this.GetEnumerator(); bool b; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { if ((deep == true)) { collection.Add(((SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim)(((System.ICloneable)(enumerator.Current)).Clone()))); } else { collection.Add(enumerator.Current); } } }
public string EvaluateFormula_Base(string formula, BaseClasses.Data.BaseRecord dataSourceForEvaluate, string format, System.Collections.Generic.IDictionary <string, object> variables, bool includeDS) { FormulaEvaluator e = new FormulaEvaluator(); // add variables for formula evaluation if (variables != null) { System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, object> > enumerator = variables.GetEnumerator(); while (enumerator.MoveNext()) { e.Variables.Add(enumerator.Current.Key, enumerator.Current.Value); } } if (includeDS) { } e.CallingControl = this; // All variables referred to in the formula are expected to be // properties of the DataSource. For example, referring to // UnitPrice as a variable will refer to DataSource.UnitPrice e.DataSource = dataSourceForEvaluate; // Define the calling control. e.CallingControl = this; object resultObj = e.Evaluate(formula); if (resultObj == null) { return(""); } if (!string.IsNullOrEmpty(format) && (string.IsNullOrEmpty(formula) || formula.IndexOf("Format(") < 0)) { return(FormulaUtils.Format(resultObj, format)); } else { return(resultObj.ToString()); } }
protected internal override MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_List_ListPolymorphicItselfGetOnlyCollectionProperty UnpackFromCore(MsgPack.Unpacker unpacker) { MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_List_ListPolymorphicItselfGetOnlyCollectionProperty result = default(MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_List_ListPolymorphicItselfGetOnlyCollectionProperty); result = new MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_List_ListPolymorphicItselfGetOnlyCollectionProperty(); if (unpacker.IsArrayHeader) { int unpacked = default(int); int itemsCount = default(int); itemsCount = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker); System.Collections.Generic.IList <string> nullable = default(System.Collections.Generic.IList <string>); if ((unpacked < itemsCount)) { if ((unpacker.Read() == false)) { throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(0); } if (((unpacker.IsArrayHeader == false) && (unpacker.IsMapHeader == false))) { nullable = this._serializer1.UnpackFrom(unpacker); } else { MsgPack.Unpacker disposable = default(MsgPack.Unpacker); disposable = unpacker.ReadSubtree(); try { nullable = this._serializer1.UnpackFrom(disposable); } finally { if (((disposable == null) == false)) { disposable.Dispose(); } } } } if (((nullable == null) == false)) { System.Collections.Generic.IEnumerator <string> enumerator = nullable.GetEnumerator(); string current; try { for ( ; enumerator.MoveNext(); ) { current = enumerator.Current; result.ListPolymorphicItself.Add(current); } } finally { enumerator.Dispose(); } } unpacked = (unpacked + 1); } else { int itemsCount0 = default(int); itemsCount0 = MsgPack.Serialization.UnpackHelpers.GetItemsCount(unpacker); for (int i = 0; (i < itemsCount0); i = (i + 1)) { string key = default(string); string nullable0 = default(string); nullable0 = MsgPack.Serialization.UnpackHelpers.UnpackStringValue(unpacker, typeof(MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_List_ListPolymorphicItselfGetOnlyCollectionProperty), "MemberName"); if (((nullable0 == null) == false)) { key = nullable0; } else { throw MsgPack.Serialization.SerializationExceptions.NewNullIsProhibited("MemberName"); } if ((key == "ListPolymorphicItself")) { System.Collections.Generic.IList <string> nullable1 = default(System.Collections.Generic.IList <string>); if ((unpacker.Read() == false)) { throw MsgPack.Serialization.SerializationExceptions.NewMissingItem(i); } if (((unpacker.IsArrayHeader == false) && (unpacker.IsMapHeader == false))) { nullable1 = this._serializer1.UnpackFrom(unpacker); } else { MsgPack.Unpacker disposable0 = default(MsgPack.Unpacker); disposable0 = unpacker.ReadSubtree(); try { nullable1 = this._serializer1.UnpackFrom(disposable0); } finally { if (((disposable0 == null) == false)) { disposable0.Dispose(); } } } if (((nullable1 == null) == false)) { System.Collections.Generic.IEnumerator <string> enumerator0 = nullable1.GetEnumerator(); string current0; try { for ( ; enumerator0.MoveNext(); ) { current0 = enumerator0.Current; result.ListPolymorphicItself.Add(current0); } } finally { enumerator0.Dispose(); } } } else { unpacker.Skip(); } } } return(result); }
private void SetUnpackedValueOfDictStaticKeyAndObjectItem(MsgPack.Serialization.PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemPrivateSetterCollectionProperty unpackingContext, System.Collections.Generic.IDictionary <string, object> unpackedValue) { System.Collections.Generic.IDictionary <string, object> existent = default(System.Collections.Generic.IDictionary <string, object>); existent = unpackingContext.DictStaticKeyAndObjectItem; if ((existent == null)) { this._methodBasePolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndObjectItemPrivateSetterCollectionProperty_set_DictStaticKeyAndObjectItem0.Invoke(unpackingContext, new object[] { unpackedValue }); } else { System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, object> > enumerator = unpackedValue.GetEnumerator(); System.Collections.Generic.KeyValuePair <string, object> current; try { for ( ; enumerator.MoveNext(); ) { current = enumerator.Current; existent.Add(current.Key, current.Value); } } finally { enumerator.Dispose(); } } }
static StackObject *get_Current_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Generic.IEnumerator <Knight.Core.CKeyValuePair <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance> > instance_of_this_method = (System.Collections.Generic.IEnumerator <Knight.Core.CKeyValuePair <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance> >) typeof(System.Collections.Generic.IEnumerator <Knight.Core.CKeyValuePair <System.Int32, ILRuntime.Runtime.Intepreter.ILTypeInstance> >).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.Current; object obj_result_of_this_method = result_of_this_method; if (obj_result_of_this_method is CrossBindingAdaptorType) { return(ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance)); } return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
public virtual void Reset() { currentIterator = Iterator(orderByType); }
public MockAsyncEnumerator(System.Collections.Generic.IEnumerable <T> enumerable) { _source = enumerable.GetEnumerator(); }
public MockAsyncEnumerator(System.Collections.Generic.IEnumerator <T> enumerator) { _source = enumerator; }
/// <summary> /// If the current is not ASPX page but ASCX controls, the controls in this ASCX control has id starting with underscore. /// To avoid confusion in formula, we also define variable name without underscore. /// </summary> /// <remarks></remarks> private void AddVariableNameWithoutUnderscore() { System.Collections.Generic.Dictionary <string, object> vars = new System.Collections.Generic.Dictionary <string, object>(); System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, object> > enumerator = this.Evaluator.Variables.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current.Key.StartsWith("_")) { string varNameWitoutUnderscore = enumerator.Current.Key.Substring(1); if (!this.Evaluator.Variables.ContainsKey(varNameWitoutUnderscore)) { vars.Add(varNameWitoutUnderscore, enumerator.Current.Value); } } } System.Collections.Generic.Dictionary <string, object> .Enumerator enumerator2 = vars.GetEnumerator(); while (enumerator2.MoveNext()) { this.Evaluator.Variables.Add(enumerator2.Current.Key, enumerator2.Current.Value); } }
static StackObject *get_Current_0(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj) { ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain; StackObject *ptr_of_this_method; StackObject *__ret = ILIntepreter.Minus(__esp, 1); ptr_of_this_method = ILIntepreter.Minus(__esp, 1); System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <System.Int32, System.Int32> > instance_of_this_method = (System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <System.Int32, System.Int32> >) typeof(System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <System.Int32, System.Int32> >).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack)); __intp.Free(ptr_of_this_method); var result_of_this_method = instance_of_this_method.Current; return(ILIntepreter.PushObject(__ret, __mStack, result_of_this_method)); }
private static System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>> GetUserLatestPostsFromResult(System.Collections.ArrayList result) { System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>> list = new System.Collections.Generic.List<System.Collections.Generic.Dictionary<string, string>>(); try { try { System.Collections.IEnumerator enumerator = result.GetEnumerator(); while (enumerator.MoveNext()) { object objectValue = System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(enumerator.Current); System.Collections.Generic.Dictionary<string, string> dictionary = new System.Collections.Generic.Dictionary<string, string>(); dictionary.Add("id", ""); dictionary.Add("link", ""); dictionary.Add("thumbnail-image", ""); dictionary.Add("lowres-image", ""); dictionary.Add("highres-image", ""); dictionary.Add("lowres-video", ""); dictionary.Add("highres-video", ""); dictionary.Add("description", ""); dictionary.Add("description-notags", ""); dictionary.Add("tags", ""); dictionary.Add("latitude", ""); dictionary.Add("longitude", ""); dictionary.Add("location", ""); if (Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "id" }, null, null, null))) { dictionary["id"] = Conversions.ToString(NewLateBinding.LateIndexGet(objectValue, new object[] { "id" }, null)); } if (Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "link" }, null, null, null))) { dictionary["link"] = Conversions.ToString(NewLateBinding.LateIndexGet(objectValue, new object[] { "link" }, null)); } if (Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "videos" }, null, null, null))) { dictionary.Add("video", ""); System.Collections.Generic.Dictionary<string, object> dictionary2 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[] { "videos" }, null); try { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator2 = dictionary2.GetEnumerator(); while (enumerator2.MoveNext()) { System.Collections.Generic.KeyValuePair<string, object> current = enumerator2.Current; string key = current.Key; if (Operators.CompareString(key, "low_bandwidth", false) == 0) { System.Collections.Generic.Dictionary<string, object> dictionary3 = (System.Collections.Generic.Dictionary<string, object>)current.Value; dictionary["lowres-video"] = Conversions.ToString(dictionary3["url"]); } else if (Operators.CompareString(key, "standard_resolution", false) == 0) { System.Collections.Generic.Dictionary<string, object> dictionary4 = (System.Collections.Generic.Dictionary<string, object>)current.Value; dictionary["highres-video"] = Conversions.ToString(dictionary4["url"]); } } } finally { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator2; ((System.IDisposable)enumerator2).Dispose(); } } if (Conversions.ToBoolean((!Conversions.ToBoolean(NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "location" }, null, null, null)) || !Conversions.ToBoolean(NewLateBinding.LateIndexGet(objectValue, new object[] { "location" }, null) != null)) ? false : true)) { System.Collections.Generic.Dictionary<string, object> dictionary5 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[] { "location" }, null); try { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator3 = dictionary5.GetEnumerator(); while (enumerator3.MoveNext()) { System.Collections.Generic.KeyValuePair<string, object> current2 = enumerator3.Current; string key2 = current2.Key; if (Operators.CompareString(key2, "latitude", false) == 0) { dictionary["latitude"] = Conversions.ToString(current2.Value); } else if (Operators.CompareString(key2, "longitude", false) == 0) { dictionary["longitude"] = Conversions.ToString(current2.Value); } else if (Operators.CompareString(key2, "name", false) == 0) { dictionary["location"] = Conversions.ToString(current2.Value); } } } finally { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator3; ((System.IDisposable)enumerator3).Dispose(); } } if (NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "images" }, null, null, null) != null) { System.Collections.Generic.Dictionary<string, object> dictionary6 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[] { "images" }, null); try { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator4 = dictionary6.GetEnumerator(); while (enumerator4.MoveNext()) { System.Collections.Generic.KeyValuePair<string, object> current3 = enumerator4.Current; string key3 = current3.Key; if (Operators.CompareString(key3, "thumbnail", false) == 0) { System.Collections.Generic.Dictionary<string, object> dictionary7 = (System.Collections.Generic.Dictionary<string, object>)current3.Value; dictionary["thumbnail-image"] = Conversions.ToString(dictionary7["url"]); } else if (Operators.CompareString(key3, "low_resolution", false) == 0) { System.Collections.Generic.Dictionary<string, object> dictionary8 = (System.Collections.Generic.Dictionary<string, object>)current3.Value; dictionary["lowres-image"] = Conversions.ToString(dictionary8["url"]); } else if (Operators.CompareString(key3, "standard_resolution", false) == 0) { System.Collections.Generic.Dictionary<string, object> dictionary9 = (System.Collections.Generic.Dictionary<string, object>)current3.Value; dictionary["highres-image"] = Conversions.ToString(dictionary9["url"]); } } } finally { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator4; ((System.IDisposable)enumerator4).Dispose(); } } if (NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "caption" }, null, null, null) != null) { System.Collections.Generic.Dictionary<string, object> dictionary10 = (System.Collections.Generic.Dictionary<string, object>)NewLateBinding.LateIndexGet(objectValue, new object[] { "caption" }, null); try { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator5 = dictionary10.GetEnumerator(); while (enumerator5.MoveNext()) { System.Collections.Generic.KeyValuePair<string, object> current4 = enumerator5.Current; string key4 = current4.Key; if (Operators.CompareString(key4, "text", false) == 0) { dictionary["description"] = Conversions.ToString(current4.Value); dictionary["description-notags"] = Conversions.ToString(current4.Value); } } } finally { System.Collections.Generic.Dictionary<string, object>.Enumerator enumerator5; ((System.IDisposable)enumerator5).Dispose(); } } if (NewLateBinding.LateGet(objectValue, null, "containskey", new object[] { "tags" }, null, null, null) != null) { System.Collections.ArrayList arrayList = (System.Collections.ArrayList)NewLateBinding.LateIndexGet(objectValue, new object[] { "tags" }, null); bool flag = false; try { System.Collections.Generic.IEnumerator<object> enumerator6 = (from f in arrayList.ToArray().ToList<object>() orderby f.ToString().Length descending select f).GetEnumerator(); while (enumerator6.MoveNext()) { object objectValue2 = System.Runtime.CompilerServices.RuntimeHelpers.GetObjectValue(enumerator6.Current); dictionary["tags"] = Conversions.ToString(Operators.AddObject(Operators.AddObject(dictionary["tags"] + "#", objectValue2), ",")); dictionary["description-notags"] = dictionary["description-notags"].Replace(Conversions.ToString(Operators.AddObject(" #", objectValue2)), "", System.StringComparison.OrdinalIgnoreCase); flag = true; } } finally { System.Collections.Generic.IEnumerator<object> enumerator6; if (enumerator6 != null) { enumerator6.Dispose(); } } if (flag) { dictionary["tags"] = dictionary["tags"].Substring(0, checked(dictionary["tags"].Length - 1)); } } list.Add(dictionary); } } finally { System.Collections.IEnumerator enumerator; if (enumerator is System.IDisposable) { (enumerator as System.IDisposable).Dispose(); } } } catch (System.Exception expr_743) { ProjectData.SetProjectError(expr_743); ProjectData.ClearProjectError(); } return list; }
public ProxyEnumerator(System.Collections.Generic.IEnumerator <TSourceElement> source, System.Type proxyType) { }
public System.Collections.Generic.IEnumerable <char> Transcribe(System.Collections.Generic.IEnumerable <char> input) { LetterCategory lastCategory = LetterCategory.Whitespace; char lastCharacter = '\0'; System.Collections.Generic.IEnumerator <char> enumerator = input.GetEnumerator(); bool evenInsertVowel = false; //If we are done, no more elements if (!enumerator.MoveNext()) { yield break; } bool done = false; char current = '\0'; while (!done) { lastCharacter = current; current = enumerator.Current; //If we are done, no more elements if (!enumerator.MoveNext()) { done = true; } //If we are at the last element else if (current == enumerator.Current) { done = !enumerator.MoveNext(); } // //Map ck to k // else if (current == 'c' && enumerator.Current == 'k') // { // done = !enumerator.MoveNext(); // current = 'k'; // } // //Map ch to k if last character was a vowel, // //otherwise map ch to s // else if (current == 'c' && enumerator.Current == 'h') // { // done = !enumerator.MoveNext(); // current = lastCategory == LetterCategory.Vowel ? 'k' : 's'; // } current = this.Map(current); LetterCategory category = this.Categorize(current); switch (category) { // //Don't transpose other characters case LetterCategory.Other: if (current == '_') { yield return(current); } break; //case LetterCategory.Vowel: // //If vowel, and last category was not a consonant // //add a h before the vowel // //if (lastCategory != LetterCategory.Consonant) // // yield return 'h'; // //yield return current; // break; //case LetterCategory.Consonant: // //If consonant, and the last category was a consonant, // //add a u or i before the consonant // //if (lastCategory == LetterCategory.Consonant) // // yield return (evenInsertVowel = !evenInsertVowel) ? 'u' : 'i'; // //yield return current; // break; case LetterCategory.Whitespace: //If the last character in a word was a consonant, //add a u or i to the end of that word. //if (lastCategory == LetterCategory.Consonant) // yield return !evenInsertVowel ? 'u' : 'i'; //evenInsertVowel = false; if (lastCategory != LetterCategory.Whitespace) { switch (lastCharacter) { case 'g': case 'b': case 'h': yield return('u'); yield return('r'); break; case 'f': case 'p': case 's': case 'v': yield return('i'); yield return('r'); break; case 'd': case 'm': case 'r': case 't': yield return('o'); yield return('n'); break; case 'l': yield return('r'); break; } yield return(' '); } break; default: //Map ö to oe if (current == 'ö') { yield return('o'); yield return('e'); } else if (current == 'd') { yield return('t'); yield return('h'); } else { yield return(current); } break; } if (category != LetterCategory.Other) { lastCategory = category; } } //if (lastCategory == LetterCategory.Consonant) // yield return (evenInsertVowel = !evenInsertVowel) ? 'u' : 'i'; }
internal IntComboListLocalEnumerator(System.Collections.Generic.IEnumerator<IntComboList.B8> b8enum) { this.b8enum = b8enum; }
private void SetUnpackedValueOfListPolymorphicItem(MsgPack.Serialization.PolymorphicMemberTypeKnownType_List_ListPolymorphicItemReadOnlyCollectionField unpackingContext, System.Collections.Generic.IList <MsgPack.Serialization.FileSystemEntry> unpackedValue) { System.Collections.Generic.IList <MsgPack.Serialization.FileSystemEntry> existent = default(System.Collections.Generic.IList <MsgPack.Serialization.FileSystemEntry>); existent = unpackingContext.ListPolymorphicItem; System.Collections.Generic.IEnumerator <MsgPack.Serialization.FileSystemEntry> enumerator = unpackedValue.GetEnumerator(); MsgPack.Serialization.FileSystemEntry current; try { for ( ; enumerator.MoveNext(); ) { current = enumerator.Current; existent.Add(current); } } finally { enumerator.Dispose(); } }
public virtual System.Collections.Generic.IEnumerator <SoftFluent.Samples.EncryptAspect.Customer> GetEnumerator() { System.Collections.Generic.IEnumerator <SoftFluent.Samples.EncryptAspect.Customer> e = this.BaseList.GetEnumerator(); return(e); }
/// <summary> Initialize the deleter: find all previous commits in /// the Directory, incref the files they reference, call /// the policy to let it delete commits. This will remove /// any files not referenced by any of the commits. /// </summary> /// <throws> CorruptIndexException if the index is corrupt </throws> /// <throws> IOException if there is a low-level IO error </throws> public IndexFileDeleter(Directory directory, IndexDeletionPolicy policy, SegmentInfos segmentInfos, System.IO.StreamWriter infoStream, DocumentsWriter docWriter, System.Collections.Generic.Dictionary <string, string> synced) { this.docWriter = docWriter; this.infoStream = infoStream; this.synced = synced; if (infoStream != null) { Message("init: current segments file is \"" + segmentInfos.GetCurrentSegmentFileName() + "\"; deletionPolicy=" + policy); } this.policy = policy; this.directory = directory; // First pass: walk the files and initialize our ref // counts: long currentGen = segmentInfos.GetGeneration(); IndexFileNameFilter filter = IndexFileNameFilter.GetFilter(); System.String[] files = directory.ListAll(); CommitPoint currentCommitPoint = null; for (int i = 0; i < files.Length; i++) { System.String fileName = files[i]; if (filter.Accept(null, fileName) && !fileName.Equals(IndexFileNames.SEGMENTS_GEN)) { // Add this file to refCounts with initial count 0: GetRefCount(fileName); if (fileName.StartsWith(IndexFileNames.SEGMENTS)) { // This is a commit (segments or segments_N), and // it's valid (<= the max gen). Load it, then // incref all files it refers to: if (infoStream != null) { Message("init: load commit \"" + fileName + "\""); } SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, fileName); } catch (System.IO.FileNotFoundException e) { // LUCENE-948: on NFS (and maybe others), if // you have writers switching back and forth // between machines, it's very likely that the // dir listing will be stale and will claim a // file segments_X exists when in fact it // doesn't. So, we catch this and handle it // as if the file does not exist if (infoStream != null) { Message("init: hit FileNotFoundException when loading commit \"" + fileName + "\"; skipping this commit point"); } sis = null; } catch (System.IO.IOException e) { if (SegmentInfos.GenerationFromSegmentsFileName(fileName) <= currentGen) { throw e; } else { // Most likely we are opening an index that // has an aborted "future" commit, so suppress // exc in this case sis = null; } } if (sis != null) { CommitPoint commitPoint = new CommitPoint(this, commitsToDelete, directory, sis); if (sis.GetGeneration() == segmentInfos.GetGeneration()) { currentCommitPoint = commitPoint; } commits.Add(commitPoint); IncRef(sis, true); if (lastSegmentInfos == null || sis.GetGeneration() > lastSegmentInfos.GetGeneration()) { lastSegmentInfos = sis; } } } } } if (currentCommitPoint == null) { // We did not in fact see the segments_N file // corresponding to the segmentInfos that was passed // in. Yet, it must exist, because our caller holds // the write lock. This can happen when the directory // listing was stale (eg when index accessed via NFS // client with stale directory listing cache). So we // try now to explicitly open this commit point: SegmentInfos sis = new SegmentInfos(); try { sis.Read(directory, segmentInfos.GetCurrentSegmentFileName()); } catch (System.IO.IOException e) { throw new CorruptIndexException("failed to locate current segments_N file"); } if (infoStream != null) { Message("forced open of current segments file " + segmentInfos.GetCurrentSegmentFileName()); } currentCommitPoint = new CommitPoint(this, commitsToDelete, directory, sis); commits.Add(currentCommitPoint); IncRef(sis, true); } // We keep commits list in sorted order (oldest to newest): commits.Sort(); // Now delete anything with ref count at 0. These are // presumably abandoned files eg due to crash of // IndexWriter. System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <System.String, RefCount> > it = refCounts.GetEnumerator(); while (it.MoveNext()) { System.String fileName = (System.String)it.Current.Key; RefCount rc = (RefCount)refCounts[fileName]; if (0 == rc.count) { if (infoStream != null) { Message("init: removing unreferenced file \"" + fileName + "\""); } DeleteFile(fileName); } } // Finally, give policy a chance to remove things on // startup: policy.OnInit(commits); // Always protect the incoming segmentInfos since // sometime it may not be the most recent commit Checkpoint(segmentInfos, false); startingCommitDeleted = currentCommitPoint.IsDeleted(); DeleteCommits(); }
public virtual void CopyTo(SoftFluent.Samples.EncryptAspect.CustomerCollection collection, bool deep) { if ((typeof(System.ICloneable).IsAssignableFrom(typeof(SoftFluent.Samples.EncryptAspect.Customer)) == false)) { deep = false; } System.Collections.Generic.IEnumerator <SoftFluent.Samples.EncryptAspect.Customer> enumerator = this.GetEnumerator(); bool b; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { if ((deep == true)) { collection.Add(((SoftFluent.Samples.EncryptAspect.Customer)(((System.ICloneable)(enumerator.Current)).Clone()))); } else { collection.Add(enumerator.Current); } } }
static int _m_GetEnumerator(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); MongoDB.Bson.Serialization.Conventions.ConventionPack gen_to_be_invoked = (MongoDB.Bson.Serialization.Conventions.ConventionPack)translator.FastGetCSObj(L, 1); { System.Collections.Generic.IEnumerator <MongoDB.Bson.Serialization.Conventions.IConvention> gen_ret = gen_to_be_invoked.GetEnumerator( ); translator.PushAny(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } }
public static System.Collections.Generic.List <ServiceStack.Translators.Generator.Tests.Support.DataContract.Customer> ToCustomers(this System.Collections.Generic.IEnumerable <ServiceStack.Translators.Generator.Tests.Support.Model.Customer> from) { if ((from == null)) { return(null); } System.Collections.Generic.List <ServiceStack.Translators.Generator.Tests.Support.DataContract.Customer> to = new System.Collections.Generic.List <ServiceStack.Translators.Generator.Tests.Support.DataContract.Customer>(); for (System.Collections.Generic.IEnumerator <ServiceStack.Translators.Generator.Tests.Support.Model.Customer> iter = from.GetEnumerator(); iter.MoveNext(); ) { ServiceStack.Translators.Generator.Tests.Support.Model.Customer item = iter.Current; to.Add(item.ToCustomer()); } return(to); }
private void SetUnpackedValueOfDictStaticKeyAndStaticItem(MsgPack.Serialization.PolymorphicMemberTypeKnownType_Dict_DictStaticKeyAndStaticItemReadOnlyCollectionField unpackingContext, System.Collections.Generic.IDictionary <string, string> unpackedValue) { System.Collections.Generic.IDictionary <string, string> existent = default(System.Collections.Generic.IDictionary <string, string>); existent = unpackingContext.DictStaticKeyAndStaticItem; System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, string> > enumerator = unpackedValue.GetEnumerator(); System.Collections.Generic.KeyValuePair <string, string> current; try { for ( ; enumerator.MoveNext(); ) { current = enumerator.Current; existent.Add(current.Key, current.Value); } } finally { enumerator.Dispose(); } }
public virtual void TestGetObects3() { string baseName = GetBaseName(); NeoDatis.Odb.ODB odb = Open(baseName); odb.Store(new NeoDatis.Odb.Test.VO.Login.Function("Test")); NeoDatis.Odb.Objects <NeoDatis.Odb.Test.VO.Login.Function> functions = odb.GetObjects (typeof(NeoDatis.Odb.Test.VO.Login.Function)); System.Collections.Generic.IEnumerator <NeoDatis.Odb.Test.VO.Login.Function> iterator = functions.GetEnumerator(); NeoDatis.Odb.Test.VO.Login.Function f = iterator.Current; odb.Close(); AssertEquals(1, functions.Count); }
public virtual System.Collections.Generic.IEnumerator <SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim> GetEnumerator() { System.Collections.Generic.IEnumerator <SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim> e = this.BaseList.GetEnumerator(); return(e); }
private void SetUnpackedValueOfDictPolymorphicItself(MsgPack.Serialization.PolymorphicMemberTypeRuntimeType_Dict_DictPolymorphicItselfGetOnlyCollectionProperty unpackingContext, System.Collections.Generic.IDictionary <string, string> unpackedValue) { System.Collections.Generic.IDictionary <string, string> existent = default(System.Collections.Generic.IDictionary <string, string>); existent = unpackingContext.DictPolymorphicItself; System.Collections.Generic.IEnumerator <System.Collections.Generic.KeyValuePair <string, string> > enumerator = unpackedValue.GetEnumerator(); System.Collections.Generic.KeyValuePair <string, string> current; try { for ( ; enumerator.MoveNext(); ) { current = enumerator.Current; existent.Add(current.Key, current.Value); } } finally { enumerator.Dispose(); } }
public FakeDbAsyncEnumerator(System.Collections.Generic.IEnumerator <T> inner) { _inner = inner; }
public System.Collections.Generic.IEnumerable <char> Transcribe(System.Collections.Generic.IEnumerable <char> input) { LetterCategory lastCategory = LetterCategory.Whitespace; System.Collections.Generic.IEnumerator <char> enumerator = input.GetEnumerator(); bool evenInsertVowel = false; //If we are done, no more elements if (!enumerator.MoveNext()) { yield break; } bool done = false; while (!done) { char current = enumerator.Current; //If we are done, no more elements if (!enumerator.MoveNext()) { done = true; } //If we are at the last element else if (current == enumerator.Current) { done = !enumerator.MoveNext(); } //Map ck to k else if (current == 'c' && enumerator.Current == 'k') { done = !enumerator.MoveNext(); current = 'k'; } //Map ch to k if last character was a vowel, //otherwise map ch to s else if (current == 'c' && enumerator.Current == 'h') { done = !enumerator.MoveNext(); current = lastCategory == LetterCategory.Vowel ? 'k' : 's'; } current = this.Map(current); LetterCategory category = this.Categorize(current); switch (category) { //Don't transpose other characters case LetterCategory.Other: break; case LetterCategory.Vowel: //If vowel, and last category was not a consonant //add a h before the vowel if (lastCategory != LetterCategory.Consonant) { yield return('h'); } yield return(current); break; case LetterCategory.Consonant: //If consonant, and the last category was a consonant, //add a u or i before the consonant if (lastCategory == LetterCategory.Consonant) { yield return((evenInsertVowel = !evenInsertVowel) ? 'u' : 'i'); } yield return(current); break; case LetterCategory.Whitespace: //If the last character in a word was a consonant, //add a u or i to the end of that word. if (lastCategory == LetterCategory.Consonant) { yield return(!evenInsertVowel ? 'u' : 'i'); } evenInsertVowel = false; if (lastCategory != LetterCategory.Whitespace) { yield return(' '); } break; } if (category != LetterCategory.Other) { lastCategory = category; } } if (lastCategory == LetterCategory.Consonant) { yield return((evenInsertVowel = !evenInsertVowel) ? 'u' : 'i'); } }
internal IntComboListLocalEnumerator(System.Collections.Generic.IEnumerator <IntComboList.B8> b8enum) { this.b8enum = b8enum; }
public DelegatingEnumerator(System.Collections.Generic.IEnumerator <TDeclared> inner, Microsoft.AspNetCore.Mvc.Formatters.Xml.IWrapperProvider wrapperProvider) { }