コード例 #1
0
 public Value this[Key key] {
     get {
         for (int i = 0; i < mSize; ++i)
         {
             if (mValues[i].key.Equals(key))
             {
                 return(mValues[i].value);
             }
         }
         return(default(Value));
     } set {
         int index = IndexOf(key);
         if (index == -1)
         {
             if (mSize == mValues.Length)
             {
                 EnsureCapacity(mSize + 1);
             }
             mValues[mSize] = new ScorpioValue <Key, Value>()
             {
                 key = key, value = value
             };
             ++mSize;
         }
         else
         {
             mValues[index].value = value;
         }
     }
 }
コード例 #2
0
 public void Set(ScorpioDictionary <Key, Value> value)
 {
     mSize   = value.mSize;
     mValues = new ScorpioValue <Key, Value> [mSize];
     for (var i = 0; i < mSize; ++i)
     {
         mValues[i] = new ScorpioValue <Key, Value>().Set(value.mValues[i]);
     }
 }
コード例 #3
0
 void SetCapacity(int value)
 {
     if (value > 0)
     {
         var array = new ScorpioValue <Key, Value> [value];
         if (mSize > 0)
         {
             Array.Copy(mValues, 0, array, 0, mSize);
         }
         mValues = array;
     }
     else
     {
         mValues = _emptyArray;
     }
 }
コード例 #4
0
 public ScorpioValue <Key, Value> Set(ScorpioValue <Key, Value> v)
 {
     this.key   = v.key;
     this.value = v.value;
     return(this);
 }