Files

149 lines
7.3 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.CommonCore/Interface/DTS.Viewer/TestModification/ITestModificationView.cs
- Common/DTS.CommonCore/Interface/DTS.Viewer/TestModification/ITestModificationViewModel.cs
- Common/DTS.CommonCore/Interface/DTS.Viewer/TestModification/ITestModificationModel.cs
generated_at: "2026-04-16T12:22:54.326019+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "a5f27c5a375dc7b6"
---
# Documentation: Test Modification Module
## 1. Purpose
This module defines the contract for a Test Modification feature following the Model-View-ViewModel (MVVM) pattern. It provides interfaces for modifying test channel parameters—including description, EU multiplier/offset, T0 timing, line fit boundaries, sensitivity, software filters, and data flags—within a DTS data acquisition or sensor testing system. The module tracks modification state for each parameter and supports publishing changes back to the underlying data.
---
## 2. Public Interface
### `ITestModificationView`
**Namespace:** `DTS.Common.Interface`
A marker interface representing the view component for test modification.
```
public interface ITestModificationView : IBaseView { }
```
- Inherits from `IBaseView`
- Defines no additional members
---
### `ITestModificationViewModel`
**Namespace:** `DTS.Common.Interface`
The view model interface coordinating the test modification view and managing ISO code filter mapping behavior.
```
public interface ITestModificationViewModel : IBaseViewModel
```
**Properties:**
| Name | Type | Access | Description |
|------|------|--------|-------------|
| `View` | `ITestModificationView` | get/set | The associated view instance |
| `Parent` | `IBaseViewModel` | get/set | Reference to the parent view model |
| `UseISOCodeFilterMapping` | `bool` | get/set | Controls whether ISO code should be modified when software filter is modified |
| `UseZeroForUnfiltered` | `bool` | get/set | Controls whether '0' or 'P' is used when ISO code is modified due to software filter change |
**Methods:**
| Name | Return Type | Description |
|------|-------------|-------------|
| `PublishChanges()` | `void` | Publishes/commits the modifications |
---
### `ITestModificationModel`
**Namespace:** `DTS.Common.Interface`
The model interface holding test modification state for a selected channel.
```
public interface ITestModificationModel : IBaseModel
```
**Properties:**
| Name | Type | Access | Description |
|------|------|--------|-------------|
| `Parent` | `ITestModificationViewModel` | get/set | Reference to the parent view model |
| `SelectedChannel` | `ITestChannel` | get/set | The channel on which modifications are based |
| `Description` | `string` | get/set | The `ChannelDescriptionString` of the selected channel |
| `EuMultiplier` | `double` | get/set | EU multiplier of the selected channel |
| `EuOffset` | `double` | get/set | EU offset of the selected channel |
| `T0` | `double` | get/set | Current T0 offset in milliseconds |
| `T1` | `double` | get/set | Line fit start time in milliseconds |
| `T2` | `double` | get/set | Line fit end time in milliseconds |
| `Sensitivity` | `double` | get/set | Sensitivity of the selected channel |
| `SelectedFilter` | `IFilterClass` | get/set | Software filter for the selected class |
| `T0Mode` | `T0Mode` | get/set | T0 adjustment mode |
| `SelectedDataFlag` | `DataFlag` | get/set | Data flag for the selected channel |
| `IsModified` | `bool` | get | Indicates whether any values have changed from default |
| `IsModifiedDescription` | `bool` | get | Indicates whether the Description field has been modified |
| `IsModifiedEuMultiplier` | `bool` | get | Indicates whether EuMultiplier has been modified |
| `IsModifiedEuOffset` | `bool` | get | Indicates whether EU offset has been modified |
| `IsModifiedT0` | `bool` | get | Indicates whether T0 has been modified |
| `IsModifiedLineFit` | `bool` | get/set | Indicates whether T1 or T2 has been modified |
| `IsModifiedSensitivity` | `bool` | get | Indicates whether sensitivity has been modified |
| `IsModifiedFilter` | `bool` | get | Indicates whether filter has been modified |
| `IsModifiedDataFlag` | `bool` | get | Indicates whether DataFlag has been modified |
**Methods:**
| Name | Return Type | Description |
|------|-------------|-------------|
| `ValidateT0()` | `bool` | Returns `true` if T0 is valid (within the dataset), `false` otherwise |
---
## 3. Invariants
1. **Parent-Child Hierarchy:** `ITestModificationModel.Parent` must reference an `ITestModificationViewModel`, and `ITestModificationViewModel.Parent` must reference an `IBaseViewModel`, establishing a three-level hierarchy (Model → ViewModel → Parent ViewModel).
2. **Channel Selection Required:** `SelectedChannel` must be set before modification properties (`Description`, `EuMultiplier`, `EuOffset`, `T0`, `T1`, `T2`, `Sensitivity`, `SelectedFilter`, `SelectedDataFlag`) can meaningfully be accessed or modified—they represent values "of the selected channel."
3. **Modification Tracking Consistency:** Each `IsModified*` property should reflect the actual modification state of its corresponding value property. The aggregate `IsModified` property should be `true` if any individual `IsModified*` flag is `true`.
4. **T0 Validation:** `ValidateT0()` must be called to confirm T0 is within the dataset bounds before relying on the T0 value.
5. **Line Fit Ordering:** While not explicitly enforced in the interface, `T1` (line fit start) and `T2` (line fit end) are expected to represent a valid time range—unclear from source whether T1 < T2 is enforced.
---
## 4. Dependencies
### This module depends on:
- **`DTS.Common.Base`** — Provides base interfaces:
- `IBaseView`
- `IBaseViewModel`
- `IBaseModel`
- **`DTS.Common.Interface.Sensors.SoftwareFilters`** — Provides:
- `IFilterClass` (referenced in comment as replacement for `CFCFilter` per FB 13120)
### External types referenced (definitions not in source):
- `ITestChannel` — Type of `SelectedChannel`; location unknown
- `T0Mode` — Enum or type for T0 adjustment mode; location unknown
- `DataFlag` — Enum or type for channel data flags; location unknown
### Dependents:
- Cannot be determined from source alone. Concrete implementations of these interfaces would exist elsewhere in the codebase.
---
## 5. Gotchas
1. **Namespace Discrepancy:** The file path suggests namespace `DTS.Viewer.TestModification`, but the actual namespace declared is `DTS.Common.Interface`. The `// ReSharper disable CheckNamespace` directive indicates this mismatch is intentional/suppressed.
2. **Filter Type Change (FB 13120):** The comment indicates `IFilterClass` replaced `CFCFilter` as the type for `SelectedFilter`. Code referencing the old type may exist elsewhere in the codebase.
3. **ISO Code Filter Mapping Behavior:** The interaction between `UseISOCodeFilterMapping` and `UseZeroForUnfiltered` is not defined in these interfaces. The behavior for when ISO code is modified due to filter changes depends on implementation details not present here.
4. **IsModifiedLineFit is Read/Write:** Unlike other `IsModified*` properties which are read-only, `IsModifiedLineFit` has both getter and setter. The reason for this inconsistency is unclear from source alone.
5. **T0 Validation Not Automatic:** The interface provides `ValidateT0()` as an explicit method rather than automatic validation on set. Callers must remember to invoke it.