bool FundamentalValue::Equals(const Value* other) const { if(other->GetType() != GetType()) { return false; } switch(GetType()) { case TYPE_BOOLEAN: { bool lhs, rhs; return GetAsBoolean(&lhs) && other->GetAsBoolean(&rhs) && lhs==rhs; } case TYPE_INTEGER: { int lhs, rhs; return GetAsInteger(&lhs) && other->GetAsInteger(&rhs) && lhs==rhs; } case TYPE_DOUBLE: { double lhs, rhs; return GetAsDouble(&lhs) && other->GetAsDouble(&rhs) && lhs==rhs; } default: NOTREACHED(); return false; } }
CTString CCurrencyField::GetValLable() { double nValue = GetAsDouble(); int nSize=m_ValueLabel.GetCount(); for(int n=0; n<nSize; n++) { m_ValueLabel.SetCurPos(n); if(fabs(m_ValueLabel.GetAsDouble() - nValue) < DoubleZero) return m_ValueLabel.GetExplainString(); } return _T(""); }
//判断当前值是否属于缺失值,空值也是缺失值 bool CField::IsMissingValue() { bool bValueMissed = false; double dData[3], dOrgData; int nCount, iIndex; if( IsNull() ) bValueMissed = true; else if( m_pMissing!=NULL ) { if( m_pMissing->GetMissingType()!=mtNoMissing ) { dOrgData = GetAsDouble(); m_pMissing->GetDoubleData( dData[0], dData[1], dData[2] ); nCount = m_pMissing->GetCount(); if( m_pMissing->GetMissingType()==mtDiscrete ) { for( iIndex=0; iIndex<nCount; iIndex++ ) { if( dOrgData==dData[iIndex] ) { bValueMissed = true; break; } } } else if( m_pMissing->GetMissingType()==msRange ) { if( dOrgData>=dData[0] && dOrgData<=dData[1] ) bValueMissed = true; else if( nCount==3 && dOrgData==dData[2] ) bValueMissed = true; } } } return bValueMissed; }