Class ConditionFactory
- Namespace
- Geotab.Checkmate.ObjectModel.Exceptions
- Assembly
- Geotab.Checkmate.ObjectModel.dll
Factory for creating conditions.
public static class ConditionFactory
- Inheritance
-
ConditionFactory
- Inherited Members
Remarks
The is an internal class.
Methods
AddImmediateChildren(IList<Condition>?, IEnumerable<Condition?>?, Condition?, Rule?, bool)
Adds the immediate children.
public static void AddImmediateChildren(IList<Condition>? container, IEnumerable<Condition?>? children, Condition? parent, Rule? rule, bool clone)
Parameters
container
IList<Condition>The container.
children
IEnumerable<Condition>The children.
parent
ConditionThe parent.
rule
RuleThe rule.
clone
boolIf set to true [clone].
And(params Condition?[])
And two or more conditions.
public static Condition? And(params Condition?[] conditions)
Parameters
conditions
Condition[]The conditions.
Returns
CreateAnyDataCondition(Condition)
Creates any data condition.
public static Condition CreateAnyDataCondition(Condition condition)
Parameters
condition
ConditionThe condition.
Returns
CreateAreaCondition(ConditionType, Zone?, ZoneType?)
Creates the area condition.
public static Condition CreateAreaCondition(ConditionType conditionKind, Zone? zone, ZoneType? zoneType)
Parameters
conditionKind
ConditionTypeKind of the condition.
zone
ZoneThe zone.
zoneType
ZoneTypeType of the zone.
Returns
Exceptions
- ArgumentNullException
If condition type is zone stop and no zone supplied.
CreateAreaConditionWithPercentageRoadLength(ConditionType, Zone?, ZoneType?, double?)
Creates the area condition with percentage of road length.
public static Condition CreateAreaConditionWithPercentageRoadLength(ConditionType conditionKind, Zone? zone, ZoneType? zoneType, double? pctRoadLength = null)
Parameters
conditionKind
ConditionTypeKind of the condition.
zone
ZoneThe zone.
zoneType
ZoneTypeType of the zone.
pctRoadLength
double?Percentage of Road length.
Returns
Exceptions
- ArgumentNullException
If condition type is zone stop and no zone supplied.
CreateCondition(ConditionType)
Creates the condition.
public static Condition CreateCondition(ConditionType conditionKind)
Parameters
conditionKind
ConditionTypeKind of the condition.
Returns
CreateConditionToCompareDiagnosticsByValue(Diagnostic, Diagnostic, ConditionType, double?)
Compare diagnostics by value
public static Condition CreateConditionToCompareDiagnosticsByValue(Diagnostic diagnostic1, Diagnostic diagnostic2, ConditionType type, double? value)
Parameters
diagnostic1
Diagnosticdiagnostic 1
diagnostic2
Diagnosticdiagnostic 2
type
ConditionTypecondition type
value
double?value
Returns
CreateContinuousGpsCondition(long?)
Creates continuous gps data Condition.
public static Condition CreateContinuousGpsCondition(long? maxNoLogSeconds)
Parameters
maxNoLogSeconds
long?The maximum period of time in seconds between 2 consecutive GPS logs.
Returns
CreateContinuousGpsDistanceCondition(long?)
Creates continuous distance gps data Condition.
public static Condition CreateContinuousGpsDistanceCondition(long? maxNoLogDistance)
Parameters
maxNoLogDistance
long?The maximum distance in meters between 2 consecutive GPS logs.
Returns
CreateDVIRDefectCondition()
Creates the dvirDefect condition.
public static Condition CreateDVIRDefectCondition()
Returns
CreateDVIRDefectCondition(DefectSeverity)
Creates a DvirDefect condition with the specified. DefectSeverity
public static Condition CreateDVIRDefectCondition(DefectSeverity severityFilter)
Parameters
severityFilter
DefectSeverityThe required DefectSeverity value to trigger an. ExceptionEvent
Returns
CreateDeviceCondition(Device)
Creates the device condition.
public static Condition CreateDeviceCondition(Device device)
Parameters
device
DeviceThe device.
Returns
CreateDeviceWorkTimeCondition(bool)
Creates the device work time condition.
public static Condition CreateDeviceWorkTimeCondition(bool outside)
Parameters
Returns
CreateDriverCondition(Driver)
Creates the driver condition.
public static Condition CreateDriverCondition(Driver driver)
Parameters
driver
DriverThe driver.
Returns
CreateFaultCondition(Diagnostic, bool)
Creates the fault condition.
public static Condition CreateFaultCondition(Diagnostic diagnostic, bool isActiveFault)
Parameters
diagnostic
DiagnosticThe diagnostic.
isActiveFault
boolIf set to true [is active fault].
Returns
CreateFilterDataByDiagnostic(ConditionType, Diagnostic)
Creates the filter data by diagnostic.
public static Condition CreateFilterDataByDiagnostic(ConditionType conditionKind, Diagnostic diagnostic)
Parameters
conditionKind
ConditionTypeKind of the condition.
diagnostic
DiagnosticThe diagnostic.
Returns
CreateGroupCondition(Group)
Creates Group condition.
public static Condition CreateGroupCondition(Group group)
Parameters
Returns
CreateIdlingCondition(double?, long?, bool)
Creates idling condition.
public static Condition? CreateIdlingCondition(double? maxIdlingSpeed, long? maxNoLogSeconds, bool notDrivingCondition = false)
Parameters
maxIdlingSpeed
double?The maximum Idling Speed. The default idling rule does not use maxIdlingSpeed so it is null.
maxNoLogSeconds
long?The maximum period of time in seconds between 2 consecutive GPS logs.
notDrivingCondition
boolSet to true to include not driving condition for rule. Used in default idling rule.
Returns
CreateInvertResultCondition(Condition)
Creates the invert result condition.
public static Condition CreateInvertResultCondition(Condition condition)
Parameters
condition
ConditionThe condition.
Returns
CreateIsDrivingCondition()
Creates the is driving condition.
public static Condition CreateIsDrivingCondition()
Returns
CreateIsStoppedCondition()
Creates the is stopped condition.
public static Condition CreateIsStoppedCondition()
Returns
CreateSpeedLimitAsMeasurementCondition(double, bool)
Creates the speed limit as measurement condition.
public static Condition CreateSpeedLimitAsMeasurementCondition(double graceValue, bool belowSpeedLimit = false)
Parameters
graceValue
doubleThe grace value.
belowSpeedLimit
boolWhen true, the speed below speed limit would trigger the violation. Default value: false.
Returns
CreateSpeedLimitCondition(double, ConditionType, bool, bool)
Creates the speed limit condition.
public static Condition CreateSpeedLimitCondition(double graceValue, ConditionType conditionType = ConditionType.SpeedLimit, bool belowSpeedLimit = false, bool isPercent = false)
Parameters
graceValue
doubleThe grace value.
conditionType
ConditionTypeThe ConditionType for the Condition
belowSpeedLimit
boolWhen true, the speed below speed limit would trigger the violation. Default value: false.
isPercent
boolWhen true, a violation is triggered when the current speed is graceValue * speedLimit more/less than the speedLimit.
Returns
CreateSpeedValueCondition(double?, double?)
Creates the speed value condition.
public static Condition? CreateSpeedValueCondition(double? lowBound, double? upperBound)
Parameters
Returns
Exceptions
- ArgumentException
When both arguments undefined or upperBound is gte lowBound.
CreateStatusAbsenceCheckCondition(Diagnostic)
Creates the status absence check condition.
public static Condition CreateStatusAbsenceCheckCondition(Diagnostic diagnostic)
Parameters
diagnostic
DiagnosticThe diagnostic.
Returns
CreateStatusValueCondition(Diagnostic, double?, double?, double?)
Creates the status value condition.
public static Condition CreateStatusValueCondition(Diagnostic diagnostic, double? lowBound, double? upperBound, double? exactlyAtValue)
Parameters
diagnostic
DiagnosticThe diagnostic.
lowBound
double?The low bound.
upperBound
double?The upper bound.
exactlyAtValue
double?The exactly at value.
Returns
Exceptions
- InvalidOperationException
When result is null.
CreateValueCondition(ConditionType, double?)
Creates the value condition.
public static Condition CreateValueCondition(ConditionType conditionKind, double? value)
Parameters
conditionKind
ConditionTypeKind of the condition.
value
double?The value.
Returns
CreateWifiMaxTierUsageCondition(Diagnostic, double)
Creates the WifiMaxTierUsageLimit condition.
public static Condition CreateWifiMaxTierUsageCondition(Diagnostic diagnostic, double percentage)
Parameters
diagnostic
DiagnosticThe required Diagnostic
percentage
doubleThe required percentage value to trigger an. ExceptionEvent
Returns
CreateWifiTierUsageCondition(Diagnostic, double)
Creates the WifiTierUsageLimit condition.
public static Condition CreateWifiTierUsageCondition(Diagnostic diagnostic, double percentage)
Parameters
diagnostic
DiagnosticThe required Diagnostic
percentage
doubleThe required percentage value to trigger an. ExceptionEvent
Returns
CreateWorkTimeCondition(WorkTime, bool)
Creates the work time condition.
public static Condition CreateWorkTimeCondition(WorkTime workTime, bool outside)
Parameters
Returns
GetParentRank(Condition, bool)
Returns a number representing a condition rank in the parent-child chain of connected condition nodes.
public static int GetParentRank(Condition condition, bool useOfChildrenRank)
Parameters
condition
ConditionThe. Condition
useOfChildrenRank
boolIf true, the highest-ranked child of {ConditionType.Or}ranks its parent.
Returns
- int
Values: -1: not applicable; 0: lowest rank, etc.
GetSpeedLimitRequestOption(ConditionType, bool)
Road max speed helper method. Converts a rule conditionType to its corresponding map request option.
public static SpeedLimitRequestOptions GetSpeedLimitRequestOption(ConditionType conditionType, bool noSnapping)
Parameters
conditionType
ConditionTypeConditionType defines the options for road speed limit request.
noSnapping
boolDefines the options for road speed limit request to ignore snapping to road.
Returns
- SpeedLimitRequestOptions
The map request option.
Inclusive(params Condition[])
Inclusive two or more conditions.
public static Condition Inclusive(params Condition[] conditions)
Parameters
conditions
Condition[]The conditions.
Returns
Normalize(Condition)
Converts condition into equivalent normalized (ready for processing) condition.
public static Condition Normalize(Condition condition)
Parameters
condition
ConditionThe condition.
Returns
- Condition
The equivalent condition.
Or(params Condition[])
Or two or more conditions.
public static Condition? Or(params Condition[] conditions)
Parameters
conditions
Condition[]The conditions.
Returns
Remarks
Will ignore null condition treating as if no such condition is present in the array.