internal RestCollection(IEnumerator enumerator)
        {
            if (enumerator == null)
                this._inner = new object[0];
            else
            {
                ArrayList list = new ArrayList();
                //try
                //{
                //    object o = enumerator.Current;
                //    list.Add(o);
                //}
                //catch (InvalidOperationException)
                //{
                //    // Just means there's no current object
                //}

                while (enumerator.MoveNext())
                {
                    list.Add(enumerator.Current);
                }
                this._inner = list;
                _count = _inner.Count-1;
            }
        }
 /// <summary>
 /// 导出销售汇总记录至Excel 构造函数
 /// </summary>
 /// <param name="_list">列表</param>
 /// <param name="_type">类型</param>
 /// <param name="_SavePath">保存路径</param>
 public ExPortDataToExcel(System.Collections.ICollection _list, UIModels.SellTotalType _type, string _SavePath)
 {
     dataList = _list;
      SellTotalType = _type;
     SaveExcelPath = _SavePath;
     IsExportSellTotalData = true;
 }
Exemple #3
0
		public SpanWeight(SpanQuery query, Searcher searcher)
		{
			this.similarity = query.GetSimilarity(searcher);
			this.query = query;
			this.terms = query.GetTerms();
			
			idf = this.query.GetSimilarity(searcher).Idf(terms, searcher);
		}
 internal RestCollection(ICollection collection)
 {
     if ( (collection == null) || (collection.Count < 2) )
         _inner = new object[0];
     else
     {
         _inner = collection;
         _count = _inner.Count - 1;
     }
 }
Exemple #5
0
 public override void PreFlush(System.Collections.ICollection entities)
 {
 }
Exemple #6
0
        public System.Collections.ICollection FilterList(System.Collections.ICollection _List, ListFilterCondition _conditon)
        {
            List <GouJinInfo> list       = (List <GouJinInfo>)_List;
            List <GouJinInfo> returnlist = new List <GouJinInfo>();

            foreach (GouJinInfo _gjinfo in list)
            {
                if (AddRecordByTime(_gjinfo.p_date.Value, _conditon))
                {
                    if (_gjinfo.p_clmc.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_cpmc.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_date.Value.ToString("yyyy-MM-dd HH:mm:ss").Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_dw.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_ggxh.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_gys.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_jsr.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_mjph.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_ph.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_zczh.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                    if (_gjinfo.p_zzs.Contains(_conditon.FilterText))
                    {
                        returnlist.Add(_gjinfo);
                        continue;
                    }
                }
            }
            return(returnlist);
        }
 /// <summary>
 /// Returns an empty ICollection if the given ICollection is null, otherwise returns the given ICollection.
 /// </summary>
 /// <param name="collection">ICollection to be checked.</param>
 /// <returns>A non null ICollection.</returns>
 public static System.Collections.ICollection EmptyIfNull(this System.Collections.ICollection collection) => collection ??
 (System.Collections.ICollection)EmptyIfNull((ICollection <object>)null);
 public virtual void AddRange(System.Collections.ICollection c)
 {
 }
 public ExtendedProtectionPolicy(PolicyEnforcement policyEnforcement, ProtectionScenario protectionScenario, System.Collections.ICollection customServiceNames)
 {
 }
Exemple #10
0
 public override void AddRange(System.Collections.ICollection c)
 {
     base.AddRange(c);
     FireChangedEvent();
 }
 public CatalogPartCollection(System.Collections.ICollection catalogParts)
 {
 }
        public void TestReadOnlyCollectionBuilder()
        {
            int cnt = 0;

            // Empty
            ReadOnlyCollectionBuilder <int> a = new ReadOnlyCollectionBuilder <int>();

            AreEqual(0, a.Count);
            AreEqual(0, a.Capacity);
            AreEqual(a.ToReadOnlyCollection().Count, 0);
            AreEqual(a.ToReadOnlyCollection().Count, 0);

            // Simple case
            a.Add(5);
            AreEqual(1, a.Count);
            AreEqual(4, a.Capacity);
            AreEqual(a.ToReadOnlyCollection()[0], 5);
            AreEqual(a.ToReadOnlyCollection().Count, 0);  // Will reset

            a = new ReadOnlyCollectionBuilder <int>(0);
            AreEqual(0, a.Count);
            AssertError <ArgumentException>(() => a = new ReadOnlyCollectionBuilder <int>(-1));

            a = new ReadOnlyCollectionBuilder <int>(5);
            for (int i = 1; i <= 10; i++)
            {
                a.Add(i);
            }

            AreEqual(10, a.Capacity);
            System.Collections.ObjectModel.ReadOnlyCollection <int> readonlyCollection = a.ToReadOnlyCollection();
            AreEqual(0, a.Capacity);
            AreEqual(readonlyCollection.Count, 10);

            ReadOnlyCollectionBuilder <int> b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);

            b.Add(11);
            AreEqual(b.Count, 11);

            AssertError <ArgumentException>(() => a = new ReadOnlyCollectionBuilder <int>(null));

            // Capacity tests
            b.Capacity = 11;
            AssertError <ArgumentException>(() => b.Capacity = 10);
            b.Capacity = 50;
            AreEqual(b.Count, 11);
            AreEqual(b.Capacity, 50);

            // IndexOf cases
            AreEqual(b.IndexOf(5), 4);
            AreEqual(b[4], 5);
            a = new ReadOnlyCollectionBuilder <int>();
            AreEqual(a.IndexOf(5), -1);

            // Insert cases
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            AssertError <ArgumentException>(() => b.Insert(11, 11));
            b.Insert(2, 24);
            AreEqual(b.Count, 11);
            AreEqual(b[1], 2);
            AreEqual(b[2], 24);
            AreEqual(b[3], 3);
            b.Insert(11, 1234);
            AssertError <ArgumentException>(() => b.Insert(-1, 55));
            AreEqual(b[11], 1234);
            AreEqual(b.ToReadOnlyCollection().Count, 12);

            // Remove
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            AreEqual(b.Remove(2), true);
            AreEqual(b[0], 1);
            AreEqual(b[1], 3);
            AreEqual(b[2], 4);
            AreEqual(b.Remove(2), false);

            // RemoveAt
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            b.RemoveAt(2);
            AreEqual(b[1], 2);
            AreEqual(b[2], 4);
            AreEqual(b[3], 5);
            AssertError <ArgumentException>(() => b.RemoveAt(-5));
            AssertError <ArgumentException>(() => b.RemoveAt(9));

            // Clear
            b.Clear();
            AreEqual(b.Count, 0);
            AreEqual(b.ToReadOnlyCollection().Count, 0);
            b = new ReadOnlyCollectionBuilder <int>();
            b.Clear();
            AreEqual(b.Count, 0);

            // Contains
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            AreEqual(b.Contains(5), true);
            AreEqual(b.Contains(-3), false);

            ReadOnlyCollectionBuilder <object> c = new ReadOnlyCollectionBuilder <object>();

            c.Add("HI");
            AreEqual(c.Contains("HI"), true);
            AreEqual(c.Contains(null), false);
            c.Add(null);
            AreEqual(c.Contains(null), true);

            // CopyTo
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            int[] ary = new int[10];
            b.CopyTo(ary, 0);

            AreEqual(ary[0], 1);
            AreEqual(ary[9], 10);

            // Reverse
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            b.Reverse();
            // 1..10
            cnt = 10;
            for (int i = 0; i < 10; i++)
            {
                AreEqual(b[i], cnt--);
            }

            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            AssertError <ArgumentException>(() => b.Reverse(-1, 5));
            AssertError <ArgumentException>(() => b.Reverse(5, -1));
            b.Reverse(3, 3);
            // 1,2,3,4,5,6,7,8,9.10
            // 1,2,3,6,5,4,7,8,9,10
            AreEqual(b[1], 2);
            AreEqual(b[2], 3);
            AreEqual(b[3], 6);
            AreEqual(b[4], 5);
            AreEqual(b[5], 4);
            AreEqual(b[6], 7);

            // ToArray
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            int[] intAry = b.ToArray();
            AreEqual(intAry[0], 1);
            AreEqual(intAry[9], 10);

            b      = new ReadOnlyCollectionBuilder <int>();
            intAry = b.ToArray();
            AreEqual(intAry.Length, 0);

            // IEnumerable cases
            b   = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            cnt = 0;
            foreach (int i in b)
            {
                cnt++;
            }
            AreEqual(cnt, 10);

            b   = new ReadOnlyCollectionBuilder <int>();
            cnt = 0;
            foreach (int i in b)
            {
                cnt++;
            }
            AreEqual(cnt, 0);

            // Error case
            AssertError <InvalidOperationException>(() => ChangeWhileEnumeratingAdd());
            AssertError <InvalidOperationException>(() => ChangeWhileEnumeratingRemove());

            // IList members
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            System.Collections.IList lst = b;

            // IsReadOnly
            AreEqual(lst.IsReadOnly, false);

            // Add
            AreEqual(lst.Add(11), 10);
            AreEqual(lst.Count, 11);
            AssertError <ArgumentException>(() => lst.Add("MOM"));
            AssertError <ArgumentException>(() => lst.Add(null));

            c = new ReadOnlyCollectionBuilder <object>();

            c.Add("HI");
            c.Add(null);
            lst = c;
            lst.Add(null);
            AreEqual(lst.Count, 3);

            // Contains
            lst = b;
            AreEqual(lst.Contains(5), true);
            AreEqual(lst.Contains(null), false);

            lst = c;
            AreEqual(lst.Contains("HI"), true);
            AreEqual(lst.Contains("hi"), false);
            AreEqual(lst.Contains(null), true);

            // IndexOf
            lst = b;
            AreEqual(lst.IndexOf(null), -1);
            AreEqual(lst.IndexOf(1234), -1);
            AreEqual(lst.IndexOf(5), 4);

            // Insert
            b   = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            lst = b;
            AssertError <ArgumentException>(() => lst.Insert(11, 11));
            lst.Insert(2, 24);
            AreEqual(lst.Count, 11);
            AreEqual(lst[1], 2);
            AreEqual(lst[2], 24);
            AreEqual(lst[3], 3);
            lst.Insert(11, 1234);
            AssertError <ArgumentException>(() => lst.Insert(-1, 55));
            AreEqual(lst[11], 1234);

            AssertError <ArgumentException>(() => lst.Insert(3, "MOM"));

            // IsFixedSize
            AreEqual(lst.IsFixedSize, false);

            // Remove
            b   = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            lst = b;
            lst.Remove(2);
            AreEqual(lst[0], 1);
            AreEqual(lst[1], 3);
            AreEqual(lst[2], 4);
            lst.Remove(2);

            // Indexing
            lst[3] = 234;
            AreEqual(lst[3], 234);
            AssertError <ArgumentException>(() => lst[3] = null);
            AssertError <ArgumentException>(() => lst[3] = "HI");

            // ICollection<T>

            // IsReadOnly
            System.Collections.Generic.ICollection <int> col = b;
            AreEqual(col.IsReadOnly, false);

            // ICollection
            b = new ReadOnlyCollectionBuilder <int>(readonlyCollection);
            System.Collections.ICollection col2 = b;
            AreEqual(col2.IsSynchronized, false);
            Assert(col2.SyncRoot != null);
            intAry = new int[10];
            col2.CopyTo(intAry, 0);
            AreEqual(intAry[0], 1);
            AreEqual(intAry[9], 10);

            string[] str = new string[50];
            AssertError <ArrayTypeMismatchException>(() => col2.CopyTo(str, 0));
        }
Exemple #13
0
 public WhereNode <T, S> In(System.Collections.ICollection value)
 {
     return(new WhereNode <T, S>(this, WhereOpt.IN, value));
 }
 // idf used for phrase queries
 public override float Idf(System.Collections.ICollection terms, Searcher searcher)
 {
     return(1);
 }
 internal ReaderCommit(SegmentInfos infos, Directory dir)
 {
     segmentsFileName = infos.GetCurrentSegmentFileName();
     this.dir = dir;
     userData = infos.GetUserData();
     files = System.Collections.ArrayList.ReadOnly(new System.Collections.ArrayList(infos.Files(dir, true)));
     version = infos.GetVersion();
     generation = infos.GetGeneration();
     isOptimized = infos.Count == 1 && !infos.Info(0).HasDeletions();
 }
 public TraceContextEventArgs(System.Collections.ICollection records)
 {
 }
 public Stack(System.Collections.ICollection col)
 {
 }
 public Queue(System.Collections.ICollection col)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ValidatorBase"/> class.
        /// </summary>
        /// <param name="type">Can not be null.</param>
        /// <exception cref="ArgumentNullException">Thrown is null Type argument passed.</exception>
        public ValidatorBase(Type type)
        {
            if (type == null)
              {
            throw new ArgumentNullException("type", "Null Type argument passed.");
              }

              valueType = type;
              if (type.IsValueType)
              {
            defaultValue = Activator.CreateInstance(type);
            doAllowNull = false;
              }
              else
              {
            defaultValue = null;
            doAllowNull = true;
              }

              standardValues = null;
              isStandardValuesExclusive = false;

              maximumValue = null;
              minimumValue = null;
              nullString = string.Empty;
              nullDisplayString = string.Empty;
        }
 /// <summary>
 /// 导出数据至Excel 构造函数
 /// </summary>
 /// <param name="_list"></param>
 /// <param name="_type"></param>
 /// <param name="_SavePath">导出文件存储路径</param>
 public ExPortDataToExcel(System.Collections.ICollection _list, UIModels.EntryType _type,string _SavePath)
 {
     dataList = _list;
     dataType = _type;
     SaveExcelPath = _SavePath;
 }
 public ExtendedProtectionPolicy(System.Security.Authentication.ExtendedProtection.PolicyEnforcement policyEnforcement, System.Security.Authentication.ExtendedProtection.ProtectionScenario protectionScenario, System.Collections.ICollection customServiceNames)
 {
 }
 public ServiceNameCollection(System.Collections.ICollection items)
 {
 }
Exemple #23
0
        public override bool GlobalInvoke(CommandID commandID)
        {
            // 删除命令
            // 拷贝命令
            // 剪切命令
            if (StandardCommands.Delete == commandID ||
                StandardCommands.Copy == commandID ||
                StandardCommands.Cut == commandID)
            {
                ISelectionService selectionService = GetService(typeof(ISelectionService)) as ISelectionService;
                if (selectionService != null)
                {
                    System.Collections.ICollection ic = selectionService.GetSelectedComponents();
                    System.Collections.IEnumerator ie = ic.GetEnumerator();
                    while (ie.MoveNext())
                    {
                        if (PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.IsIndependentDesignerMode)
                        {
                            object[] obs = ie.Current.GetType().GetCustomAttributes(false);
                            foreach (object ob in obs)
                            {
                                // 不删除设计时的基本控件带属性标签MES.PublicInterface.MESBasicDesignerControlAttributeAttribute
                                if (ob.ToString() == "MES.PublicInterface.MESBasicDesignerControlAttributeAttribute")
                                {
                                    return(false);
                                }

                                //以下为测试设计时设置Enable属性代码,无效
                                //if (ob is uctest.SimpleControlDesigner)
                                //    (ob as uctest.SimpleControlDesigner).Enabled = false;
                            }
                        }
                    }
                }
            }
            else if (StandardCommands.Paste == commandID)
            {
                int    msgID  = PMS.Libraries.ToolControls.PMSPublicInfo.Message.USER_DOCOUTLINEREFRESHSWITCH;
                IntPtr handle = PMS.Libraries.ToolControls.PMSPublicInfo.Message.DocumentOutlineFormHandle;

                PMS.Libraries.ToolControls.PMSPublicInfo.Message.SendMsgToMainForm(handle, msgID, IntPtr.Zero, IntPtr.Zero);
                IDesignerHost       host1 = (IDesignerHost)this.GetService(typeof(IDesignerHost));
                DesignerTransaction tran1 = host1.CreateTransaction("Paste");
                bool  bret     = base.GlobalInvoke(StandardCommands.Paste);
                Point oldPoint = Point.Empty;
                if (_selectionService != null)
                {
                    Control ctrl = _selectionService.PrimarySelection as Control;
                    if (null != ctrl)
                    {
                        oldPoint = ctrl.Location;
                    }
                }
                System.Collections.ICollection selectedComponents1 = null;
                if (_selectionService != null)
                {
                    Point newPoint = _lastPoint;
                    int   xOffset  = newPoint.X - oldPoint.X;
                    int   yOffset  = newPoint.Y - oldPoint.Y;
                    selectedComponents1 = _selectionService.GetSelectedComponents();
                    _selectionService.SetSelectedComponents(null);
                    foreach (object ob in selectedComponents1)
                    {
                        if (ob is Control)
                        {
                            IComponentChangeService componentChangeService = (IComponentChangeService)this._serviceProvider.GetService(typeof(IComponentChangeService));
                            Control co = ob as Control;
                            componentChangeService.OnComponentChanging(co, null);
                            Point oldValue = co.Location;
                            Point newValue = new Point(co.Location.X + xOffset, co.Location.Y + yOffset);
                            co.Location = newValue;
                            componentChangeService.OnComponentChanged(co, null, oldValue, newValue);
                        }
                    }
                    _selectionService.SetSelectedComponents(selectedComponents1);
                }
                tran1.Commit();
                PMS.Libraries.ToolControls.PMSPublicInfo.Message.SendMsgToMainForm(handle, msgID, IntPtr.Zero, (IntPtr)1);
                return(bret);
            }
            else if (PropertyCommand == commandID)
            {
                int    msgID  = PMS.Libraries.ToolControls.PMSPublicInfo.Message.USER_SHOWPROPERTYGRID;
                IntPtr handle = PMS.Libraries.ToolControls.PMSPublicInfo.Message.PMSDeveloperControlHandle;
                PMS.Libraries.ToolControls.PMSPublicInfo.Message.SendMsgToMainForm(handle, msgID, IntPtr.Zero, IntPtr.Zero);
            }
            return(base.GlobalInvoke(commandID));
        }
Exemple #24
0
 public override void InsertRange(int index, System.Collections.ICollection c)
 {
     base.InsertRange(index, c);
     FireChangedEvent();
 }
 /// <summary> Creates a new DisjunctionMaxQuery</summary>
 /// <param name="disjuncts">a Collection&lt;Query&gt; of all the disjuncts to add
 /// </param>
 /// <param name="tieBreakerMultiplier">  the weight to give to each matching non-maximum disjunct
 /// </param>
 public DisjunctionMaxQuery(System.Collections.ICollection disjuncts, float tieBreakerMultiplier)
 {
     this.tieBreakerMultiplier = tieBreakerMultiplier;
     Add(disjuncts);
 }
        public async Task <bool> UploadInBackground()
        {
            try
            {
                Cursor.Current = Cursors.AppStarting;
                this.PopulateTags();
                await this.PrepareModel();

                var res = await ChummerHub.Client.Backend.Utils.PostSINnerAsync(this);

                var response = await Backend.Utils.HandleError(res) as ResultBase;

                if (response.CallSuccess == true)
                {
                    var jsonResultString = res.Response.Content.ReadAsStringAsync().Result;
                    try
                    {
                        ResultSinnerPostSIN objIds = Newtonsoft.Json.JsonConvert.DeserializeObject <ResultSinnerPostSIN>(jsonResultString);
                        throw new NotImplementedException("Just keep coding!");
                        System.Collections.ICollection ids = objIds as System.Collections.ICollection;
                        if (ids == null || ids.Count == 0)
                        {
                            string msg = "ChummerHub did not return a valid Id for sinner " +
                                         this.MyCharacter.Name + ".";
                            Log.Error(msg);
                            throw new ArgumentException(msg);
                        }

                        var cur = ids.GetEnumerator();
                        cur.MoveNext();
                        if (!Guid.TryParse(cur.Current.ToString(), out var sinGuid))
                        {
                            string msg = "ChummerHub did not return a valid IdArray for sinner " +
                                         this.MyCharacter.Alias + ".";
                            Log.Error(msg);
                            throw new ArgumentException(msg);
                        }

                        this.MySINnerFile.Id = sinGuid;
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex);
                        throw;
                    }
                }

                //System.Diagnostics.Trace.TraceInformation("Character " + this.MyCharacter.Alias + " posted with ID " + this.MySINnerFile.Id);
                //ChummerHub.Client.Backend.Utils.UploadChummerFileAsync(this).ContinueWith((uploadtask) =>
                //{
                //    if (uploadtask.Status != TaskStatus.RanToCompletion)
                //    {
                //        if (uploadtask.Exception != null)
                //            throw uploadtask.Exception;
                //        return;
                //    }
                //    if (uploadtask.Result?.Response?.StatusCode != HttpStatusCode.OK)
                //    {
                //        System.Diagnostics.Trace.TraceWarning("Upload failed for Character " + this.MyCharacter.Alias + ": " + uploadtask.Result?.Response?.StatusCode);
                //    }
                //    else
                //        System.Diagnostics.Trace.TraceInformation("Character " + this.MyCharacter.Alias + " uploaded.");
                //});
            }
            catch (Exception e)
            {
                Log.Error(e);
                MessageBox.Show(e.ToString());
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
            throw new NotImplementedException("Just keep coding!");
        }
 /// <summary>Add a collection of disjuncts to this disjunction
 /// via Iterable
 /// </summary>
 public virtual void  Add(System.Collections.ICollection disjuncts)
 {
     this.disjuncts.AddRange(disjuncts);
 }
 public virtual void InsertRange(int index, System.Collections.ICollection c)
 {
 }
 public WebPartDescriptionCollection(System.Collections.ICollection webPartDescriptions)
 {
 }
Exemple #30
0
 public InstanceDescriptor(System.Reflection.MemberInfo member, System.Collections.ICollection arguments, bool isComplete)
 {
 }
Exemple #31
0
 public HashSetSupport(System.Collections.ICollection c)
 {
     AddAll(c);
 }
Exemple #32
0
        static int GetSizeInMemory(object obj, HashSet <object> traversedObj)
        {
            if (obj == null)
            {
                return(0);
            }
            if (obj is ILTypeInstance)
            {
                return(((ILTypeInstance)obj).GetSizeInMemory(traversedObj));
            }
            if (traversedObj.Contains(obj))
            {
                return(0);
            }
            traversedObj.Add(obj);
            if (obj is string)
            {
                return(Encoding.Unicode.GetByteCount((string)obj));
            }
            Type t = obj.GetType();

            if (t.IsArray)
            {
                Array arr         = (Array)obj;
                var   et          = t.GetElementType();
                int   elementSize = 0;
                if (et.IsPrimitive)
                {
                    elementSize = System.Runtime.InteropServices.Marshal.SizeOf(et);
                }
                else
                {
                    elementSize = 4;
                }
                return(arr.Length * elementSize);
            }
            else
            {
                if (t.IsPrimitive)
                {
                    return(System.Runtime.InteropServices.Marshal.SizeOf(t));
                }
                else
                {
                    int size = 0;
                    System.Collections.ICollection collection = obj as System.Collections.ICollection;
                    if (collection != null)
                    {
                        var enu = collection.GetEnumerator();
                        while (enu.MoveNext())
                        {
                            size += GetSizeInMemory(enu.Current, traversedObj);
                        }
                    }
                    else
                    {
                        System.Collections.IDictionary dictionary = obj as System.Collections.IDictionary;
                        if (dictionary != null)
                        {
                            var enu = dictionary.GetEnumerator();
                            while (enu.MoveNext())
                            {
                                size += GetSizeInMemory(enu.Key, traversedObj);
                                size += GetSizeInMemory(enu.Value, traversedObj);
                            }
                        }
                    }
                    return(size);
                }
            }
        }
        /// <summary>
        /// 显示处理
        /// </summary>
        /// <param name="_list"></param>
        /// <param name="State"></param>
        /// <param name="_msg"></param>
        private void Conditoncontrol_ListLoadingEndManager(System.Collections.ICollection _list, bool State, string _msg)
        {
            SortpanalBar.Visible = false;//隐藏loading..
            CmboxDeviceClass.Enabled =true;
            ThisList = _list;
            ListViewReloadData(_list);
            ShowRecordListDetail();//显示记录详情

            if (State)
            {
                TolMsgInfo.Text = string.Format("获取列表数据成功,共有 {0} 条符合条件的记录!", _list.Count);
            }
            else
            {
                TolMsgInfo.Text = "加载列表失败,原因:" + _msg;
            }
        }
 public LeftRecursionCyclesMessage( ICollection cycles )
     : base(ErrorManager.MSG_LEFT_RECURSION_CYCLES)
 {
     this.cycles = cycles;
 }
Exemple #35
0
 // TODO: we can remove I think.  All detected now with cycles check.
 public static void LeftRecursion(DecisionProbe probe,
                                  int alt,
                                  ICollection targetRules,
                                  ICollection callSiteStates)
 {
     getErrorState().warnings++;
     Message msg = new LeftRecursionMessage(probe, alt, targetRules, callSiteStates);
     getErrorState().warningMsgIDs.add(msg.msgID);
     getErrorListener().Warning(msg);
 }
        /// <summary>
        /// 列表显示
        /// </summary>
        /// <param name="_list"></param>
        /// <param name="_state"></param>
        /// <param name="_strMsg"></param>
        private void SellRecordListQueryEndManager(List<SellRecordInfo> _list,TotalSumInfo _sumInfo, bool _state, string _strMsg)
        {
            if (_state)
            {
                ListViewReloadData(_list);
                TolMsgInfo.Text = _strMsg;
            }
            else
            {
                TolMsgInfo.Text = _strMsg;
            }
            ShowTotalSumInfo(_sumInfo);

            SortpanalBar.Visible = false;//隐藏loading..
            CmboxDeviceClass.Enabled = true;
            ThisList = _list;
        }
		public SpanWeight(SpanQuery query, Searcher searcher)
		{
			this.searcher = searcher;
			this.query = query;
			this.terms = query.GetTerms();
		}
Exemple #38
0
 ///<summary>
 ///Inserts the elements of a collection into the SymbolInfoArrayList at the specified index.
 ///</summary>
 ///<param name="index">The zero-based index at which the new elements should be inserted.<param>
 ///<param name="value">The ICollection whose elements should be inserted into the SymbolInfoArrayList. The collection itself cannot be a null reference, but it can contain elements that are a null reference.<param>
 ///<returns>Return value is void</returns>
 private void InsertRange(int index, System.Collections.ICollection c)
 {
     arr.InsertRange(index, c);
 }
 public CatalogPartCollection(CatalogPartCollection existingCatalogParts, System.Collections.ICollection catalogParts)
 {
 }
Exemple #40
0
 ///<summary>
 ///Copies the elements of a collection over a range of elements in the SymbolInfoArrayList.
 ///</summary>
 ///<param name="index">The zero-based SymbolInfoArrayList index at which to start copying the elements of c.<param>
 ///<param name="c">The ICollection whose elements to copy to the ArrayList. The collection itself cannot be a null reference (Nothing in Visual Basic), but it can contain elements that are a null reference.<param>
 ///<returns>Return value is void</returns>
 private void SetRange(int index, System.Collections.ICollection c)
 {
     arr.SetRange(index, c);
 }
Exemple #41
0
 ///<summary>
 ///Adds the elements of an ICollection to the end of the SymbolInfoArrayList
 ///</summary>
 ///<param name="c">The ICollection whose elements should be added to the end of the ArrayList. The collection itself cannot be a null reference (Nothing in Visual Basic), but it can contain elements that are a null reference.<param>
 ///<returns>Return value is void</returns>
 private void AddRange(System.Collections.ICollection c)
 {
     arr.AddRange(c);
 }
Exemple #42
0
 public static void LeftRecursionCycles( ICollection cycles )
 {
     GetErrorState().errors++;
     Message msg = new LeftRecursionCyclesMessage( cycles );
     GetErrorState().errorMsgIDs.Add( msg.msgID );
     GetErrorListener().Error( msg );
 }
Exemple #43
0
        /// <summary>
        /// Extends CreateInstance so that methods that return a specific type object given a Type parameter can be
        /// used as generic method and casting is not required.
        /// <example>
        /// idesignerserializationmanager.CreateInstance<int>(arguments, name, addToContainer);
        /// </example>
        /// </summary>
        public static T CreateInstance <T>(this IDesignerSerializationManager idesignerserializationmanager, System.Collections.ICollection arguments, String name, Boolean addToContainer)
        {
            if (idesignerserializationmanager == null)
            {
                throw new ArgumentNullException("idesignerserializationmanager");
            }

            return((T)idesignerserializationmanager.CreateInstance(typeof(T), arguments, name, addToContainer));
        }
Exemple #44
0
            public CommitPoint(IndexFileDeleter enclosingInstance, System.Collections.ICollection commitsToDelete, Directory directory, SegmentInfos segmentInfos)
            {
                InitBlock(enclosingInstance);
                this.directory = directory;
                this.commitsToDelete = commitsToDelete;
                userData = segmentInfos.GetUserData();
                segmentsFileName = segmentInfos.GetCurrentSegmentFileName();
                version = segmentInfos.GetVersion();
                generation = segmentInfos.GetGeneration();
                files = segmentInfos.Files(directory, true);
                gen = segmentInfos.GetGeneration();
                isOptimized = segmentInfos.Count == 1 && !segmentInfos.Info(0).HasDeletions();

                System.Diagnostics.Debug.Assert(!segmentInfos.HasExternalSegments(directory));
            }
 public RestCollectionIterator(RestCollection collection)
 {
     this.collection = collection._inner;
     Reset();
 }