Skip to content

ConverterBase

ConverterBase is the abstract (MustInherit) template implementation of IConverter. It supplies default digit-conversion and formatting logic that concrete converters (BinaryConverter, OctalConverter, HexConverter, ExcelConverter) override only where their base's behavior differs.

Purpose

  • Provide reusable default implementations of IConverter's conversion and formatting members so concrete converters only need to override base-specific behavior.

Context

  • Namespace: SAIF.Framework.BaseN
  • Assembly/package: SAIF.Framework.BaseN (also bundled into the SAIF.BOF.Framework NuGet package)

Public members

Member Signature Purpose
Base Public MustOverride ReadOnly Property Base() As Integer Abstract; concrete subclasses must supply the numeric base.
ConvertAlphaToNumeric Public Overridable Function ConvertAlphaToNumeric(ByVal input As String) As Integer Default: returns CInt(input) if IsNumeric(input) is True; otherwise returns 0 (BR-004).
ConvertNumericToAlpha Public Overridable Function ConvertNumericToAlpha(ByVal input As Integer) As String Default: returns input.ToString().
FormatBaseN Public Overridable Function FormatBaseN(ByVal values As Integer()) As String Default: iterates the digit array right-to-left, converting each digit via ConvertNumericToAlpha and concatenating the results.

Behavioral notes

  • ConvertAlphaToNumeric's silent-zero-on-non-numeric-input behavior is relied upon by BinaryConverter and OctalConverter, which do not override this member (BR-004).
  • All three members are declared Overridable, allowing subclasses to selectively override only the behavior that differs for their base (e.g., HexConverter and ExcelConverter override all three; BinaryConverter/OctalConverter override none).

Constraints and usage notes

  • ConverterBase cannot be instantiated directly (MustInherit); it must be subclassed to provide a concrete Base value.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified. Statements marked with † were retrieved from dependency library documentation via the Legends CLI RAG service. They describe inherited behavior from the indicated origin library and should be verified if the dependency version changes.

Sources

  • SAIF.Framework.BaseN\ConverterBase.vb