Example #1
0
        public IotaAreaCode IncreasePrecision()
        {
            if (this.CodePrecision >= IotaAreaCodeDimension.Precision.Last())
            {
                throw new Exception($"Precision can not be increased further than {this.CodePrecision}");
            }

            this.Value = Precision.Calculate(this, IotaAreaCodeDimension.Precision[Array.IndexOf(IotaAreaCodeDimension.Precision, this.CodePrecision) + 1]);
            this.area  = null;

            return(this);
        }
Example #2
0
        public IotaAreaCode SetPrecision(int precision)
        {
            if (!IotaAreaCodeDimension.Precision.Contains(precision))
            {
                throw new ArgumentException($"Invalid precision. Allowed values are {string.Join(", ", IotaAreaCodeDimension.Precision)}");
            }

            this.Value = Precision.Calculate(this, precision);
            this.area  = null;

            return(this);
        }