public override string ToString()
        {
            return(String.Format(
                       @"Filter values:
 Same Journal: {0}
 Publication window lower bound: {1}
 Publication window upper bound: {2}
 Maximum link ranking: {3}
 Include pubtype categories: {4}
 Include languages: {5}",
                       SameJournal,
                       PubWindowLowerBound == null ? "filter not set" : PubWindowLowerBound.ToString(),
                       PubWindowUpperBound == null ? "filter not set" : PubWindowLowerBound.ToString(),
                       MaximumLinkRanking == null ? "filter not set" : MaximumLinkRanking.ToString(),
                       ((IncludeCategories == null) || (IncludeCategories.Count() == 0)) ? "filter not set" : String.Join(", ", IncludeCategories),
                       ((IncludeLanguages == null) || (IncludeLanguages.Count() == 0)) ? "filter not set" : String.Join(", ", IncludeLanguages)
                       ));
        }
        /// <summary>
        /// Check a publication against the filter
        /// </summary>
        /// <param name="publication">Publication to check</param>
        /// <param name="linkRanking">Link ranking for the publication</param>
        /// <param name="referencePublication">Reference publication to compare against</param>
        /// <param name="publicationTypes">PublicationTypes object for the current database</param>
        /// <returns>True if the publication matches the filter, false otherwise</returns>
        public bool FilterPublication(Publication publication, int linkRanking, Publication referencePublication, PublicationTypes publicationTypes)
        {
            if (SameJournal && (publication.Journal != referencePublication.Journal))
            {
                return(false);
            }

            if (PubWindowLowerBound.HasValue && (referencePublication.Year - PubWindowLowerBound > publication.Year))
            {
                return(false);
            }

            if (PubWindowUpperBound.HasValue && (referencePublication.Year + PubWindowUpperBound < publication.Year))
            {
                return(false);
            }

            if (linkRanking > MaximumLinkRanking)
            {
                return(false);
            }

            if (((IncludeCategories != null) && (IncludeCategories.Count() > 0)) &&
                ((String.IsNullOrEmpty(publication.PubType) ||
                  !IncludeCategories.Contains(publicationTypes.GetCategoryNumber(publication.PubType)))))
            {
                return(false);
            }

            if ((IncludeLanguages != null) && (IncludeLanguages.Count() > 0) &&
                (String.IsNullOrEmpty(publication.Language) ||
                 !IncludeLanguages.Contains(publication.Language)))
            {
                return(false);
            }

            return(true);
        }