コード例 #1
0
        public TrendComparisonInteger( TrendLineInteger trend1, TrendLineInteger trend2 )
        {
            if ( trend1 == null ) throw new ArgumentNullException("trend1");
            if ( trend2 == null ) throw new ArgumentNullException("trend2");
            if ( trend1.CountAll != trend2.CountAll ) throw new ArgumentException("The two trends should have the same number of years.");
            _count = trend1.CountAll;

            Int16[] surveyYears1 = trend1.SurveyYears;
            Int16[] surveyYears2 = trend2.SurveyYears;
            Int16?[] points1 = trend1.Values;
            Int16?[] points2 = trend2.Values;

            for ( Int32 i = 0; i < trend2.CountAll; i++ ) {
                if ( surveyYears1[i] != surveyYears2[i] ) {
                    throw new ArgumentException("The SurveyYear at element " + i + " should match.");
                }
                else if ( points1[i] == null && points2[i] == null ) {
                    _countOfNullDoubles += 1;
                    _agreementCountOfNulls += 1;
                }
                else if ( (points1[i] == null) || (points2[i] == null) ) {
                    _countOfNullSingles += 1;
                    _disagreementCountIncludingNulls += 1;
                    _lastNonMutualNullPointsYear = surveyYears1[i];
                }
                else if ( !points1[i].Equals(points2[i]) ) {
                    _countOfNullZeros += 1;
                    _disagreementCountExcludingNulls += 1;
                    _disagreementCountIncludingNulls += 1;
                    _lastMutualNonNullPointsAgree = false;
                    _lastNonMutualNullPointsYear = surveyYears1[i];
                    if ( points1[i] == 1 || points2[i] == 1 )
                        _disagreementCountOfOnes += 1;
                }
                else {
                    _countOfNullZeros += 1;
                    _agreementCountExcludingNulls += 1;
                    _lastMutualNonNullPointsAgree = true;
                    _lastNonMutualNullPointsYear = surveyYears1[i];
                    Trace.Assert(points1[i].Equals(points2[i]), "If the execution got here, the two values should be equal.");
                    if ( points1[i] == 1 )
                        _agreementCountOfOnes += 1;
                }
            }

            _jumpsAgreePerfectly = trend1.Jumps.SequenceEqual(trend2.Jumps);
        }
コード例 #2
0
 public void TestInitialize( )
 {
     _trend0 = new TrendLineInteger(_surveyYears2, _values0);
     _trend1 = new TrendLineInteger(_surveyYears1, _values1);
     _trend2 = new TrendLineInteger(_surveyYears2, _values2);
     _trend3 = new TrendLineInteger(_surveyYears2, _values3);
     _trend4 = new TrendLineInteger(_surveyYears2, _values4);
     _trend5 = new TrendLineInteger(_surveyYears2, _values5);
     _comparison0vs0 = new TrendComparisonInteger(_trend0, _trend0);
     _comparison0vs1 = new TrendComparisonInteger(_trend0, _trend1);
     _comparison0vs3 = new TrendComparisonInteger(_trend0, _trend3);
     _comparison1vs2 = new TrendComparisonInteger(_trend1, _trend2);
     _comparison1vs3 = new TrendComparisonInteger(_trend1, _trend3);
     _comparison1vs4 = new TrendComparisonInteger(_trend1, _trend4);
     _comparison1vs5 = new TrendComparisonInteger(_trend1, _trend5);
     _comparison2vs3 = new TrendComparisonInteger(_trend2, _trend3);
     _comparison3vs3 = new TrendComparisonInteger(_trend3, _trend3);
     _comparison3vs4 = new TrendComparisonInteger(_trend3, _trend4);
 }
コード例 #3
0
        private Int32 FromFatherIsAlive( LinksDataSet.tblRelatedStructureRow drRelated, LinksDataSet.tblFatherOfGen2DataTable dtFatherSubject1, LinksDataSet.tblFatherOfGen2DataTable dtFatherSubject2, Int16 extendedID )
        {
            const MarkerType markerType = MarkerType.Gen2CFatherAlive;
            const bool fromMother = false;
            Int16[] surveyYears = ItemYears.Gen2CFatherAlive;
            Int16?[] points1 = FatherOfGen2.RetrieveIsAlive(drRelated.SubjectTag_S1, surveyYears, dtFatherSubject1);
            Int16?[] points2 = FatherOfGen2.RetrieveIsAlive(drRelated.SubjectTag_S2, surveyYears, dtFatherSubject2);

            TrendLineInteger trend1 = new TrendLineInteger(surveyYears, points1);
            TrendLineInteger trend2 = new TrendLineInteger(surveyYears, points2);
            TrendComparisonInteger comparison = new TrendComparisonInteger(trend1, trend2);
            MarkerEvidence mzEvidence = DetermineShareGen2Father.AliveOrAsthma(comparison);
            MarkerEvidence biodadEvidence = mzEvidence;
            return AddMarkerRow(extendedID, drRelated.ID, markerType, comparison.LastNonMutualNullPointsYear, mzEvidence, biodadEvidence, fromMother);
        }
コード例 #4
0
 public void TestCleanup( )
 {
     _trend0 = null;
     _trend1 = null;
     _trend2 = null;
     _trend3 = null;
     _trend4 = null;
     _trend5 = null;
     _comparison0vs0 = null;
     _comparison0vs1 = null;
     _comparison0vs3 = null;
     _comparison1vs2 = null;
     _comparison1vs3 = null;
     _comparison1vs4 = null;
     _comparison1vs5 = null;
     _comparison2vs3 = null;
     _comparison3vs3 = null;
     _comparison3vs4 = null;
 }
コード例 #5
0
        private Int32 FromBabyDaddyInHH( LinksDataSet.tblRelatedStructureRow drRelated, LinksDataSet.tblBabyDaddyDataTable dtBabyDaddySubject1, LinksDataSet.tblBabyDaddyDataTable dtBabyDaddySubject2, Int16 extendedID )
        {
            const MarkerType markerType = MarkerType.BabyDaddyInHH;
            const bool fromMother = true;
            Int16[] surveyYears = ItemYears.BabyDaddyInHH;
            Int16?[] values1 = BabyDaddy.RetrieveInHH(drRelated.SubjectTag_S1, surveyYears, dtBabyDaddySubject1);
            Int16?[] values2 = BabyDaddy.RetrieveInHH(drRelated.SubjectTag_S2, surveyYears, dtBabyDaddySubject2);

            TrendLineInteger trend1 = new TrendLineInteger(surveyYears, values1);
            TrendLineInteger trend2 = new TrendLineInteger(surveyYears, values2);
            TrendComparisonInteger comparison = new TrendComparisonInteger(trend1, trend2);
            MarkerEvidence mzEvidence = DetermineShareBabyDaddy.InHH(comparison);
            MarkerEvidence biodadEvidence = mzEvidence;
            return AddMarkerRow(extendedID, drRelated.ID, markerType, comparison.LastNonMutualNullPointsYear, mzEvidence, biodadEvidence, fromMother);
        }