public IEnumerable <T2> Each(QListSort sort = QListSort.Unspecified) { foreach (double key in GetEnumerator(sort)) { yield return(valueBySort[key]); } }
public IEnumerable <T1> GetEnumerator(T1[] keys = null, QListSort sort = QListSort.Unspecified) { if (sort == QListSort.Unspecified) { sort = this.sortMode; } if (sort == QListSort.None) { foreach (T1 key in items.Keys) { if (keys == null || keys.Contains(key)) { yield return(key); } } } else { foreach (double i in sort == QListSort.Descending ? sortedKeys.Keys.Reverse() : sortedKeys.Keys) { T1 key = sortedKeys[i]; if (keys == null || keys.Contains(key)) { yield return(key); } } } }
IEnumerable <double> GetEnumerator(QListSort sort = QListSort.Unspecified) { if (sort == QListSort.Unspecified) { sort = sortMode; } return((sort == QListSort.Descending) ? valueBySort.Keys.Reverse() : valueBySort.Keys); }
public IEnumerable <T2> Each(T1 key, QListSort sort = QListSort.Unspecified) { if (ContainsKey(key)) { foreach (T2 val in items[key].Each(sort)) { yield return(val); } } }
public T1 FindFirstKeyWithValue(T2 val, T1 def, QListSort sort = QListSort.Unspecified) { foreach (T1 key in GetEnumerator(null, sort)) { if (items[key].Contains(val)) { return(key); } } return(def); // throw new Exception(); // key must exist or else we need to add a default value to the parameter list null is not an opton }
public IEnumerable <T2> Each(T1[] keys, QListSort sort = QListSort.Unspecified, QListSort valSort = QListSort.Unspecified) { if (valSort == QListSort.Unspecified) { valSort = sort; } foreach (T1 key in GetEnumerator(keys, sort)) { foreach (T2 item in items[key].Each(valSort)) { yield return(item); } } }
T1 GetKeyByIndex(int i) { QListSort sort = this.sortMode; if (sort == QListSort.None) { return(items.Keys.ToList()[i]); } else if (sort == QListSort.Ascending) { return(sortedKeys[i]); } else { return(sortedKeys[sortedKeys.ElementAt(Count - (1 + i)).Key]); } }
/* * bool TableHasActiveOrStickyColumns(DbTable table) * { * if (Parser.activeTablesWithColumns.Contains(table)) * return true; * if (table.HasBookmarkedColumns()) * return true; * return false; * * } */ public void UpdateObjects(bool clear) { bool all = Name.Contains("all"); updating = true; BeginUpdate(); if (clear) { nodesByObjectName.Clear(); Nodes.Clear(); } QListSort sort = S.Get("recentObjectsAtTop", false) ? QListSort.Descending : QListSort.None; foreach (DbTable table in A.db.tables.Each(sort)) { if (search != "") { bool matchingColumnExists = false; if (searchColumns) { foreach (string columnName in table.columns.Keys) { if (columnName.StartsWith(search)) { matchingColumnExists = true; break; } } } if (matchingColumnExists == false) { if (searchTables == false || table.name.StartsWith(search) == false) { continue; } } } bool tableIsActive = table.active; bool tableIsSticky = table.bookmarked; bool tableIsShowAllColumns = table.showAllColumns; bool showColumnsAnyways = !table.HasBookmarkedOrActiveColumns(); if (all || tableIsActive || tableIsSticky) { TreeNode tableNode = CreateOrUpdateTableTreeNode(table, tableIsActive, tableIsSticky); foreach (string columnName in table.columns.Keys) { DbColumn column = table.columns[columnName]; if ((search == "") || (searchColumns == false) || columnName.StartsWith(search)) { bool columnIsActive = column.active; bool columnIsSticky = column.bookmarked; if (all || tableIsShowAllColumns || columnIsActive || columnIsSticky || showColumnsAnyways) { CreateOrUpdateColumnTreeNode(tableNode, table, column, columnIsActive, columnIsSticky); } } } if (search != "" && searchColumns) { tableNode.Expand(); } else if (!ExpandNodeBySettings(table, tableNode)) { if (all == false && tableIsShowAllColumns) { tableNode.Expand(); } else if (expandByDefault) { tableNode.Expand(); } } } } EndUpdate(); updating = false; }
public QList(QListSort sortMode = QListSort.None) { this.sortMode = sortMode; }
public QDict(QListSort sortMode = QListSort.None, QListSort valueSortMode = QListSort.None) { this.sortMode = sortMode; this.valueSortMode = valueSortMode; }