public FilteredTweetModel(FilterCluster cluster) { TweetModel.ReceivedStatus += new Action<TwitterStatusBase>(TweetServerModel_ReceivedStatus); TweetModel.RemovedStatus += new Action<long>(TweetServerModel_RemovedStatus); TweetModel.InvalidateAllCache += new Action(TweetModel_InvalidateAllCache); Filter = cluster; }
/// <summary> /// フィルタクラスタを新しいクラスタに結合します。(AND結合) /// </summary> public static FilterCluster Restrict(this FilterCluster original, params FilterCluster[] append) { var cluster = new FilterCluster(); cluster.ConcatenateOR = false; cluster.Filters = new[] { original }.Concat(append).ToArray(); return cluster.Optimize(); }
public QueryEditorViewModel(FilterCluster cluster) { if (cluster == null) this.QueryString = String.Empty; else this.QueryString = cluster.ToQuery(); }
public QueryEditorViewModel(FilterCluster cluster, FilterEditControlViewModel parent) { this.parentViewModel = parent; if (cluster == null) this.QueryString = String.Empty; else this.QueryString = cluster.ToQuery(); }
/// <summary> /// フィルタクラスタにフィルタを結合します。 /// </summary> public static FilterCluster Join(this FilterCluster cluster, FilterBase filter, bool concatOr = true) { var newCluster = new FilterCluster(); if (cluster != null) newCluster.Filters = new IFilter[] { cluster, filter }; else newCluster.Filters = new IFilter[] { filter }; newCluster.ConcatenateOR = concatOr; return newCluster.Optimize(); }
public static FilterCluster GetParent(this IFilter filterObject, FilterCluster root) { if (root.Filters.Contains(filterObject)) { return root; } else { return root.Filters .OfType<FilterCluster>() .Select(f => GetParent(f, root)) .Where(f => f != null) .FirstOrDefault(); } }
private void RevalidateQuery() { if (TextQuery.Length == 0) { // 文字なし InternalFilterCluster = null; return; } bool split = TextQuery.Length >= 2 && TextQuery[1] == ':'; var qt = split ? TextQuery[0] : 't'; var body = split ? TextQuery.Substring(2) : TextQuery; IsQuery = qt == 'q'; switch (qt) { case 'q': // query try { var filter = QueryConverter.ToFilter(body); InternalFilterCluster = filter; QueryException = null; } catch (Exception e) { QueryException = e; } break; case 'u': // user var users = body.Split(new[] { " ", "," }, StringSplitOptions.RemoveEmptyEntries); InternalFilterCluster = new FilterCluster() { ConcatenateOR = true, Filters = users.Select((s) => new Athenaeum.Filter.BasicFilters.User.UserScreenNameFilter() { Argument = s, Method = Athenaeum.Filter.BasicFilters.KeywordFilterBase.MatchMethod.Contains, ConsiderCase = false }) }; break; case 't': default: var texts = body.Split(new[] { "|" }, StringSplitOptions.RemoveEmptyEntries); InternalFilterCluster = new FilterCluster() { ConcatenateOR = true, Filters = texts.Select(t => new FilterCluster() { ConcatenateOR = false, Filters = t.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries) .Select((s) => new Athenaeum.Filter.BasicFilters.Text.TextFilter() { Argument = s, Method = Athenaeum.Filter.BasicFilters.KeywordFilterBase.MatchMethod.Contains, ConsiderCase = false }) }) }; break; } }
public TabData(string name, string[] linkAccounts, FilterCluster cluster) : this(cluster) { this.TabName = name; this.LinkAccounts = LinkAccounts; }
public TabData(FilterCluster cluster) : this() { this.OriginalFilter = cluster; }
public FilterEditControlViewModel(FilterCluster filter) { this.RootFilterCluster = filter; }
public FilterClusterViewModel(FilterEditControlViewModel root, FilterClusterViewModel parent, FilterCluster cluster) : base(root, parent) { if (cluster == null) throw new ArgumentNullException("cluster"); this.cluster = cluster; }
public QueryEditor(FilterCluster cluster) { InitializeComponent(); this.DataContext = new QueryEditorViewModel(cluster); }