/// <summary> /// 添加数值主键 /// </summary> /// <param name="num">数值</param> /// <param name="newRow">数据行</param> private FCDataRow addKey(double num) { if (m_keys.size() == 0 || num > m_keys.get(m_keys.size() - 1)) { m_keys.push_back(num); FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep); m_rows.push_back(newRow); return(newRow); } else { int begin = 0; int end = m_keys.size() - 1; int sub = end - begin; while (sub > 1) { int half = begin + sub / 2; double hf = m_keys.get(half); if (hf > num) { end = half; } else if (hf < num) { begin = half; } sub = end - begin; } if (num < m_keys.get(begin)) { m_keys.insert(begin, num); FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep); m_rows.insert(begin, newRow); return(newRow); } else if (num > m_keys.get(end)) { m_keys.insert(end + 1, num); FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep); m_rows.insert(end + 1, newRow); return(newRow); } else { m_keys.insert(begin + 1, num); FCDataRow newRow = new FCDataRow(m_colsCapacity, m_colsStep); m_rows.insert(begin + 1, newRow); return(newRow); } } }
public static CList <Security> FilterCode(String text) { CList <Security> securities = new CList <Security>(); foreach (Security gSecurity in SecurityService.m_codedMap.Values) { if (gSecurity.m_name != null) { if (text.Length == 0) { securities.push_back(gSecurity); } else { if (gSecurity.m_code.ToUpper().IndexOf(text) == 0 || gSecurity.m_name.ToUpper().IndexOf(text) == 0 || gSecurity.m_pingyin.ToUpper().IndexOf(text) == 0) { securities.push_back(gSecurity); } } } } return(securities); }
/// <summary> /// 添加列 /// </summary> /// <param name="colName">列名</param> public virtual void addColumn(int colName) { int[] column = new int[] { colName, m_columns.size() }; if (m_columns.size() == 0) { m_columns.push_back(column); } else { int begin = 0; int end = m_columns.size() - 1; int sub = end - begin; while (sub > 1) { int half = begin + sub / 2; int hf = m_columns.get(half)[0]; if (hf > colName) { end = half; } else if (hf < colName) { begin = half; } sub = end - begin; } if (colName < m_columns.get(begin)[0]) { m_columns.insert(begin, column); fillEmpty(); return; } else if (colName > m_columns.get(end)[0]) { m_columns.insert(end + 1, column); fillEmpty(); return; } else { m_columns.insert(begin + 1, column); fillEmpty(); return; } } }