예제 #1
0
        public void insert(CompoundIndex indexValue)
        {
            /*
             * version(DEBUG) {
             *  static if (WithCompoundId) {
             *      assert(reasonerInstance.accessCompoundByIndex(index).cachedHashWithCompoundIdValid);
             *  }
             *  else {
             *      assert(reasonerInstance.accessCompoundByIndex(index).cachedHashWithoutCompoundIdValid);
             *  }
             * }
             */

            HashWithIndex hashWithIndex = new HashWithIndex();

            hashWithIndex.index = indexValue.index;
            if (withCompoundId)
            {
                hashWithIndex.hash = compoundAndTermContext.accessCompoundByIndex(indexValue).cachedHashWithCompoundId;
            }
            else
            {
                hashWithIndex.hash = compoundAndTermContext.accessCompoundByIndex(indexValue).cachedHashWithoutCompoundId;
            }

            // insert into hashtable
            if (hashtable.ContainsKey(hashWithIndex.hash))
            {
                hashtable[hashWithIndex.hash].Add(hashWithIndex);
            }
            else
            {
                hashtable[hashWithIndex.hash] = new List <HashWithIndex>()
                {
                    hashWithIndex
                };
            }
        }
예제 #2
0
 public bool isEqual(HashWithIndex other)
 {
     return(index == other.index && hash.Equals(other.hash));
 }