コード例 #1
0
            internal virtual bool Add(AnyObjectId toAdd)
            {
                int i = Index(toAdd);

                for (int n = 0; n < MAX_CHAIN;)
                {
                    ObjectId obj = ids.Get(i);
                    if (obj == null)
                    {
                        if (ids.CompareAndSet(i, null, toAdd.Copy()))
                        {
                            return(true);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    if (AnyObjectId.Equals(obj, toAdd))
                    {
                        return(true);
                    }
                    if (++i == ids.Length())
                    {
                        i = 0;
                    }
                    n++;
                }
                return(false);
            }