Beispiel #1
0
        public override double Compare(Node node)
        {
            var bdn = node as BibliographicDescriptionNode;

            if (bdn == null)
            {
                throw new Exception("Not Bibliographic DescriptionNode");
            }

            double difference = 0;

            difference += TitleNode.Compare(bdn.TitleNode);

            if (difference < 0.05 || difference > 0.25)
            {
                return(difference);
            }

            difference += AutorRangeNode.Compare(bdn.AutorRangeNode);
            difference += PublisherNode.Compare(bdn.PublisherNode);
            difference += CityNode.Compare(bdn.CityNode);
            difference += YearNode.Compare(bdn.YearNode);
            difference += PageCountNode.Compare(bdn.PageCountNode);

            return(difference);
        }
Beispiel #2
0
 private static void Add(this SortedList <BigInteger, YearNode> years, YearNode year)
 {
     try {
         years.Add(year.Year, year);
     }
     catch (ArgumentException) {
         years[year.Year].Months.Addpend(year.Months);
     }
 }
Beispiel #3
0
 public BibliographicDescriptionNode(string title, IEnumerable <string> autors, string publisher, string city, string year, string pageCount)
 {
     TitleNode      = new TitleNode(title);
     AutorRangeNode = new AutorRangeNode(autors);
     PublisherNode  = new PublisherNode(publisher);
     CityNode       = new CityNode(city);
     YearNode       = new YearNode(year);
     PageCountNode  = new PageCountNode(pageCount);
 }
Beispiel #4
0
 private static YearNode EvalYear(Cons cons)
 {
     if ((cons.car as string).ToLower() == "year")
     {
         YearNode year            = new YearNode(BigInteger.Parse((cons.cdr as Cons).car as string));
         Cons     monthCollection = (cons.cdr as Cons).cdr as Cons;
         foreach (Cons month in monthCollection)
         {
             year.Months.Add(EvalMonth(month));
         }
         return(year);
     }
     else
     {
         throw new Exception($"无效的标记:{cons.car}");
     }
 }