Exemplo n.º 1
0
        internal static RoyalGazetteContent CreateContentObject(String iName)
        {
            RoyalGazetteContent retval = null;
            switch ( iName )
            {
                case RoyalGazetteContentRename.XmlLabel:
                    {
                        retval = new RoyalGazetteContentRename();
                        break;
                    }
                case RoyalGazetteContentStatus.XmlLabel:
                    {
                        retval = new RoyalGazetteContentStatus();
                        break;
                    }
                case RoyalGazetteContentCreate.XmlLabel:
                    {
                        retval = new RoyalGazetteContentCreate();
                        break;
                    }
                case RoyalGazetteContentAreaChange.XmlLabel:
                    {
                        retval = new RoyalGazetteContentAreaChange();
                        break;
                    }
                case RoyalGazetteContentAreaDefinition.XmlLabel:
                    {
                        retval = new RoyalGazetteContentAreaDefinition();
                        break;
                    }
                case RoyalGazetteContentReassign.XmlLabel:
                    {
                        retval = new RoyalGazetteContentReassign();
                        break;
                    }
                case RoyalGazetteContentAbolish.XmlLabel:
                    {
                        retval = new RoyalGazetteContentAbolish();
                        break;
                    }
                case RoyalGazetteContentConstituency.XmlLabel:
                    {
                        retval = new RoyalGazetteContentConstituency();
                        break;
                    }
                case RoyalGazetteContentMention.XmlLabel:
                    {
                        retval = new RoyalGazetteContentMention();
                        break;
                    }
                case RoyalGazetteContentCapital.XmlLabel:
                    {
                        retval = new RoyalGazetteContentCapital();
                        break;
                    }

            }
            return retval;
        }
Exemplo n.º 2
0
 protected override void ProcessContent(RoyalGazetteContent iContent)
 {
     base.ProcessContent(iContent);
     RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;
     if (lCreate.Type == EntityType.KingAmphoe)
     {
         mNumberOfKingAmphoeCreations++;
     }
 }
Exemplo n.º 3
0
        protected Boolean ContentFitting(RoyalGazetteContent iContent)
        {
            Boolean retval = false;

            if (iContent is RoyalGazetteContentCreate)
            {
                RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;
                retval = EntityFitting(lCreate.Type);
            }
            return(retval);
        }
Exemplo n.º 4
0
 protected override void DoCopy(RoyalGazetteContent iOther)
 {
     if (iOther != null)
     {
         base.DoCopy(iOther);
         if (iOther is RoyalGazetteContentCreate)
         {
             RoyalGazetteContentCreate iOtherCreate = (RoyalGazetteContentCreate)iOther;
             Type   = iOtherCreate.Type;
             Parent = iOtherCreate.Parent;
         }
     }
 }
Exemplo n.º 5
0
        protected override void ProcessContent(RoyalGazetteContent iContent)
        {
            base.ProcessContent(iContent);
            RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;

            Int32 lMubanNumber = lCreate.Geocode % 100;

            if (lMubanNumber != lCreate.Geocode)
            {
                mHighestMubanNumber.IncrementForCount(lMubanNumber, lCreate.Geocode);
            }
            ProcessContentForName(lCreate);
        }
Exemplo n.º 6
0
        protected void ProcessContentForName(RoyalGazetteContentCreate iCreate)
        {
            Int32  lTambonGeocode = iCreate.Geocode / 100;
            String lName          = TambonHelper.StripBanOrChumchon(iCreate.Name);

            if (!String.IsNullOrEmpty(lName))
            {
                String lParentName = String.Empty;
                foreach (RoyalGazetteContent lSubEntry in iCreate.SubEntries)
                {
                    if (lSubEntry is RoyalGazetteContentAreaChange)
                    {
                        lParentName = lSubEntry.Name;
                        // Debug.Assert(lTambonGeocode == (lSubEntry.Geocode / 100), "Parent muban as a different geocode");
                    }
                }
                lParentName = TambonHelper.StripBanOrChumchon(lParentName);
                if (!String.IsNullOrEmpty(lParentName))
                {
                    if (lName.StartsWith(lParentName))
                    {
                        String lSuffix = lName.Remove(0, lParentName.Length).Trim();
                        if (mNewNameSuffix.ContainsKey(lSuffix))
                        {
                            mNewNameSuffix[lSuffix]++;
                        }
                        else
                        {
                            mNewNameSuffix.Add(lSuffix, 1);
                        }
                    }
                    if (lName.EndsWith(lParentName))
                    {
                        String lPrefix = lName.Replace(lParentName, "").Trim();

                        if (mNewNamePrefix.ContainsKey(lPrefix))
                        {
                            mNewNamePrefix[lPrefix]++;
                        }
                        else
                        {
                            mNewNamePrefix.Add(lPrefix, 1);
                        }
                    }
                }
                else
                {
                    mCreationsWithoutParentName++;
                }
            }
        }
Exemplo n.º 7
0
        protected virtual void ProcessContent(RoyalGazetteContent iContent)
        {
            RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;

            mNumberOfCreations++;

            Int32 lChangwatGeocode = lCreate.Geocode;

            while (lChangwatGeocode > 100)
            {
                lChangwatGeocode = lChangwatGeocode / 100;
            }
            mNumberOfCreationsPerChangwat[lChangwatGeocode]++;
        }
Exemplo n.º 8
0
        protected override void ProcessContent(RoyalGazetteContent iContent)
        {
            base.ProcessContent(iContent);
            RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;

            Int32 lParentGeocode = lCreate.Geocode / 100;

            if (!mCreationsPerParent.ContainsKey(lParentGeocode))
            {
                mCreationsPerParent.Add(lParentGeocode, 0);
            }
            mCreationsPerParent[lParentGeocode]++;

            Int32        lMaxSubEntityIndex = 0;
            List <Int32> lParentEntities    = new List <Int32>();

            foreach (RoyalGazetteContent lSubEntry in lCreate.SubEntries)
            {
                if (lSubEntry is RoyalGazetteContentCreate)
                {
                    lMaxSubEntityIndex++;
                }
                if (lSubEntry is RoyalGazetteContentReassign)
                {
                    lMaxSubEntityIndex++;

                    RoyalGazetteContentReassign lReassign = (RoyalGazetteContentReassign)lSubEntry;
                    Int32 lParentEntityCode = lReassign.OldGeocode / 100;
                    if (!lParentEntities.Contains(lParentEntityCode))
                    {
                        lParentEntities.Add(lParentEntityCode);
                    }
                }
            }

            mNumberOfSubEntities.IncrementForCount(lMaxSubEntityIndex, lCreate.Geocode);
            if (lParentEntities.Any())
            {
                mNumberOfParentEntities.IncrementForCount(lParentEntities.Count, lCreate.Geocode);
            }
        }
Exemplo n.º 9
0
        protected override void ProcessContent(RoyalGazetteContent iContent)
        {
            base.ProcessContent(iContent);
            RoyalGazetteContentCreate lCreate = (RoyalGazetteContentCreate)iContent;

            List <Int32> lTargetMubanNumbers = new List <Int32>();

            foreach (RoyalGazetteContent lSubEntry in lCreate.SubEntries)
            {
                if (lSubEntry is RoyalGazetteContentReassign)
                {
                    RoyalGazetteContentReassign lReassign = (RoyalGazetteContentReassign)lSubEntry;
                    Int32 lTargetMubanCode = lSubEntry.Geocode % 100;
                    if (lTargetMubanCode == 0)
                    {
                    }
                    else if (lTargetMubanNumbers.Contains(lTargetMubanCode))
                    {
                        ;  // This should no happen, probably mistake in XML
                    }
                    else
                    {
                        lTargetMubanNumbers.Add(lTargetMubanCode);
                    }
                    Int32 lOldMubanCode = lReassign.OldGeocode % 100;
                    if ((lTargetMubanCode != 0) & (lOldMubanCode != 0))
                    {
                        if (lTargetMubanCode == lOldMubanCode)
                        {
                            mMubanNumberEqual++;
                        }
                        else
                        {
                            mMubanNumberChanged++;
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        static internal RoyalGazetteContent CreateContentObject(String iName)
        {
            RoyalGazetteContent retval = null;

            switch (iName)
            {
            case RoyalGazetteContentRename.XmlLabel:
            {
                retval = new RoyalGazetteContentRename();
                break;
            }

            case RoyalGazetteContentStatus.XmlLabel:
            {
                retval = new RoyalGazetteContentStatus();
                break;
            }

            case RoyalGazetteContentCreate.XmlLabel:
            {
                retval = new RoyalGazetteContentCreate();
                break;
            }

            case RoyalGazetteContentAreaChange.XmlLabel:
            {
                retval = new RoyalGazetteContentAreaChange();
                break;
            }

            case RoyalGazetteContentAreaDefinition.XmlLabel:
            {
                retval = new RoyalGazetteContentAreaDefinition();
                break;
            }

            case RoyalGazetteContentReassign.XmlLabel:
            {
                retval = new RoyalGazetteContentReassign();
                break;
            }

            case RoyalGazetteContentAbolish.XmlLabel:
            {
                retval = new RoyalGazetteContentAbolish();
                break;
            }

            case RoyalGazetteContentConstituency.XmlLabel:
            {
                retval = new RoyalGazetteContentConstituency();
                break;
            }

            case RoyalGazetteContentMention.XmlLabel:
            {
                retval = new RoyalGazetteContentMention();
                break;
            }

            case RoyalGazetteContentCapital.XmlLabel:
            {
                retval = new RoyalGazetteContentCapital();
                break;
            }
            }
            return(retval);
        }
Exemplo n.º 11
0
        protected void ProcessContentForName(RoyalGazetteContentCreate iCreate)
        {
            Int32 lTambonGeocode = iCreate.Geocode / 100;
            String lName = TambonHelper.StripBanOrChumchon(iCreate.Name);
            if ( !String.IsNullOrEmpty(lName) )
            {
                String lParentName = String.Empty;
                foreach ( RoyalGazetteContent lSubEntry in iCreate.SubEntries )
                {
                    if ( lSubEntry is RoyalGazetteContentAreaChange )
                    {
                        lParentName = lSubEntry.Name;
                        // Debug.Assert(lTambonGeocode == (lSubEntry.Geocode / 100), "Parent muban as a different geocode");
                    }
                }
                lParentName = TambonHelper.StripBanOrChumchon(lParentName);
                if ( !String.IsNullOrEmpty(lParentName) )
                {
                    if ( lName.StartsWith(lParentName) )
                    {
                        String lSuffix = lName.Remove(0, lParentName.Length).Trim();
                        if ( mNewNameSuffix.ContainsKey(lSuffix) )
                        {
                            mNewNameSuffix[lSuffix]++;
                        }
                        else
                        {
                            mNewNameSuffix.Add(lSuffix, 1);
                        }
                    }
                    if ( lName.EndsWith(lParentName) )
                    {
                        String lPrefix = lName.Replace(lParentName, "").Trim();

                        if ( mNewNamePrefix.ContainsKey(lPrefix) )
                        {
                            mNewNamePrefix[lPrefix]++;
                        }
                        else
                        {
                            mNewNamePrefix.Add(lPrefix, 1);
                        }
                    }
                }
                else
                {
                    mCreationsWithoutParentName++;
                }
            }
        }