byte[] PackageValueDictionary(KeyEntry keyEntry, Entry entry, Type type) { bool isGeneric = IsTheTypes(type, typeof(System.Collections.Generic.IDictionary <,>)); TreePackage package = new TreePackage(); package.Attributes.Add("IsGeneric", isGeneric); if (isGeneric) { Type[] types = GetTheTypes(type, typeof(System.Collections.Generic.IDictionary <,>)).GetGenericArguments(); package.Attributes.Add("T1", types[0].AssemblyQualifiedName); package.Attributes.Add("T2", types[1].AssemblyQualifiedName); Type typeX = GetTheTypes(type, typeof(System.Collections.Generic.Dictionary <,>)); if (typeX != null && typeX.GetGenericArguments()[0] == typeof(string)) { package.Attributes.Add("KeyIsString", true); System.Collections.Generic.IEqualityComparer <string> comparer = (System.Collections.Generic.IEqualityComparer <string>)FastWrapper.Get(entry.Value, "Comparer"); package.Attributes.Add("ComparerIgnoreCase", (comparer == StringComparer.CurrentCultureIgnoreCase || comparer == StringComparer.InvariantCultureIgnoreCase || comparer == StringComparer.OrdinalIgnoreCase)); } } int index = -1; foreach (object item in (System.Collections.IEnumerable)entry.Value) { index++; package.Add(index.ToString(), FastWrapper.Get(item, "Value")); Entry itemEntry = package.Entries[index.ToString()]; itemEntry.Attributes.Add("Key", FastWrapper.Get(item, "Key")); } return(package.Save()); }
static int __CreateInstance(RealStatePtr L) { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); try { if (LuaAPI.lua_gettop(L) == 1) { System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_ret = new System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>(); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEqualityComparer <ulong> >(L, 2)) { System.Collections.Generic.IEqualityComparer <ulong> comparer = (System.Collections.Generic.IEqualityComparer <ulong>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEqualityComparer <ulong>)); System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_ret = new System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>(comparer); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip> >(L, 2)) { System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip> dictionary = (System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip>)); System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_ret = new System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>(dictionary); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int capacity = LuaAPI.xlua_tointeger(L, 2); System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_ret = new System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>(capacity); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip> >(L, 2) && translator.Assignable <System.Collections.Generic.IEqualityComparer <ulong> >(L, 3)) { System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip> dictionary = (System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IDictionary <ulong, xc.GoodsEquip>)); System.Collections.Generic.IEqualityComparer <ulong> comparer = (System.Collections.Generic.IEqualityComparer <ulong>)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEqualityComparer <ulong>)); System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_ret = new System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>(dictionary, comparer); translator.Push(L, __cl_gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <System.Collections.Generic.IEqualityComparer <ulong> >(L, 3)) { int capacity = LuaAPI.xlua_tointeger(L, 2); System.Collections.Generic.IEqualityComparer <ulong> comparer = (System.Collections.Generic.IEqualityComparer <ulong>)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEqualityComparer <ulong>)); System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip> __cl_gen_ret = new System.Collections.Generic.Dictionary <ulong, xc.GoodsEquip>(capacity, comparer); translator.Push(L, __cl_gen_ret); return(1); } } catch (System.Exception __gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.Dictionary<ulong, xc.GoodsEquip> constructor!")); }
public MosekSolver(System.Collections.Generic.IEqualityComparer <object> EqCompare) : base(EqCompare) { env = new mosek.Env(); env.set_Stream(mosek.streamtype.log, null); env.set_Stream(mosek.streamtype.msg, null); env.set_Stream(mosek.streamtype.err, null); env.init(); msgStream = new MosekMsg(); }
/// <summary> /// Determines if contents of both lists are equal ignoring their order. /// <locDE><para />Ermittelt ob die beiden Listen den gleichen Inhalt haben (ohne Rücksicht auf die Reihenfolge).</locDE> /// </summary> /// <typeparam name="T">The element type of the lists.<locDE><para />Elementtyp der Listen.</locDE></typeparam> /// <param name="list1">The first list.<locDE><para />Erste Liste.</locDE></param> /// <param name="list2">The second list.<locDE><para />Zweite Liste.</locDE></param> /// <param name="comparer">The comparer method.<locDE><para />Vergleichsmethode.</locDE></param> /// <returns>True if equal.<locDE><para />True falls identisch.</locDE></returns> public static bool EqualContentsIgnoreOrder <T>(this System.Collections.Generic.IEnumerable <T> list1, System.Collections.Generic.IEnumerable <T> list2, System.Collections.Generic.IEqualityComparer <T> comparer) { #region Handle list(s) being null if (null == list1 && null == list2) { return(true); } if (null == list1 && null != list2) { return(false); } if (null != list1 && null == list2) { return(false); } #endregion Handle list(s) being null // https://stackoverflow.com/questions/3669970/compare-two-listt-objects-for-equality-ignoring-order var cnt = new System.Collections.Generic.Dictionary <T, int>(comparer); foreach (T s in list1) { if (cnt.ContainsKey(s)) { cnt[s]++; } else { cnt.Add(s, 1); } } foreach (T s in list2) { if (cnt.ContainsKey(s)) { cnt[s]--; } else { return(false); } } return(cnt.Values.All(c => c == 0)); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { var gen_ret = new System.Collections.Generic.Dictionary <string, UnityEngine.GameObject>(); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); var gen_ret = new System.Collections.Generic.Dictionary <string, UnityEngine.GameObject>(_capacity); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEqualityComparer <string> >(L, 2)) { System.Collections.Generic.IEqualityComparer <string> _comparer = (System.Collections.Generic.IEqualityComparer <string>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEqualityComparer <string>)); var gen_ret = new System.Collections.Generic.Dictionary <string, UnityEngine.GameObject>(_comparer); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <System.Collections.Generic.IEqualityComparer <string> >(L, 3)) { int _capacity = LuaAPI.xlua_tointeger(L, 2); System.Collections.Generic.IEqualityComparer <string> _comparer = (System.Collections.Generic.IEqualityComparer <string>)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEqualityComparer <string>)); var gen_ret = new System.Collections.Generic.Dictionary <string, UnityEngine.GameObject>(_capacity, _comparer); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Generic.Dictionary<string, UnityEngine.GameObject> constructor!")); }
/// <summary> /// Removes if collection contains the given element. /// <locDE><para />Entfernt das Element falls es in der Liste enthalten ist.</locDE> /// </summary> /// <typeparam name="T">The element type of the list.<locDE><para />Elementtyp der Liste.</locDE></typeparam> /// <param name="collection">The collection.<locDE><para />Die Liste.</locDE></param> /// <param name="value">The value.<locDE><para />Der Wert.</locDE></param> /// <param name="comparer">The comparer method (or null).<locDE><para />Die Vergleichsmethode (oder null).</locDE></param> /// <returns>True if element was contained.<locDE><para />True falls das Element in der Liste war.</locDE></returns> public static bool RemoveIfContains <T>(this System.Collections.Generic.ICollection <T> collection, T value, System.Collections.Generic.IEqualityComparer <T> comparer = null) { if (null == collection) { return(false); } if (IgnoreNullValues && null == value) { // Don't remove null values // Null Wert nicht entfernen return(false); } if (null == comparer) { if (collection.Contains(value)) { // Contained, remove // Enthalten, entfernen collection.Remove(value); return(true); } } else { if (collection.Contains(value, comparer)) { // Contained, remove // Enthalten, entfernen collection.Remove(value); return(true); } } // Not contained // Nicht enthalten return(false); }
/// <summary> /// Adds if collection not already contains the given element. /// <locDE><para />Fügt das Element hinzu, falls es noch nicht in der Liste ist.</locDE> /// </summary> /// <typeparam name="T">The element type of the list.<locDE><para />Elementtyp der Liste.</locDE></typeparam> /// <param name="collection">The collection.<locDE><para />Die Liste.</locDE></param> /// <param name="value">The value.<locDE><para />Der Wert.</locDE></param> /// <param name="comparer">The comparer method (or null).<locDE><para />Die Vergleichsmethode (oder null).</locDE></param> /// <returns>True if element was not contained yet.<locDE><para />True falls das Element noch nicht in der Liste war.</locDE></returns> public static bool AddIfNotContains <T>(this System.Collections.Generic.ICollection <T> collection, T value, System.Collections.Generic.IEqualityComparer <T> comparer = null) { if (null == collection) { return(false); } if (IgnoreNullValues && null == value) { // Don't add null values // Null Wert nicht hinzufügen return(false); } if (null == comparer) { if (collection.Contains(value)) { // Already contained // Bereits enthalten return(false); } } else { if (collection.Contains(value, comparer)) { // Already contained // Bereits enthalten return(false); } } collection.Add(value); return(true); }
public CompareFuncName(System.Collections.Generic.IEqualityComparer <byte[]> ptrlencmp) { _ptrlencmp = ptrlencmp; }
/// <summary> /// Create an entry equalityComparer from a specified item equalityComparer for the keys /// </summary> /// <param name="keyequalityComparer">The key equalitySCG.Comparer</param> public KeyValuePairEqualityComparer(System.Collections.Generic.IEqualityComparer <K> keyequalityComparer) { this.keyequalityComparer = keyequalityComparer ?? throw new NullReferenceException("Key equality comparer cannot be null"); }
/// <summary> /// Create an entry equalityComparer using the default equalityComparer for keys /// </summary> public KeyValuePairEqualityComparer() { keyequalityComparer = EqualityComparer <K> .Default; }
/// <summary> /// /// </summary> /// <param name="keyequalityComparer"></param> protected DictionaryBase(System.Collections.Generic.IEqualityComparer <K> keyequalityComparer) { this.keyequalityComparer = keyequalityComparer ?? throw new NullReferenceException("Key equality comparer cannot be null"); }
static int __CreateInstance(RealStatePtr L) { try { ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L); if (LuaAPI.lua_gettop(L) == 1) { System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3)) { int _concurrencyLevel = LuaAPI.xlua_tointeger(L, 2); int _capacity = LuaAPI.xlua_tointeger(L, 3); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(_concurrencyLevel, _capacity); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> > >(L, 2)) { System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> > _collection = (System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> >)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> >)); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(_collection); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 2 && translator.Assignable <System.Collections.Generic.IEqualityComparer <long> >(L, 2)) { System.Collections.Generic.IEqualityComparer <long> _comparer = (System.Collections.Generic.IEqualityComparer <long>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEqualityComparer <long>)); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(_comparer); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 3 && translator.Assignable <System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> > >(L, 2) && translator.Assignable <System.Collections.Generic.IEqualityComparer <long> >(L, 3)) { System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> > _collection = (System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> >)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> >)); System.Collections.Generic.IEqualityComparer <long> _comparer = (System.Collections.Generic.IEqualityComparer <long>)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEqualityComparer <long>)); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(_collection, _comparer); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && translator.Assignable <System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> > >(L, 3) && translator.Assignable <System.Collections.Generic.IEqualityComparer <long> >(L, 4)) { int _concurrencyLevel = LuaAPI.xlua_tointeger(L, 2); System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> > _collection = (System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> >)translator.GetObject(L, 3, typeof(System.Collections.Generic.IEnumerable <System.Collections.Generic.KeyValuePair <long, ulong> >)); System.Collections.Generic.IEqualityComparer <long> _comparer = (System.Collections.Generic.IEqualityComparer <long>)translator.GetObject(L, 4, typeof(System.Collections.Generic.IEqualityComparer <long>)); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(_concurrencyLevel, _collection, _comparer); translator.Push(L, gen_ret); return(1); } if (LuaAPI.lua_gettop(L) == 4 && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 2) && LuaTypes.LUA_TNUMBER == LuaAPI.lua_type(L, 3) && translator.Assignable <System.Collections.Generic.IEqualityComparer <long> >(L, 4)) { int _concurrencyLevel = LuaAPI.xlua_tointeger(L, 2); int _capacity = LuaAPI.xlua_tointeger(L, 3); System.Collections.Generic.IEqualityComparer <long> _comparer = (System.Collections.Generic.IEqualityComparer <long>)translator.GetObject(L, 4, typeof(System.Collections.Generic.IEqualityComparer <long>)); System.Collections.Concurrent.ConcurrentDictionary <long, ulong> gen_ret = new System.Collections.Concurrent.ConcurrentDictionary <long, ulong>(_concurrencyLevel, _capacity, _comparer); translator.Push(L, gen_ret); return(1); } } catch (System.Exception gen_e) { return(LuaAPI.luaL_error(L, "c# exception:" + gen_e)); } return(LuaAPI.luaL_error(L, "invalid arguments to System.Collections.Concurrent.ConcurrentDictionary<long, ulong> constructor!")); }
protected override IMutableLookup <T, TE> GetLookupImplementation <T, TE>(System.Collections.Generic.IEqualityComparer <T> keyEquality) { return(new BidirectionalLookup <T, TE> (keyEquality, EqualityComparer <TE> .Default)); }
public MosekSimplexSolver(System.Collections.Generic.IEqualityComparer <object> EqCompare) : base(EqCompare) { }
public MosekInteriorPointSolver(System.Collections.Generic.IEqualityComparer <object> EqCompare) : base(EqCompare) { }