コード例 #1
0
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 21JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * get all records based on search condition.
  * @param findConditions the search condition.
  * @return a hashtable of all matched record.the key is the mapInfo ID. the
  *  value is the matched string.
  */
 public Hashtable Search(FindConditions findConditions)
 {
     return _mapFile.Search(findConditions);
 }
コード例 #2
0
ファイル: MapFile.cs プロジェクト: 237rxd/maptiledownloader
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        /**
         * get all records based on search condition.
         * @param findConditions the search condition.
         * @return a hashtable of all matched record.the key is the mapInfo ID.
         */
        public Hashtable Search(FindConditions findConditions)
        {
            Hashtable retTable = new Hashtable();
            ArrayList allCondition = findConditions.GetConditions();
            for (int i = 0; i < allCondition.Count; i++)
            {
                FindCondition findCondition = (FindCondition)allCondition[i];
                int stringID = BinarySearch(findCondition.MatchString);
                int fieldIndex = findCondition.FieldIndex;
                if (stringID != -1)
                {
                    bool bDone = false;
                    _stringIndex.GetRecord(stringID);
                    string strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                    while (strValue.StartsWith(findCondition.MatchString) && (!bDone))
                    {
                        int fieldCount = _stringData.FieldCount;
                        for (int j = 0; j < fieldCount; j++)
                        {
                            if (_stringData.FieldID[j] == fieldIndex)
                            {
                                int mapInfoID = _stringData.MapInfoID[j];
                                if (!retTable.ContainsKey(mapInfoID))
                                {
                                    retTable.Add(mapInfoID,
                                            strValue);
                                }
                                if (retTable.Count > FindConditions.MaxMatchRecord)
                                {
                                    return retTable;
                                }
                            }
                        }
                        bDone = _stringIndex.MovePrevious();
                        if (!bDone)
                        {
                            strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                        }
                    }
                    bDone = false;
                    _stringIndex.GetRecord(stringID);
                    strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                    while (strValue.StartsWith(findCondition.MatchString) && (!bDone))
                    {
                        int fieldCount = _stringData.FieldCount;
                        for (int j = 0; j < fieldCount; j++)
                        {
                            if (_stringData.FieldID[j] == fieldIndex)
                            {
                                int mapInfoID = _stringData.MapInfoID[j];
                                if (!retTable.ContainsKey(mapInfoID))
                                {
                                    retTable.Add(mapInfoID,
                                            strValue);
                                }
                                if (retTable.Count > FindConditions.MaxMatchRecord)
                                {
                                    return retTable;
                                }
                            }
                        }
                        bDone = _stringIndex.MoveNext();
                        if (!bDone)
                        {
                            strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                        }
                    }
                }

            }
            return retTable;
        }
コード例 #3
0
ファイル: Class.cs プロジェクト: zoltraks/visual-cherry
            public ClassInfoRecord Find(FindConditions conditions)
            {
                lock (_Lock)
                {
                    bool?purge = false;
                    try
                    {
                        DateTime expectancy = DateTime.MinValue;
                        if (RetireTime == TimeSpan.MinValue || LastAccess == DateTime.MinValue)
                        {
                            purge = null;
                        }
                        else
                        {
                            expectancy = DateTime.Now - RetireTime;
                        }

                        for (int i = 0, c = this.Count; i < c; i++)
                        {
                            var o = this[i];

                            if (true &&
                                DateTime.MinValue != expectancy &&
                                DateTime.MinValue != o.AccessTime &&
                                expectancy > o.AccessTime
                                )
                            {
                                //if (true != purge)
                                //{
                                //    purge = true;
                                //}
                                purge = true;
                                continue;
                            }

                            if (null != conditions.Type)
                            {
                                if (false ||
                                    o.Type != conditions.Type ||
                                    conditions.IncludeSuccessors && !o.IsSuccessor(conditions.Type)
                                    )
                                {
                                    continue;
                                }
                            }

                            if (null != conditions.Name)
                            {
                                if (0 != string.Compare(o.Name, conditions.Name, conditions.IgnoreCase))
                                {
                                    continue;
                                }
                            }

                            bool b = true;

                            if (null != conditions.Field)
                            {
                                if (null != o.Fields)
                                {
                                    for (int n = 0, m = o.Fields.Length; n < m; n++)
                                    {
                                        var f = o.Fields[n];
                                        if (0 == string.Compare(f.Name, conditions.Field, conditions.IgnoreCase))
                                        {
                                            b = true;
                                            break;
                                        }
                                    }
                                    if (b)
                                    {
                                        return(o);
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                            }

                            if (b && null != conditions.Field)
                            {
                                if (null != o.Fields)
                                {
                                    for (int n = 0, m = o.Fields.Length; n < m; n++)
                                    {
                                        var f = o.Fields[n];
                                        if (0 == string.Compare(f.Name, conditions.Field, conditions.IgnoreCase))
                                        {
                                            b = false;
                                            break;
                                        }
                                    }
                                    if (b)
                                    {
                                        continue;
                                    }
                                }
                            }

                            if (b && null != conditions.Property)
                            {
                                if (null != o.Properties)
                                {
                                    for (int n = 0, m = o.Properties.Length; n < m; n++)
                                    {
                                        var p = o.Fields[n];
                                        if (0 == string.Compare(p.Name, conditions.Field, conditions.IgnoreCase))
                                        {
                                            b = false;
                                            break;
                                        }
                                    }
                                    if (b)
                                    {
                                        continue;
                                    }
                                }
                            }

                            o.AccessTime = DateTime.MinValue;
                            return(o);
                        }

                        return(null);
                    }
                    finally
                    {
                        if (true == purge)
                        {
                            Purge();
                        }
                    }
                }
            }
コード例 #4
0
ファイル: VectorMap.cs プロジェクト: 237rxd/maptiledownloader
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 21JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * get all records based on search condition  in give map layer.
  * @param index the index of given map layer.
  * @param findConditions the search condition.
  * @return a hashtable of all matched record.the key is the mapInfo ID.
  * @
  */
 public Hashtable Search(int index, FindConditions findConditions)
 {
     if (_geoSet != null)
     {
         return _geoSet.Search(index, findConditions);
     }
     return null;
 }
コード例 #5
0
ファイル: GeoSet.cs プロジェクト: 237rxd/maptiledownloader
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21JUN2009  James Shen                 	          Initial Creation
        ////////////////////////////////////////////////////////////////////////////
        /**
         * get all records based on search condition  in give map layer.
         * @param index the index of given map layer.
         * @param findConditions the search condition.
         * @return a hashtable of all matched record.the key is the mapInfo ID.
         * @
         */
        public Hashtable Search(int index, FindConditions findConditions)
        {
            lock (_mapFeatureLayers)
            {
                MapFeatureLayer mapLayer = GetMapFeatureLayer(index);
                if (mapLayer != null)
                {
                    return mapLayer.Search(findConditions);
                }

                return null;
            }
        }
コード例 #6
0
ファイル: GeoSet.cs プロジェクト: 237rxd/maptiledownloader
 ////////////////////////////////////////////////////////////////////////////
 //--------------------------------- REVISIONS ------------------------------
 // Date       Name                 Tracking #         Description
 // ---------  -------------------  -------------      ----------------------
 // 21JUN2009  James Shen                 	          Initial Creation
 ////////////////////////////////////////////////////////////////////////////
 /**
  * get all records based on given string. the seach will search based on
  * map layer's key field.
  * @param matchString
  * @return a hashtable array Contains of all matched record.
  *  the key is the mapInfo ID. the value is the matched string.
  * @
  */
 public Hashtable[] Search(string matchString)
 {
     lock (_mapFeatureLayers)
     {
         Hashtable[] retTable = new Hashtable[_mapFeatureLayers.Count];
         for (int i = 0; i < _mapFeatureLayers.Count; i++)
         {
             MapFeatureLayer mapLayer = (MapFeatureLayer)_mapFeatureLayers[i];
             FindConditions findConditions = new FindConditions();
             findConditions.AddCondition(mapLayer.DataTable.GetFieldIndex(mapLayer.KeyField.GetName()), matchString);
             retTable[i] = mapLayer.Search(findConditions);
         }
         return retTable;
     }
 }
コード例 #7
0
        ////////////////////////////////////////////////////////////////////////////
        //--------------------------------- REVISIONS ------------------------------
        // Date       Name                 Tracking #         Description
        // ---------  -------------------  -------------      ----------------------
        // 21JUN2009  James Shen                              Initial Creation
        ////////////////////////////////////////////////////////////////////////////

        /**
         * get all records based on search condition.
         * @param findConditions the search condition.
         * @return a hashtable of all matched record.the key is the mapInfo ID.
         */
        public Hashtable Search(FindConditions findConditions)
        {
            Hashtable retTable     = new Hashtable();
            ArrayList allCondition = findConditions.GetConditions();

            for (int i = 0; i < allCondition.Count; i++)
            {
                FindCondition findCondition = (FindCondition)allCondition[i];
                int           stringID      = BinarySearch(findCondition.MatchString);
                int           fieldIndex    = findCondition.FieldIndex;
                if (stringID != -1)
                {
                    bool bDone = false;
                    _stringIndex.GetRecord(stringID);
                    string strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                    while (strValue.StartsWith(findCondition.MatchString) && (!bDone))
                    {
                        int fieldCount = _stringData.FieldCount;
                        for (int j = 0; j < fieldCount; j++)
                        {
                            if (_stringData.FieldID[j] == fieldIndex)
                            {
                                int mapInfoID = _stringData.MapInfoID[j];
                                if (!retTable.ContainsKey(mapInfoID))
                                {
                                    retTable.Add(mapInfoID,
                                                 strValue);
                                }
                                if (retTable.Count > FindConditions.MaxMatchRecord)
                                {
                                    return(retTable);
                                }
                            }
                        }
                        bDone = _stringIndex.MovePrevious();
                        if (!bDone)
                        {
                            strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                        }
                    }
                    bDone = false;
                    _stringIndex.GetRecord(stringID);
                    strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                    while (strValue.StartsWith(findCondition.MatchString) && (!bDone))
                    {
                        int fieldCount = _stringData.FieldCount;
                        for (int j = 0; j < fieldCount; j++)
                        {
                            if (_stringData.FieldID[j] == fieldIndex)
                            {
                                int mapInfoID = _stringData.MapInfoID[j];
                                if (!retTable.ContainsKey(mapInfoID))
                                {
                                    retTable.Add(mapInfoID,
                                                 strValue);
                                }
                                if (retTable.Count > FindConditions.MaxMatchRecord)
                                {
                                    return(retTable);
                                }
                            }
                        }
                        bDone = _stringIndex.MoveNext();
                        if (!bDone)
                        {
                            strValue = _stringData.GetMapInfoIDAndField(_stringIndex.RecordOffset);
                        }
                    }
                }
            }
            return(retTable);
        }