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
containerIList<Condition>The container.
childrenIEnumerable<Condition>The children.
parentConditionThe parent.
ruleRuleThe rule.
cloneboolIf set to true [clone].
And(params Condition?[])
And two or more conditions.
public static Condition? And(params Condition?[] conditions)
Parameters
conditionsCondition[]The conditions.
Returns
CreateAnyDataCondition(Condition)
Creates any data condition.
public static Condition CreateAnyDataCondition(Condition condition)
Parameters
conditionConditionThe condition.
Returns
CreateAreaCondition(ConditionType, Zone?, ZoneType?)
Creates the area condition.
public static Condition CreateAreaCondition(ConditionType conditionKind, Zone? zone, ZoneType? zoneType)
Parameters
conditionKindConditionTypeKind of the condition.
zoneZoneThe zone.
zoneTypeZoneTypeType 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
conditionKindConditionTypeKind of the condition.
zoneZoneThe zone.
zoneTypeZoneTypeType of the zone.
pctRoadLengthdouble?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
conditionKindConditionTypeKind 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
diagnostic1Diagnosticdiagnostic 1
diagnostic2Diagnosticdiagnostic 2
typeConditionTypecondition type
valuedouble?value
Returns
CreateContinuousGpsCondition(long?)
Creates continuous gps data Condition.
public static Condition CreateContinuousGpsCondition(long? maxNoLogSeconds)
Parameters
maxNoLogSecondslong?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
maxNoLogDistancelong?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
severityFilterDefectSeverityThe required DefectSeverity value to trigger an. ExceptionEvent
Returns
CreateDeviceCondition(Device)
Creates the device condition.
public static Condition CreateDeviceCondition(Device device)
Parameters
deviceDeviceThe 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
driverDriverThe driver.
Returns
CreateFaultCondition(Diagnostic, bool)
Creates the fault condition.
public static Condition CreateFaultCondition(Diagnostic diagnostic, bool isActiveFault)
Parameters
diagnosticDiagnosticThe diagnostic.
isActiveFaultboolIf 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
conditionKindConditionTypeKind of the condition.
diagnosticDiagnosticThe 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
maxIdlingSpeeddouble?The maximum Idling Speed. The default idling rule does not use maxIdlingSpeed so it is null.
maxNoLogSecondslong?The maximum period of time in seconds between 2 consecutive GPS logs.
notDrivingConditionboolSet 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
conditionConditionThe 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
graceValuedoubleThe grace value.
belowSpeedLimitboolWhen 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
graceValuedoubleThe grace value.
conditionTypeConditionTypeThe ConditionType for the Condition
belowSpeedLimitboolWhen true, the speed below speed limit would trigger the violation. Default value: false.
isPercentboolWhen 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
diagnosticDiagnosticThe 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
diagnosticDiagnosticThe diagnostic.
lowBounddouble?The low bound.
upperBounddouble?The upper bound.
exactlyAtValuedouble?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
conditionKindConditionTypeKind of the condition.
valuedouble?The value.
Returns
CreateWifiMaxTierUsageCondition(Diagnostic, double)
Creates the WifiMaxTierUsageLimit condition.
public static Condition CreateWifiMaxTierUsageCondition(Diagnostic diagnostic, double percentage)
Parameters
diagnosticDiagnosticThe required Diagnostic
percentagedoubleThe required percentage value to trigger an. ExceptionEvent
Returns
CreateWifiTierUsageCondition(Diagnostic, double)
Creates the WifiTierUsageLimit condition.
public static Condition CreateWifiTierUsageCondition(Diagnostic diagnostic, double percentage)
Parameters
diagnosticDiagnosticThe required Diagnostic
percentagedoubleThe 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
conditionConditionThe. Condition
useOfChildrenRankboolIf 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
conditionTypeConditionTypeConditionType defines the options for road speed limit request.
noSnappingboolDefines 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
conditionsCondition[]The conditions.
Returns
Normalize(Condition)
Converts condition into equivalent normalized (ready for processing) condition.
public static Condition Normalize(Condition condition)
Parameters
conditionConditionThe condition.
Returns
- Condition
The equivalent condition.
Or(params Condition[])
Or two or more conditions.
public static Condition? Or(params Condition[] conditions)
Parameters
conditionsCondition[]The conditions.
Returns
Remarks
Will ignore null condition treating as if no such condition is present in the array.