public void Add(string key, T info) { if (list.ContainsKey(key)) { list.Remove(key); } list.Add(key, info); }
public void Remove(Altaxo.Data.DataTable theTable) { if (m_TablesByName.ContainsValue(theTable)) { m_TablesByName.Remove(theTable.Name); theTable.ParentChanged -= new Main.ParentChangedEventHandler(this.EhTableParentChanged); theTable.NameChanged -= new Main.NameChangedEventHandler(this.EhTableNameChanged); theTable.ParentObject = null; } this.SelfChanged(ChangedEventArgs.IfTableRemoved); }
/// <summary> /// Given the 2 maps fills a document for 1 word. /// </summary> private static int Index(System.Collections.IDictionary word2Nums, System.Collections.IDictionary num2Words, System.String g, Document doc) { var keys = (System.Collections.IList)word2Nums[g]; // get list of key#'s var i2 = keys.GetEnumerator(); var already = new System.Collections.SortedList(); // keep them sorted // pass 1: fill up 'already' with all words while (i2.MoveNext()) // for each key# { foreach (var item in ((System.Collections.IList)num2Words[i2.Current]).Cast <object>().Where(item => already.Contains(item) == false)) { already.Add(item, item); } } var num = 0; already.Remove(g); // of course a word is it's own syn var it = already.GetEnumerator(); while (it.MoveNext()) { var cur = (String)it.Key; // don't store things like 'pit bull' -> 'american pit bull' if (!IsDecent(cur)) { continue; } num++; doc.Add(new Field(F_SYN, cur, Field.Store.YES, Field.Index.NO)); } return(num); }
/// <summary> /// 方法:删除相机实体 /// </summary> /// <param name="cam"></param> public void Delete(Camera cam) { if (_list.ContainsKey(cam.ID)) { _list.Remove(cam.ID); } }
public void Delete(InVarObj inVarObj) { if (!_list.ContainsKey(inVarObj.ID)) { _list.Remove(inVarObj.ID); } }
public void Delelet(ProCommon.Communal.SerialPortProperty serialPortProperty) { if (_list.ContainsKey(serialPortProperty.ID)) { _list.Remove(serialPortProperty.ID); } }
public void Delelet(ProCommon.Communal.BoardProperty brdProperty) { if (_list.ContainsKey(brdProperty.ID)) { _list.Remove(brdProperty.ID); } }
public void Delelet(ProCommon.Communal.CameraProperty camProperty) { if (_list.ContainsKey(camProperty.ID)) { _list.Remove(camProperty.ID); } }
public void Delelet(ProCommon.Communal.PlcProperty plcProperty) { if (_list.ContainsKey(plcProperty.ID)) { _list.Remove(plcProperty.ID); } }
public void Delelet(ProCommon.Communal.WebProperty webProperty) { if (_list.ContainsKey(webProperty.ID)) { _list.Remove(webProperty.ID); } }
public void Delelet(ProCommon.Communal.SocketProperty sktProperty) { if (_list.ContainsKey(sktProperty.ID)) { _list.Remove(sktProperty.ID); } }
/// <summary> /// 方法:删除指定控制变量实体 /// </summary> /// <param name="outVarObj"></param> public void Delete(OutVarObj outVarObj) { if (!_list.ContainsKey(outVarObj.ID)) { _list.Remove(outVarObj.ID); } }
public void Delete(ProCommon.Communal.Account acc) { if (_list.ContainsKey(acc.ID)) { _list.Remove(acc.ID); } }
public void Delete(Axis axis) { if (_list.ContainsKey(axis.ID)) { _list.Remove(axis.ID); } }
// make sure the documents returned by the search match the expected list private void MatchHits(Searcher searcher, Sort sort) { // make a query without sorting first ScoreDoc[] hitsByRank = searcher.Search(query, null, 1000).scoreDocs; CheckHits(hitsByRank, "Sort by rank: "); // check for duplicates System.Collections.IDictionary resultMap = new System.Collections.SortedList(); // store hits in TreeMap - TreeMap does not allow duplicates; existing entries are silently overwritten for (int hitid = 0; hitid < hitsByRank.Length; ++hitid) { resultMap[(System.Int32)hitsByRank[hitid].doc] = (System.Int32)hitid; // Value: Hits-Objekt Index } // now make a query using the sort criteria ScoreDoc[] resultSort = searcher.Search(query, null, 1000, sort).scoreDocs; CheckHits(resultSort, "Sort by custom criteria: "); // check for duplicates // besides the sorting both sets of hits must be identical for (int hitid = 0; hitid < resultSort.Length; ++hitid) { System.Int32 idHitDate = (System.Int32)resultSort[hitid].doc; // document ID from sorted search if (!resultMap.Contains(idHitDate)) { Log("ID " + idHitDate + " not found. Possibliy a duplicate."); } Assert.IsTrue(resultMap.Contains(idHitDate)); // same ID must be in the Map from the rank-sorted search // every hit must appear once in both result sets --> remove it from the Map. // At the end the Map must be empty! resultMap.Remove(idHitDate); } if (resultMap.Count == 0) { // log("All hits matched"); } else { Log("Couldn't match " + resultMap.Count + " hits."); } Assert.AreEqual(resultMap.Count, 0); }
public void DeletePage(mcPage Page) { Pages.Remove(Page.Text); Page.Dispose(); }
/// <summary> /// Заполнить объект данных. /// </summary> /// <param name="dobject">Объект данных.</param> /// <param name="values">Значения для заполнения.</param> /// <param name="storageStruct">Метаданные структуры хранения.</param> /// <param name="customizationStruct">Настройка выборки данных.</param> /// <param name="typesByKeys">Служебная структура, увязывающая типы мастеров и их ключи.</param> /// <param name="advCols">Дополнительные колонки.</param> /// <param name="dataObjectCache">Кэш объектов данных.</param> /// <param name="securityManager">Менеджер полномочий.</param> public static void FillRowSetToDataObject(DataObject dobject, object[] values, StorageStructForView storageStruct, LoadingCustomizationStruct customizationStruct, System.Collections.SortedList typesByKeys, AdvansedColumn[] advCols, DataObjectCache dataObjectCache, ISecurityManager securityManager) { Type dobjectType = dobject.GetType(); /* access type */ if (!securityManager.AccessObjectCheck(dobjectType, tTypeAccess.Full, false)) { securityManager.AccessObjectCheck(dobjectType, tTypeAccess.Read, true); } /* access type */ // Заливаем данные в объект данных. int customizationStructViewPropertiesLength = customizationStruct.View.Properties.Length; int advColsLength = advCols.Length; Information.SetPropValueByName(dobject, "__PrimaryKey", values[customizationStructViewPropertiesLength + advColsLength]); // 1. создаем структуру мастеров(свойств-объектов данных). System.Collections.SortedList assList = new System.Collections.SortedList(); int index = customizationStructViewPropertiesLength + 1 + advColsLength; CreateMastersStruct(dobject, values, ref index, 0, storageStruct.sources, assList, typesByKeys, dataObjectCache); assList.Add(storageStruct.sources, new object[] { dobject, 0 }); // 2. заливаем данные. System.Collections.ArrayList properiesValues = new System.Collections.ArrayList(); StringCollection allAdvCols = new StringCollection(); int masterPosition = index; for (int i = 0; i < advColsLength; i++) { object value = values[i + customizationStructViewPropertiesLength]; if (value == DBNull.Value) { value = null; } properiesValues.Add(new[] { advCols[i].Name, value, dobject }); allAdvCols.Add(advCols[i].Name); dobject.DynamicProperties.Add(advCols[i].Name, null); } for (int i = 0; i < customizationStructViewPropertiesLength; i++) { StorageStructForView.PropStorage prop = storageStruct.props[i]; if (Information.IsStoredProperty(dobjectType, prop.Name) || prop.Expression != null) { if (prop.MastersTypes == null) { object[] tmp = (object[])assList[prop.source]; object value; if (customizationStruct.ColumnsOrder != null && customizationStruct.ColumnsOrder.Length >= customizationStructViewPropertiesLength) { value = values[Array.IndexOf(customizationStruct.ColumnsOrder, prop.Name)]; } else { value = values[i]; } if (value == DBNull.Value) { value = null; } if (tmp != null) { properiesValues.Add( new[] { prop.simpleName, value, tmp[0] }); } } else { object[] tmp = (object[])assList[prop.source]; if (tmp != null) { // Ищем позицию. int tmp1 = (int)tmp[1]; int curMasterPosition = masterPosition; for (int j = 0; j < tmp1; j++) { curMasterPosition += prop.MastersTypes[j].Length; } int k = 0; object value = values[curMasterPosition]; if (value == DBNull.Value) { value = null; } while (k < prop.MastersTypes[tmp1].Length - 1 && value == null) { k++; value = values[curMasterPosition + k]; if (value == DBNull.Value) { value = null; } } object tmp0 = tmp[0]; if (value != null) { if (Information.GetPropValueByName((DataObject)tmp0, prop.simpleName) == null) { DataObject no = dataObjectCache.CreateDataObject(prop.MastersTypes[tmp1][k], value); if (no.GetStatus(false) == ObjectStatus.Created) { no.SetStatus(ObjectStatus.UnAltered); no.SetLoadingState(LoadingState.LightLoaded); no.InitDataCopy(dataObjectCache); } value = no; properiesValues.Add(new[] { prop.simpleName, value, tmp0 }); } else { // changed by fat properiesValues.Add(new[] { prop.simpleName, Information.GetPropValueByName((DataObject)tmp0, prop.simpleName), tmp0 }); } } else { properiesValues.Add(new[] { prop.simpleName, null, tmp0 }); } } masterPosition += prop.MastersTypesCount; } } } // 2.2 Записываем в объекты. System.Collections.SortedList curObjProperiesValues = new System.Collections.SortedList(); while (properiesValues.Count > 0) { // a. Выбираем для текущего объекта все свойства. object[] tmp = (object[])properiesValues[0]; DataObject curobj = (DataObject)tmp[2]; dobjectType = curobj.GetType(); curObjProperiesValues.Clear(); List <string> loadedPropsColl = curobj.GetLoadedPropertiesList(); for (int i = properiesValues.Count - 1; i >= 0; i--) { tmp = (object[])properiesValues[i]; if (tmp[2] == curobj) { object tmp0 = tmp[0]; if (!curObjProperiesValues.ContainsKey(tmp0)) { curObjProperiesValues.Add(tmp0, tmp[1]); if (!loadedPropsColl.Contains((string)tmp0)) { loadedPropsColl.Add((string)tmp0); } } properiesValues.RemoveAt(i); } } // b. Раскидываем согласно LoadOrder; string[] loadOrder = Information.GetLoadingOrder(dobjectType); int loadOrderLength = loadOrder.Length; for (int i = 0; i < loadOrderLength; i++) { string propName = loadOrder[i]; if (curObjProperiesValues.ContainsKey(propName)) { Information.SetPropValueByName(curobj, propName, curObjProperiesValues[propName]); curObjProperiesValues.Remove(propName); } } int curObjPropertiesValuesCount = curObjProperiesValues.Count; for (int i = 0; i < curObjPropertiesValuesCount; i++) { Information.SetPropValueByName(curobj, (string)curObjProperiesValues.GetKey(i), curObjProperiesValues.GetByIndex(i)); } if (loadedPropsColl.Count >= Information.GetAllPropertyNames(dobjectType).Length) { curobj.SetLoadingState(LoadingState.Loaded); } else { curobj.SetLoadingState(LoadingState.LightLoaded); curobj.AddLoadedProperties(loadedPropsColl); } curobj.SetStatus(ObjectStatus.UnAltered); } }
// make sure the documents returned by the search match the expected list private void MatchHits(Searcher searcher, Sort sort) { // make a query without sorting first ScoreDoc[] hitsByRank = searcher.Search(query, null, 1000).ScoreDocs; CheckHits(hitsByRank, "Sort by rank: "); // check for duplicates System.Collections.IDictionary resultMap = new System.Collections.SortedList(); // store hits in TreeMap - TreeMap does not allow duplicates; existing entries are silently overwritten for (int hitid = 0; hitid < hitsByRank.Length; ++hitid) { resultMap[hitsByRank[hitid].Doc] = hitid; // Value: Hits-Objekt Index } // now make a query using the sort criteria ScoreDoc[] resultSort = searcher.Search(query, null, 1000, sort).ScoreDocs; CheckHits(resultSort, "Sort by custom criteria: "); // check for duplicates // besides the sorting both sets of hits must be identical for (int hitid = 0; hitid < resultSort.Length; ++hitid) { System.Int32 idHitDate = (System.Int32) resultSort[hitid].Doc; // document ID from sorted search if (!resultMap.Contains(idHitDate)) { Log("ID " + idHitDate + " not found. Possibliy a duplicate."); } Assert.IsTrue(resultMap.Contains(idHitDate)); // same ID must be in the Map from the rank-sorted search // every hit must appear once in both result sets --> remove it from the Map. // At the end the Map must be empty! resultMap.Remove(idHitDate); } if (resultMap.Count == 0) { // log("All hits matched"); } else { Log("Couldn't match " + resultMap.Count + " hits."); } Assert.AreEqual(resultMap.Count, 0); }
/// <summary> /// Given the 2 maps fills a document for 1 word. /// </summary> private static int Index(System.Collections.IDictionary word2Nums, System.Collections.IDictionary num2Words, System.String g, Document doc) { var keys = (System.Collections.IList) word2Nums[g]; // get list of key#'s var i2 = keys.GetEnumerator(); var already = new System.Collections.SortedList(); // keep them sorted // pass 1: fill up 'already' with all words while (i2.MoveNext()) // for each key# { foreach (var item in ((System.Collections.IList) num2Words[i2.Current]).Cast<object>().Where(item => already.Contains(item) == false)) { already.Add(item, item); } } var num = 0; already.Remove(g); // of course a word is it's own syn var it = already.GetEnumerator(); while (it.MoveNext()) { var cur = (String) it.Key; // don't store things like 'pit bull' -> 'american pit bull' if (!IsDecent(cur)) { continue; } num++; doc.Add(new Field(F_SYN, cur, Field.Store.YES, Field.Index.NO)); } return num; }