Exemple #1
0
        public void TestNameSequence()
        {
            var sequence = new NameSequence();

            sequence.Seek("聂");
            for (int i = 0; i < 100 && !sequence.EndOfSequence; ++i, sequence.MoveNext())
            {
                Console.WriteLine(sequence.Current);
            }
        }
Exemple #2
0
 private static CrawlContext GetCrawlContext(string sequenceType, string start, long max, int pause)
 {
     ISequence<string> sequence;
     QueryType queryType;
     if (sequenceType.Equals("NN"))
     {
         var innerSequence = new NaturalNumberSequence();
         innerSequence.Seek(long.Parse(start));
         sequence = new TextSequence<long>(innerSequence);
         queryType = QueryType.IdCardNumber;
     }
     else if (sequenceType.Equals("N"))
     {
         sequence = new NameSequence();
         sequence.Seek(start);
         queryType = QueryType.Name;
     }
     else if (sequenceType.Equals("RICN"))
     {
         sequence = new RandomIdCardNumberSequence();
         queryType = QueryType.IdCardNumber;
     }
     else if (sequenceType.Equals("RN1"))
     {
         sequence = new RandomNameSequence(1);
         queryType = QueryType.Name;
     }
     else if (sequenceType.Equals("RN2"))
     {
         sequence = new RandomNameSequence(2);
         queryType = QueryType.Name;
     }
     else
     {
         throw new ArgumentException("Invalid sequence type: " + sequenceType);
     }
     sequence.Initialize();
     return new CrawlContext
     {
         Sequence = sequence,
         SequenceType = sequenceType,
         MaximumTry = max,
         QueryType = queryType,
         Pause = pause,
     };
 }