protected override bool resolve(MatchingString ms)
        {
            int index = 0;
            bool IsContinue;
            string str;

            foreach (MatchingBlock mb in ms.GetAvaiableMatchingBlock())
            {
                foreach (string a in m_aggregate)
                {
                    IsContinue = true;
                    index = 0;
                    while (IsContinue)
                    {
                        str = ms.MatchingBlockGetString(mb);
                        index = str.IndexOf(a,index);
                        if (index > -1)
                        {
                            ms.AddMatchingBlock(this, mb, index, a.Length);
                            if (m_IsSingleMatch)
                                return false;                            
                            index++;
                        }
                        else
                            IsContinue = false;
                    }
                    
                }
            }
            return false;
        }
        protected override bool resolve(MatchingString ms)
        {
            foreach (MatchingBlock mb in ms.GetAvaiableMatchingBlock())
            {
                mb.wordmatch = this;                
            }

            return true;
        }
 public void Process(MatchingString ms)
 {
     if (resolve(ms))
         done(ms);
     else
         if (next != null)
             next.Process(ms);
         else
             fail(ms);
 }
        protected override bool resolve(MatchingString ms)
        {
            MatchCollection mc;
            foreach (MatchingBlock mb in ms.GetAvaiableMatchingBlock())
            {
                if (m_featherfirst != null)
                {
                    mc = m_featherfirst.Matches(ms.MatchingBlockGetString(mb));
                    foreach (Match m in mc)
                    {
                        if (m.Success)
                        {
                            ms.AddMatchingBlock(this, mb, m.Index, m.Length);
                            if (m_IsSingleMatch)
                                return false;
                        }
                    }
                }

                if (m_feathersecond != null)
                {
                    mc = m_feathersecond.Matches(ms.MatchingBlockGetString(mb));
                    foreach (Match m in mc)
                    {
                        if (m.Success)
                        {
                            ms.AddMatchingBlock(this, mb, m.Index, m.Length);
                            if (m_IsSingleMatch)
                                return false;
                        }
                    }
                }

                if (m_featherthird != null)
                {
                    mc = m_featherthird.Matches(ms.MatchingBlockGetString(mb));
                    foreach (Match m in mc)
                    {
                        if (m.Success)
                        {
                            ms.AddMatchingBlock(this, mb, m.Index, m.Length);
                            if (m_IsSingleMatch)
                                return false;
                        }
                    }
                }
            }
            return false;
        }
 protected abstract bool resolve(MatchingString ms);
 protected void done(MatchingString ms)
 {
     
 }
 protected void fail(MatchingString ms)
 {
     
 }
        public ChineseAddress Parse(String str)
        {
            str = str.Replace(".", "").Replace(",", "").Replace(",","");
            MatchingString ms = new MatchingString(str);
            ms_headwordmatch.Process(ms);

            ChineseAddress ca = new ChineseAddress();
            ca.source = str;
            ca.nation = ms.GetStringByWordmatch(ms_nationwordmatch);
            ca.province = ms.GetStringByWordmatch(ms_provincewordmatch);
            ca.city = ms.GetStringByWordmatch(ms_citywordmatch);
            ca.district = ms.GetStringByWordmatch(ms_districtwordmatch);
            ca.county = ms.GetStringByWordmatch(ms_countywordmatch);
            if (ms.GetStringByWordmatch(ms_streetwordmatch) != null)
                ca.street = ms.GetStringByWordmatch(ms_streetwordmatch);
            else
                ca.street = ms.GetStringByWordmatch(ms_roadwordmatch);
            ca.number = ms.GetStringByWordmatch(ms_numberwordmatch);
            ca.plaza = ms.GetStringByWordmatch(ms_plazawordmatch);
            ca.ip = ms.GetStringByWordmatch(ms_industrialparkwordmatch);
            ca.town = ms.GetStringByWordmatch(ms_townwordmatch);
            ca.village = ms.GetStringByWordmatch(ms_villagewordmatch);
            //ca.notes = ms.GetStringsByWordmatch(ms_notewordmatch);
            //ca.noises = ms.GetStringsByWordmatch(ms_noisecollector);
            return ca;
        }   
 protected override bool resolve(MatchingString ms)
 {
     return false;
 }