コード例 #1
0
        /// <inheritdoc/>
        public BitCode GetBitCodeByString(string token)
        {
            if (!this.uniqueCodes.TryGetValue(token, out BitCode code))
            {
                this.uniqueCodes.Add(token, code = new BitCode(this.index++));
            }

            return(code);
        }
コード例 #2
0
ファイル: BitCode.cs プロジェクト: muguangyi/pioneer
 public void Subtract(BitCode code)
 {
     if (this.indices.Remove(code.Index))
     {
         for (var i = 0; i <= code.offset && i < MAXOFFSET; ++i)
         {
             this.bits[i] &= ~code.bits[i];
         }
     }
 }
コード例 #3
0
ファイル: BitCode.cs プロジェクト: muguangyi/pioneer
 public void Add(BitCode code)
 {
     if (this.indices.Add(code.Index))
     {
         this.Offset = Math.Max(code.offset, this.Offset);
         for (var i = 0; i <= code.offset && i < MAXOFFSET; ++i)
         {
             this.bits[i] |= code.bits[i];
         }
     }
 }
コード例 #4
0
ファイル: BitCode.cs プロジェクト: muguangyi/pioneer
            public bool Contains(BitCode code)
            {
                for (var i = 0; i <= code.offset && i < MAXOFFSET; ++i)
                {
                    if ((this.bits[i] & code.bits[i]) != code.bits[i])
                    {
                        return(false);
                    }
                }

                return(true);
            }