public bool Copy(CM1Constraint pSrcConstraint) { bool bRdo = true; try { TypeId = pSrcConstraint.TypeId; Value = pSrcConstraint.Value; } catch (Exception) { bRdo = false; } return(bRdo); }
public void Init() { m_lId = GRP_UNDEFINED; m_lTypeId = GRP_UNDEFINED; m_dtLast.SetStatus(COPSDateStatus.Null); trace = null; m_lState = M1GroupState.GRP_ON; ResetTime(); ResetMoney(); for (int i = 0; i < CM1Constraint.CNSTR_NUM; i++) { m_Cnstr[i] = new CM1Constraint(); m_Cnstr[i].Set(CM1Constraint.CNSTR_UNDEFINED, CM1Constraint.CNSTR_UNDEFINED); } }
public bool MergeConstraint(CM1Constraint pCnstr, float?pfCnstrValueOut) { trace?.Write(TraceLevel.Debug, "CM1Group::MergeConstraint"); bool fnResult = true; try { if (pCnstr == null) { throw new ArgumentNullException(nameof(pCnstr), "Invalid input parameter"); } fnResult = m_Cnstr[pCnstr.TypeId - 1].Merge(pCnstr, ref pfCnstrValueOut); } catch (Exception error) { trace?.Write(TraceLevel.Error, error.ToLogString()); fnResult = false; } return(fnResult); }
public bool MergeConstraint(long lCnstrTypeId, float fCnstrValue, ref float?pfCnstrValueOut) { trace?.Write(TraceLevel.Debug, "CM1Group::MergeConstraint"); bool fnResult = true; try { if (!CM1Constraint.IsValidTypeId(lCnstrTypeId)) { throw new ArgumentOutOfRangeException(nameof(lCnstrTypeId), "Invalid input parameter"); } fnResult = m_Cnstr[lCnstrTypeId - 1].Merge(fCnstrValue, ref pfCnstrValueOut); } catch (Exception error) { trace?.Write(TraceLevel.Error, error.ToLogString()); fnResult = false; } return(fnResult); }
public bool GetConstraint(long lCnstrTypeId, ref float constraintValue) { trace?.Write(TraceLevel.Info, "CM1Group:GetConstraint"); bool fnResult = true; try { // Constraints (Alert!: CNSTR_BASE = 1) if (!CM1Constraint.IsValidTypeId(lCnstrTypeId)) { throw new ArgumentOutOfRangeException(nameof(lCnstrTypeId), "lCnstrTypeId out of range"); } constraintValue = m_Cnstr[lCnstrTypeId - 1].Value; } catch (Exception error) { trace?.Write(TraceLevel.Error, error.ToLogString()); fnResult = false; } return(fnResult); }
public bool Merge(CM1Constraint pCnstr, ref float?pfValue) { bool bRdo = true; try { if (pCnstr == null) { throw new InvalidOperationException("pCnstr NULL"); } if (pCnstr.TypeId != TypeId) { throw new InvalidOperationException("TypeId different!!"); } Merge(pCnstr.Value, ref pfValue); } catch (Exception) { bRdo = false; } return(bRdo); }