5.8 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-16T03:39:42.724755+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | b95e2bb79309f305 |
Control
Documentation: DTS.Slice.Control Namespace – ReviewableAttribute & IntervalSec
1. Purpose
This module provides foundational types for representing reviewable attributes (e.g., displayable metadata in a UI review tab) and time intervals (in seconds) within the DTS Slice Control domain. ReviewableAttribute serves as an abstract base for dynamically computing and exposing attribute values (e.g., channel status, configuration metadata) for review purposes, while IntervalSec encapsulates a time range with begin/end times and supports interoperability with a serialization-specific counterpart via implicit conversions.
2. Public Interface
ReviewableAttribute (Abstract Class)
-
ReviewableAttribute(string name, DetermineValueString calculateValue)
Constructor. Initializes the attribute with a name and a delegate used to compute the value on demand. ThrowsReviewableAttribute.Exceptionon failure. -
string Name { get; }
Read-only property returning the attribute’s display name. -
string Value { get; }
Read-only property that invokes theCalculateValuedelegate to compute the current value. On exception during computation, logs the error and returns"N/A"(does not throw). -
delegate string DetermineValueString();
Public delegate defining the signature for value-computation methods. -
private DetermineValueString CalculateValue { get; set; }
Private property storing the delegate. ThrowsApplicationExceptionif accessed before initialization.
IntervalSec (Concrete Class)
-
IntervalSec()
Parameterless constructor. LeavesBeginandEnduninitialized (default to0.0due toProperty<double>initialization, but semantically "uninitialized" per comment). -
IntervalSec(double begin, double end)
Constructor initializingBeginandEndto specified values. Throws genericExceptionon failure. -
double Begin { get; set; }
Read/write property for the interval’s start time (seconds). -
double End { get; set; }
Read/write property for the interval’s end time (seconds). -
public static implicit operator Serialization.Test.IntervalSec(IntervalSec thisInterval)
Implicit conversion toDTS.Serialization.Test.IntervalSec, using currentBegin/End. -
public static implicit operator IntervalSec(Serialization.Test.IntervalSec thatInterval)
Implicit conversion fromDTS.Serialization.Test.IntervalSec, constructing a new instance. -
public override bool Equals(object obj)
Memberwise equality check against anotherIntervalSec. Returnsfalseifobjisnullor notIntervalSec. -
public override int GetHashCode()
Returns base hash code (note: does not combineBegin/Endexplicitly—see Gotchas).
3. Invariants
-
ReviewableAttributeNamemust be non-null (enforced byProperty<string>constructor withnullas default, but no explicit validation—potential risk).CalculateValuemust be assigned beforeValueis accessed; otherwise,ApplicationExceptionis thrown.Valuecomputation never throws; exceptions are caught and logged, returning"N/A".
-
IntervalSec- No invariant enforces
Begin ≤ End; invalid intervals (e.g.,Begin > End) are permitted. BeginandEnddefault to0.0(viaProperty<double>initialization), but the parameterless constructor comment states they are "uninitialized"—this is a semantic mismatch.
- No invariant enforces
4. Dependencies
-
DTS.Slice.Control.ReviewableAttribute- Depends on:
DTS.Utilities(forAPILogger,Exceptional,Property<T>)DTS.Utilities.DotNetProgrammingConstructs(forProperty<T>)
- Used by: Unknown from source—likely subclassed by domain-specific reviewable attributes (e.g.,
ChannelAttribute,SystemStatusAttribute).
- Depends on:
-
DTS.Slice.Control.IntervalSec- Depends on:
DTS.Common.UtilitiesDTS.Common.Utilities.DotNetProgrammingConstructs(forProperty<double>,Exceptional)DTS.Serialization.Test.IntervalSec(for implicit conversions)
- Used by: Likely in time-windowing or data-slicing logic (e.g., selecting data within a time range).
- Depends on:
5. Gotchas
-
ReviewableAttributeCalculateValueis a private property—subclasses cannot override or inspect it directly. Initialization must occur in the base constructor.Valuesilently fails on computation error ("N/A"), which may mask bugs if not logged.- No validation on
nameparameter (e.g., null/empty);Property<string>allowsnull.
-
IntervalSecGetHashCode()does not incorporateBegin/End, violating the contract that equal objects must have equal hash codes. This will cause failures in hash-based collections (e.g.,HashSet,Dictionary).Begin/Enddefault to0.0despite constructor comment implying "uninitialized" state—this may lead to false positives (e.g., interval[0.0, 0.0]treated as valid).- Implicit conversions assume
Serialization.Test.IntervalSechas matchingBegin/Endproperties; no validation on conversion.
-
Both
- Heavy use of
try/catchblocks wrapping property accessors and constructors—suggests legacy error-handling pattern. Consider refactoring to reduce overhead. - Reliance on
Property<T>wrapper (not shown) implies a custom property system; behavior (e.g., change notifications) is not documented here.
- Heavy use of
None identified beyond the above.