void Parse(FilterDocument filter)
		{

		}
Exemple #2
0
        public void SetFilter(string strName,
            FilterDocument filter)
        {
            if (IgnoreCase == true)
                strName = strName.ToLower();
            FilterList filterlist = null;

            this.m_lock.AcquireWriterLock(m_nLockTimeout);
            try
            {
                filterlist = (FilterList)table[strName];

                if (filterlist == null)
                {
                    filterlist = new FilterList();
                    filterlist.Container = this;
                    table[strName] = filterlist;
                }

            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }

            filterlist.SetFilter(filter);
        }
Exemple #3
0
        public void ReturnFilter(FilterDocument filter)
        {
            this.m_lock.AcquireReaderLock(m_nLockTimeout);
            try
            {
                for (int i = 0; i < list.Count; i++)
                {
                    FilterHolder item = this.list[i];

                    if (item.FilterDocument == filter)
                    {
                        int nValue = Interlocked.Decrement(ref item.UsedCount);
                        if (nValue < 0)
                        {
                            throw new Exception("还回后UsedCount小于0, 错误");
                        } 
                        return;
                    }

                }

            }
            finally
            {
                this.m_lock.ReleaseReaderLock();
            }

            throw new Exception("还回的对象在数组中没有找到");
        }
Exemple #4
0
        // return:
        //      true    已经加入
        //      false   未加入
        public bool NewFilter(FilterDocument filter)
        {
            this.m_lock.AcquireWriterLock(m_nLockTimeout);
            try
            {


                if (this.list.Count >= this.Container.Max)
                    return false;


                FilterHolder item = new FilterHolder();
                item.FilterDocument = filter;

                this.list.Add(item);

                return true;
            }
            finally
            {
                this.m_lock.ReleaseWriterLock();
            }
        }
Exemple #5
0
        public bool SetFilter(FilterDocument filter)
        {
            // string strMessage = "";

            this.m_lock.AcquireReaderLock(m_nLockTimeout);
            try
            {

                for (int i = 0; i < list.Count; i++)
                {
                    FilterHolder item = this.list[i];

                    if (item.FilterDocument == filter)
                    {
                        int nValue = Interlocked.Decrement(ref item.UsedCount);
                        if (nValue < 0)
                        {
                            throw new Exception("还回后UsedCount小于0, 错误");
                        }

                        return true;
                    }

                }
            }
            finally
            {
                this.m_lock.ReleaseReaderLock();
            }

            return NewFilter(filter);
        }