34 lines
621 B
C#
34 lines
621 B
C#
namespace EonaCat.Quic.Infrastructure;
|
|
// This file is part of the EonaCat project(s) which is released under the Apache License.
|
|
// See the LICENSE file or go to https://EonaCat.com/License for full license details.
|
|
|
|
public class NumberSpace
|
|
{
|
|
private readonly uint _max = uint.MaxValue;
|
|
private uint _n;
|
|
|
|
public NumberSpace()
|
|
{
|
|
}
|
|
|
|
public NumberSpace(uint max)
|
|
{
|
|
_max = max;
|
|
}
|
|
|
|
public bool IsMax()
|
|
{
|
|
return _n == _max;
|
|
}
|
|
|
|
public uint Get()
|
|
{
|
|
if (_n >= _max)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
_n++;
|
|
return _n;
|
|
}
|
|
} |