コード例 #1
0
ファイル: HiLoGenerator.cs プロジェクト: joethinh/nohros-must
    /// <summary>
    /// Initializes a new instance of the <see cref="HiLoGenerator"/> class
    /// by using the given next high delegate and max lo value.
    /// </summary>
    /// <param name="next_high">
    /// A <see cref="CallableDelegate{T}"/> that is used to get the next High
    /// value.
    /// </param>
    public HiLoGenerator(NextHighDelegate next_high) {
      if (next_high == null) {
        throw new ArgumentNullException("next_high");
      }

      next_high_ = next_high;
      hi_lo_range_ = new FullHiloRange();
      lo_ = MaxHigh + 1;
    }
コード例 #2
0
ファイル: HiLoGenerator.cs プロジェクト: ddd-cqrs-es/must
        /// <summary>
        /// Initializes a new instance of the <see cref="HiLoGenerator"/> class
        /// by using the given next high delegate and max lo value.
        /// </summary>
        /// <param name="next_high">
        /// A <see cref="CallableDelegate{T}"/> that is used to get the next High
        /// value.
        /// </param>
        public HiLoGenerator(NextHighDelegate next_high)
        {
            if (next_high == null)
            {
                throw new ArgumentNullException("next_high");
            }

            next_high_   = next_high;
            hi_lo_range_ = new FullHiloRange();
            lo_          = MaxHigh + 1;
        }
コード例 #3
0
ファイル: HiLoGenerator.cs プロジェクト: joethinh/nohros-must
    /// <inheritdoc/>
    public virtual long Generate(string key) {
      if (key == null) {
        throw new ArgumentNullException("key");
      }

      if (lo_ > MaxHigh) {
        hi_lo_range_ = next_high_(key);
        lo_ = 0;
      }
      return hi_lo_range_.High + lo_++;
    }
コード例 #4
0
ファイル: HiLoGenerator.cs プロジェクト: ddd-cqrs-es/must
        /// <inheritdoc/>
        public virtual long Generate(string key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            if (lo_ > MaxHigh)
            {
                hi_lo_range_ = next_high_(key);
                lo_          = 0;
            }
            return(hi_lo_range_.High + lo_++);
        }