Exemplo n.º 1
0
 public void Assign(int start, int length, TData value)
 {
     if (this.State == state.Increased)
     {
         Update();
     }
     this.State = state.Changed;
     if (Left == null && Right == null)
     {
         Data.Data = value;
         Measure   = Data.Measure;
         State     = state.None;
         return;
     }
     if (Right != null && Left != null && start == 0 && length == Left.Size + Right.Size)
     {
         State  = state.Assigned;
         Change = value;
         return;
     }
     if (Right == null || start + length <= Left.Size)
     {
         Left.Assign(start, length, value);
         return;
     }
     if (Left == null || start >= Left.Size)
     {
         Right.Assign(start - Left.Size, length, value);
         return;
     }
     Left.Assign(start, Left.Size - start, value);
     Right.Assign(0, start + length - Left.Size, value);
 }