/// <summary> /// Creates a new <see cref="NumericBase"/> which receives /// the <paramref name="controller"/> used for managing the current instance /// with the <paramref name="value"/> provided. /// </summary> /// <param name="controller">The <see cref="NumericBaseController"/> /// which contains the information relative to translation from a number /// to the finite sequence equivalent.</param> /// <param name="value">The <see cref="BigInteger"/> which represents the numeric /// value of the <see cref="NumericBase"/> which is encoded into the finite sequence /// equivalent.</param> protected NumericBase(NumericBaseController controller, BigInteger value) { if (controller == null) { throw new ArgumentNullException("controller"); } this.value = value; this.controller = controller; }
private static BigInteger Decoder(NumericBaseController controller, string value) { if (controller == null) { throw new ArgumentNullException("controller"); } if (value == null) { throw new ArgumentNullException("value"); } if (value == string.Empty) { return(0); } return(controller.Decode(value)); }
/// <summary> /// Creates a new <see cref="NumericBase"/> which receives /// the <paramref name="controller"/> used for managing the current instance /// with the <paramref name="value"/> provided. /// </summary> /// <param name="controller">The <see cref="NumericBaseController"/> /// which contains the information relative to translation from a number /// to the finite sequence equivalent.</param> /// <param name="value">The <see cref="String"/> value that is decoded /// using the <paramref name="controller"/>.</param> protected NumericBase(NumericBaseController controller, string value) : this(controller, Decoder(controller, value)) { }
/// <summary> /// Creates a new <see cref="NumericBase"/> which receives /// the <paramref name="controller"/> used for managing the current instance. /// </summary> /// <param name="controller">The <see cref="NumericBaseController"/> /// which contains the information relative to translation from a number /// to the finite sequence equivalent.</param> protected NumericBase(NumericBaseController controller) { this.controller = controller; }