Пример #1
0
        /// <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);
        }
Пример #2
0
        public override string ParseString(string strValue)
        {
            if (fValue != null)
            {
                fValue = null;
            }

            return(string.IsNullOrEmpty(strValue) ? string.Empty : ParseDateValue(this, strValue));
        }
Пример #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();
        }
Пример #4
0
 /// <summary>
 /// Internal helper method for parser
 /// </summary>
 internal void SetRawData(GDMCustomDate value)
 {
     fValue = value;
 }
Пример #5
0
 public GDMDateValue()
 {
     fValue = null;
 }