//////////////////////////////////////////////////////////////////////////// //--------------------------------- 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; }
//////////////////////////////////////////////////////////////////////////// //--------------------------------- 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); }