6.0 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | |
|---|---|---|---|---|---|
|
2026-04-16T02:39:28.985647+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | e833a8924b8a2f43 |
ISO
Documentation: IsoCode Class
1. Purpose
The IsoCode class encapsulates a fixed-length 16-character ISO-standard location code, representing hierarchical spatial and physical metadata (e.g., for document or object tracking). It provides structured access to semantically meaningful substrings—such as test object, position, main/fine locations, physical dimension, direction, and filter class—while enforcing a strict 16-character internal representation. The class ensures consistent formatting (e.g., padding with '?' or truncating) and serves as a domain-specific abstraction over raw string manipulation for ISO-compliant codes.
2. Public Interface
-
public IsoCode(string isoCode)
Constructor. Initializes the 16-character internal buffer_isoCodeFull. IfisoCodeisnull, treats it as"". Truncates to 16 characters if longer; pads with'?'if shorter. Assigns each character directly to_isoCodeFull[i]. -
public string StringRepresentation { get; set; }
Gets/sets the full 16-character ISO code as a string.- Getter: Returns
_isoCodeFullconcatenated into a string. - Setter: Assigns characters from
valueto_isoCodeFull. Ifvalueis shorter than 16 chars, pads remaining positions with'0'. Does not use'?'padding in setter.
- Getter: Returns
-
public string TestObject { get; set; }
Gets/sets the first character (_isoCodeFull[0]).- Setter: If
valueisnullor empty, sets to'?'; otherwise usesvalue[0].
- Setter: If
-
public string Position { get; set; }
Gets/sets the second character (_isoCodeFull[1]).- Setter: Same behavior as
TestObject.
- Setter: Same behavior as
-
public string MainLocation { get; set; }
Gets/sets characters at indices 2–5 (4 chars).- Setter: Truncates to 4 chars if longer; pads right with
'?'if shorter.
- Setter: Truncates to 4 chars if longer; pads right with
-
public string FineLocation1 { get; set; }
Gets/sets characters at indices 6–7 (2 chars).- Setter: Pads right with
'?'if shorter than 2; truncates if longer (implicitly viaToCharArray(0, 2)).
- Setter: Pads right with
-
public string FineLocation2 { get; set; }
Gets/sets characters at indices 8–9 (2 chars).- Setter: Same padding/truncation behavior as
FineLocation1.
- Setter: Same padding/truncation behavior as
-
public string FineLocation3 { get; set; }
Gets/sets characters at indices 10–11 (2 chars).- Setter: Same padding/truncation behavior as
FineLocation1.
- Setter: Same padding/truncation behavior as
-
public string PhysicalDimension { get; set; }
Gets/sets characters at indices 12–13 (2 chars).- Setter: Truncates to 2 chars if longer; pads right with
'?'if shorter.
- Setter: Truncates to 2 chars if longer; pads right with
-
public string Direction { get; set; }
Gets/sets character at index 14 (1 char).- Setter: If
valueisnullor empty, sets to'?'; otherwise usesvalue[0].
- Setter: If
-
public string FilterClass { get; set; }
Gets/sets character at index 15 (1 char).- Setter: Same behavior as
Direction.
- Setter: Same behavior as
3. Invariants
_isoCodeFullis always exactly 16 characters long.- For all public properties (
TestObject,Position,FineLocation*,PhysicalDimension,Direction,FilterClass), the setter ensures the underlying character(s) are set to'?'when input isnull/empty (exceptStringRepresentation, which uses'0'in setter). MainLocationandPhysicalDimensiontruncate to 4 and 2 chars respectively if input exceeds length; all fine location fields truncate to 2 chars.- The constructor always produces a 16-character buffer (via truncation or
'?'padding). StringRepresentationsetter does not use'?'padding—uses'0'for missing characters.
4. Dependencies
- Internal: Uses
System.Text.StringBuilder(forStringRepresentationgetter). - External: No external dependencies beyond
System(no third-party or framework-specific APIs beyond core types). - Consumers: Presumably used by other modules in
DTS.Commonnamespace (e.g., parsing/serialization logic, UI binding, or ISO code validation services), though not explicit in this file.
5. Gotchas
- Inconsistent padding in setters:
- Public property setters (
TestObject,Position, etc.) use'?'for missing/empty input. StringRepresentationsetter uses'0'for missing characters. This discrepancy may cause unexpected behavior ifStringRepresentationis set directly after using property setters (or vice versa).
- Public property setters (
- Off-by-one error in
_fineLocation*setters:
In_fineLocation1,_fineLocation2, and_fineLocation3private setters, the conditionvalue.Length < ishould bevalue.Length <= ito correctly handlei == value.Length - 1. As written,value[i]will throwArgumentOutOfRangeExceptionwhenvalue.Length == i.
Example: Forvalue = "A"(length 1), wheni = 1,value.Length (1) < i (1)is false, so it attemptsvalue[1]→ invalid. - Redundant
string.IsNullOrEmptychecks:
Properties likeTestObjectandPositioncheckstring.IsNullOrEmpty(value)before accessingvalue[0], butvalue[0]would throwIndexOutOfRangeExceptionfor empty strings anyway—so the check is defensive but not strictly necessary. - No validation of character content:
The class accepts any character (including non-alphanumeric) without validation. ISO compliance (e.g., allowed character set) is not enforced. _mainLocationsetter has inconsistent padding:
Uses'0'ifvalue.Length <= i, but publicMainLocationsetter pads with'?'. This mismatch is hidden by the public setter, but could cause confusion if private setter is used directly (unlikely, but possible in reflection scenarios).- No immutability guarantees:
Though_isoCodeFullisreadonly, its contents are mutable via public setters. The class is not thread-safe.
None identified beyond the above.