예제 #1
0
 protected override void ProcessContent(GazetteCreate content)
 {
     base.ProcessContent(content);
     if (content.type == EntityType.KingAmphoe)
     {
         _numberOfKingAmphoeCreations++;
     }
 }
예제 #2
0
        protected void ProcessContentForName(GazetteCreate create)
        {
            UInt32 tambonGeocode = create.geocode / 100;
            String name          = create.name.StripBanOrChumchon();

            if (!String.IsNullOrEmpty(name))
            {
                String parentName = String.Empty;
                foreach (var subEntry in create.Items)
                {
                    var areaChange = subEntry as GazetteAreaChange;
                    if (areaChange != null)
                    {
                        if (!String.IsNullOrEmpty(areaChange.name))
                        {
                            parentName = areaChange.name;
                        }
                        // this really happened once, so cannot use this check for sanity of input data
                        // Debug.Assert(tambonGeocode == (areaChange.geocode / 100), String.Format("Parent muban for {0} has a different geocode {1}", create.geocode, areaChange.geocode));
                    }
                }
                parentName = parentName.StripBanOrChumchon();
                if (!String.IsNullOrEmpty(parentName))
                {
                    if (name.StartsWith(parentName))
                    {
                        String suffix = name.Remove(0, parentName.Length).Trim();
                        if (_newNameSuffix.ContainsKey(suffix))
                        {
                            _newNameSuffix[suffix]++;
                        }
                        else
                        {
                            _newNameSuffix.Add(suffix, 1);
                        }
                    }
                    if (name.EndsWith(parentName))
                    {
                        String prefix = name.Replace(parentName, "").Trim();

                        if (_newNamePrefix.ContainsKey(prefix))
                        {
                            _newNamePrefix[prefix]++;
                        }
                        else
                        {
                            _newNamePrefix.Add(prefix, 1);
                        }
                    }
                }
                else
                {
                    _creationsWithoutParentName++;
                }
            }
        }
        protected override void ProcessContent(GazetteCreate content)
        {
            base.ProcessContent(content);

            UInt32 mubanNumber = content.geocode % 100;
            if ( mubanNumber != content.geocode )
            {
                _highestMubanNumber.IncrementForCount(Convert.ToInt32(mubanNumber), content.geocode);
            }
            ProcessContentForName(content);
        }
예제 #4
0
        protected Boolean ContentFitting(GazetteOperationBase content)
        {
            Boolean       result = false;
            GazetteCreate create = content as GazetteCreate;

            if (create != null)
            {
                result = EntityFitting(create.type);
            }
            return(result);
        }
예제 #5
0
        protected override void ProcessContent(GazetteCreate content)
        {
            base.ProcessContent(content);

            UInt32 mubanNumber = content.geocode % 100;

            if (mubanNumber != content.geocode)
            {
                _highestMubanNumber.IncrementForCount(Convert.ToInt32(mubanNumber), content.geocode);
            }
            ProcessContentForName(content);
        }
예제 #6
0
        protected virtual void ProcessContent(GazetteCreate content)
        {
            _numberOfCreations++;

            UInt32 changwatGeocode = content.geocode;

            while (changwatGeocode > 100)
            {
                changwatGeocode = changwatGeocode / 100;
            }
            _numberOfCreationsPerChangwat[changwatGeocode]++;
        }
        protected override void ProcessContent(GazetteCreate content)
        {
            base.ProcessContent(content);
            var create = content as GazetteCreate;

            UInt32 parentGeocode = create.geocode / 100;

            if (!_creationsPerParent.ContainsKey(parentGeocode))
            {
                _creationsPerParent.Add(parentGeocode, 0);
            }
            _creationsPerParent[parentGeocode]++;

            Int32         maxSubEntityIndex = 0;
            List <UInt32> parentEntities    = new List <UInt32>();

            foreach (GazetteOperationBase subEntry in create.Items)
            {
                var createSubEntry = subEntry as GazetteCreate;
                if (createSubEntry != null)
                {
                    maxSubEntityIndex++;
                }
                var reassignSubEntry = subEntry as GazetteReassign;
                if (reassignSubEntry != null)
                {
                    maxSubEntityIndex++;

                    UInt32 parentEntityCode = reassignSubEntry.oldgeocode / 100;
                    if (!parentEntities.Contains(parentEntityCode))
                    {
                        parentEntities.Add(parentEntityCode);
                    }
                }
            }

            _numberOfSubEntities.IncrementForCount(maxSubEntityIndex, create.geocode);
            if (parentEntities.Any())
            {
                _numberOfParentEntities.IncrementForCount(parentEntities.Count, create.geocode);
            }
        }
예제 #8
0
        protected override void ProcessContent(GazetteCreate content)
        {
            base.ProcessContent(content);

            List <UInt32> targetMubanNumbers = new List <UInt32>();

            foreach (var subEntry in content.Items)
            {
                var reassign = subEntry as GazetteReassign;
                if (reassign != null)
                {
                    UInt32 targetMubanCode = reassign.geocode % 100;
                    if (targetMubanCode == 0)
                    {
                    }
                    else if (targetMubanNumbers.Contains(targetMubanCode))
                    {
                        ;  // This should no happen, probably mistake in XML
                    }
                    else
                    {
                        targetMubanNumbers.Add(targetMubanCode);
                    }
                    UInt32 oldMubanCode = reassign.oldgeocode % 100;
                    if ((targetMubanCode != 0) & (oldMubanCode != 0))
                    {
                        if (targetMubanCode == oldMubanCode)
                        {
                            _mubanNumberEqual++;
                        }
                        else
                        {
                            _mubanNumberChanged++;
                        }
                    }
                }
            }
        }
        protected override void ProcessContent(GazetteCreate content)
        {
            base.ProcessContent(content);

            List<UInt32> targetMubanNumbers = new List<UInt32>();
            foreach ( var subEntry in content.Items )
            {
                var reassign = subEntry as GazetteReassign;
                if ( reassign != null )
                {
                    UInt32 targetMubanCode = reassign.geocode % 100;
                    if ( targetMubanCode == 0 )
                    {
                    }
                    else if ( targetMubanNumbers.Contains(targetMubanCode) )
                    {
                        ;  // This should no happen, probably mistake in XML
                    }
                    else
                    {
                        targetMubanNumbers.Add(targetMubanCode);
                    }
                    UInt32 oldMubanCode = reassign.oldgeocode % 100;
                    if ( (targetMubanCode != 0) & (oldMubanCode != 0) )
                    {
                        if ( targetMubanCode == oldMubanCode )
                        {
                            _mubanNumberEqual++;
                        }
                        else
                        {
                            _mubanNumberChanged++;
                        }
                    }
                }
            }
        }
예제 #10
0
        protected void ProcessContentForName(GazetteCreate create)
        {
            UInt32 tambonGeocode = create.geocode / 100;
            String name = create.name.StripBanOrChumchon();
            if ( !String.IsNullOrEmpty(name) )
            {
                String parentName = String.Empty;
                foreach ( var subEntry in create.Items )
                {
                    var areaChange = subEntry as GazetteAreaChange;
                    if ( areaChange != null )
                    {
                        if ( !String.IsNullOrEmpty(areaChange.name) )
                        {
                            parentName = areaChange.name;
                        }
                        // this really happened once, so cannot use this check for sanity of input data
                        // Debug.Assert(tambonGeocode == (areaChange.geocode / 100), String.Format("Parent muban for {0} has a different geocode {1}", create.geocode, areaChange.geocode));
                    }
                }
                parentName = parentName.StripBanOrChumchon();
                if ( !String.IsNullOrEmpty(parentName) )
                {
                    if ( name.StartsWith(parentName) )
                    {
                        String suffix = name.Remove(0, parentName.Length).Trim();
                        if ( _newNameSuffix.ContainsKey(suffix) )
                        {
                            _newNameSuffix[suffix]++;
                        }
                        else
                        {
                            _newNameSuffix.Add(suffix, 1);
                        }
                    }
                    if ( name.EndsWith(parentName) )
                    {
                        String prefix = name.Replace(parentName, "").Trim();

                        if ( _newNamePrefix.ContainsKey(prefix) )
                        {
                            _newNamePrefix[prefix]++;
                        }
                        else
                        {
                            _newNamePrefix.Add(prefix, 1);
                        }
                    }
                }
                else
                {
                    _creationsWithoutParentName++;
                }
            }
        }
 protected override void ProcessContent(GazetteCreate content)
 {
     base.ProcessContent(content);
     if ( content.type == EntityType.KingAmphoe )
     {
         _numberOfKingAmphoeCreations++;
     }
 }
        protected override void ProcessContent(GazetteCreate content)
        {
            base.ProcessContent(content);
            var create = content as GazetteCreate;

            UInt32 parentGeocode = create.geocode / 100;

            if ( !_creationsPerParent.ContainsKey(parentGeocode) )
            {
                _creationsPerParent.Add(parentGeocode, 0);
            }
            _creationsPerParent[parentGeocode]++;

            Int32 maxSubEntityIndex = 0;
            List<UInt32> parentEntities = new List<UInt32>();
            foreach ( GazetteOperationBase subEntry in create.Items )
            {
                var createSubEntry = subEntry as GazetteCreate;
                if ( createSubEntry != null )
                {
                    maxSubEntityIndex++;
                }
                var reassignSubEntry = subEntry as GazetteReassign;
                if ( reassignSubEntry != null )
                {
                    maxSubEntityIndex++;

                    UInt32 parentEntityCode = reassignSubEntry.oldgeocode / 100;
                    if ( !parentEntities.Contains(parentEntityCode) )
                    {
                        parentEntities.Add(parentEntityCode);
                    }
                }
            }

            _numberOfSubEntities.IncrementForCount(maxSubEntityIndex, create.geocode);
            if ( parentEntities.Any() )
            {
                _numberOfParentEntities.IncrementForCount(parentEntities.Count, create.geocode);
            }
        }