/// <summary>
        /// This function compares dates only by chronological year.
        /// Month and day are not taken into account, the year is compared with the calendar.
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="matchParams"></param>
        /// <returns></returns>
        public override float IsMatch(GDMCustomDate tag, MatchParams matchParams)
        {
            if (tag == null)
            {
                return(0.0f);
            }
            GDMDateValue date = (GDMDateValue)tag;

            if (IsEmpty() || date.IsEmpty())
            {
                return(0.0f);
            }

            int absVal1 = this.GetChronologicalYear();
            int absVal2 = date.GetChronologicalYear();

            float match   = 0.0f;
            float matches = 0.0f;

            if (absVal1 != 0 && absVal2 != 0)
            {
                matches += 1.0f;
                if (Math.Abs(absVal1 - absVal2) <= matchParams.YearsInaccuracy)
                {
                    match += 100.0f;
                }
            }

            return(match / matches);
        }
        public override string ParseString(string strValue)
        {
            if (fValue != null)
            {
                fValue = null;
            }

            return(string.IsNullOrEmpty(strValue) ? string.Empty : ParseDateValue(this, strValue));
        }
Esempio n. 3
0
        public override void Assign(GDMCustomDate source)
        {
            GDMDate srcDate = source as GDMDate;

            if (srcDate == null)
            {
                throw new ArgumentException(@"Argument is null or wrong type", "source");
            }

            fApproximated = srcDate.fApproximated;
            fYear         = srcDate.fYear;
            fYearBC       = srcDate.fYearBC;
            fYearModifier = srcDate.fYearModifier;
            fMonth        = srcDate.fMonth;
            fDay          = srcDate.fDay;

            DateChanged();
        }
 /// <summary>
 /// Internal helper method for parser
 /// </summary>
 internal void SetRawData(GDMCustomDate value)
 {
     fValue = value;
 }
 public GDMDateValue()
 {
     fValue = null;
 }