/// <summary> /// Initializes a new instance of a NullFilter. /// </summary> /// <param name="item">The item to check whether or not is null.</param> public NullFilter(IFilterItem item) { if (item == null) { throw new ArgumentNullException("item"); } _item = item; }
/// <summary> /// Initializes a new instance of a OrderFilter. /// </summary> /// <param name="leftHand">The left hand side of the comparison.</param> /// <param name="rightHand">The right hand side of the comparison.</param> protected OrderFilter(IFilterItem leftHand, IFilterItem rightHand) { if (leftHand == null) { throw new ArgumentNullException("leftHand"); } if (rightHand == null) { throw new ArgumentNullException("rightHand"); } _leftHand = leftHand; _rightHand = rightHand; }
/// <summary> /// Initializes a new instance of a InFilter. /// </summary> /// <param name="leftHand">The left hand value that must exist in the list of values.</param> /// <param name="values">The list of values the left hand must exist in.</param> public InFilter(IFilterItem leftHand, IValueProvider values) { if (leftHand == null) { throw new ArgumentNullException("leftHand"); } if (values == null) { throw new ArgumentNullException("values"); } LeftHand = leftHand; Values = values; }
/// <summary> /// Initializes a new insstance of a QuantifierFilter. /// </summary> /// <param name="leftHand">The value being compared to the set of values.</param> /// <param name="quantifier">The quantifier to use to compare the value to the set of values.</param> /// <param name="valueProvider">The source of values.</param> protected QuantifierFilter(IFilterItem leftHand, Quantifier quantifier, IValueProvider valueProvider) { if (leftHand == null) { throw new ArgumentNullException("leftHand"); } if (valueProvider == null) { throw new ArgumentNullException("valueProvider"); } LeftHand = leftHand; Quantifier = quantifier; ValueProvider = valueProvider; }
public void QueryPossibleConnections(SelectionMenu menu, DiagramViewModel diagramViewModel, ConnectorViewModel startConnector, Vector2 mousePosition) { if (startConnector.ConnectorForType == typeof(ElementNode)) { menu.Items.Clear(); var vm = InvertGraphEditor.CurrentDiagramViewModel; var category = new SelectionMenuCategory() { Title = "Connect" }; menu.AddItem(category); menu.AddItem(new SelectionMenuItem("Connect", "Create View Node and Connect to : Element", () => { ViewNode viewNode = new ViewNode(); viewNode.Name = String.Format("{0}View", vm.Title); vm.AddNode(viewNode, vm.LastMouseEvent.LastMousePosition); diagramViewModel.GraphData.AddConnection(startConnector.ConnectorFor.DataObject as IConnectable, viewNode.ElementInputSlot); }), category); ElementNode elementNode = (ElementNode)startConnector.ConnectorFor.InputConnector.DataObject; if (elementNode.BaseNode != null) { ViewNode firstBaseViewNode = diagramViewModel.GraphData.Repository.All <ViewNode>() .FirstOrDefault(graphViewNode => { return(graphViewNode.Element == elementNode.BaseNode); }); if (firstBaseViewNode != null) { menu.AddItem(new SelectionMenuItem("Connect", "Create Inherited View Node and Connect to : Element", () => { ViewNode viewNode = new ViewNode(); viewNode.Name = String.Format("{0}View", vm.Title); vm.AddNode(viewNode, vm.LastMouseEvent.LastMousePosition); diagramViewModel.GraphData.AddConnection(startConnector.ConnectorFor.DataObject as IConnectable, viewNode.ElementInputSlot); diagramViewModel.GraphData.AddConnection(firstBaseViewNode, viewNode); IFilterItem viewNodeFilterItem = diagramViewModel.GraphData.CurrentFilter.FilterItems.First(item => item.Node == viewNode); diagramViewModel.GraphData.CurrentFilter.ShowInFilter(firstBaseViewNode, viewNodeFilterItem.Position - new Vector2(250, 0)); }), category); } } } }
/// <summary> /// Initializes a new instance of a NullFilter. /// </summary> /// <param name="value">The item to check whether is within a range.</param> /// <param name="lowerBound">The smallest value the item can be.</param> /// <param name="upperBound">The largest value the item can be.</param> public BetweenFilter(IFilterItem value, IFilterItem lowerBound, IFilterItem upperBound) { if (value == null) { throw new ArgumentNullException("item"); } if (lowerBound == null) { throw new ArgumentNullException("lowerBound"); } if (upperBound == null) { throw new ArgumentNullException("upperBound"); } _value = value; _lowerBound = lowerBound; _upperBound = upperBound; }
private string EnumerateNodes(IFilterItem parent) { // Init an empty string string content = String.Empty; // Add <li> category name content += "<li class=\"treenode\">"; content += parent.Title; if (parent.Children.Count == 0) { content += "</li>"; } else // If there are children, start a <ul> { content += "<ul>"; } // Loop one past the number of children int numberOfChildren = parent.Children.Count; for (int i = 0; i <= numberOfChildren; i++) { // If this iteration's index points to a child, // call this function recursively if (numberOfChildren > 0 && i < numberOfChildren) { IFilterItem child = parent.Children[i]; content += EnumerateNodes(child); } // If this iteration's index points past the children, end the </ul> if (numberOfChildren > 0 && i == numberOfChildren) { content += "</ul>"; } } // Return the content return(content); }
/// <summary> /// Initializes a new instance of a NotEqualToFilter. /// </summary> /// <param name="leftHand">The left hand item.</param> /// <param name="rightHand">The right hand item.</param> public NotEqualToFilter(IFilterItem leftHand, IFilterItem rightHand) : base(leftHand, rightHand) { }
private IFilter buildOrderFilter(MatchResult result, IFilterItem left, IFilterItem right) { MatchResult equalToResult = result.Matches[SqlGrammar.ComparisonOperator.EqualTo]; if (equalToResult.IsMatch) { return new EqualToFilter(left, right); } MatchResult notEqualToResult = result.Matches[SqlGrammar.ComparisonOperator.NotEqualTo]; if (notEqualToResult.IsMatch) { return new NotEqualToFilter(left, right); } MatchResult lessThanEqualToResult = result.Matches[SqlGrammar.ComparisonOperator.LessThanEqualTo]; if (lessThanEqualToResult.IsMatch) { return new LessThanEqualToFilter(left, right); } MatchResult greaterThanEqualToResult = result.Matches[SqlGrammar.ComparisonOperator.GreaterThanEqualTo]; if (greaterThanEqualToResult.IsMatch) { return new GreaterThanEqualToFilter(left, right); } MatchResult lessThanResult = result.Matches[SqlGrammar.ComparisonOperator.LessThan]; if (lessThanResult.IsMatch) { return new LessThanFilter(left, right); } MatchResult greaterThanResult = result.Matches[SqlGrammar.ComparisonOperator.GreaterThan]; if (greaterThanResult.IsMatch) { return new GreaterThanFilter(left, right); } throw new InvalidOperationException(); }
/// <summary> /// Initializes a new insstance of an NotEqualToQuantifierFilter. /// </summary> /// <param name="leftHand">The value being compared to the set of values.</param> /// <param name="quantifier">The quantifier to use to compare the value to the set of values.</param> /// <param name="valueProvider">The source of values.</param> public NotEqualToQuantifierFilter(IFilterItem leftHand, Quantifier quantifier, IValueProvider valueProvider) : base(leftHand, quantifier, valueProvider) { }
/// <summary> /// Initializes a new insstance of an LessThanQuantifierFilter. /// </summary> /// <param name="leftHand">The value being compared to the set of values.</param> /// <param name="quantifier">The quantifier to use to compare the value to the set of values.</param> /// <param name="valueProvider">The source of values.</param> public LessThanQuantifierFilter(IFilterItem leftHand, Quantifier quantifier, IValueProvider valueProvider) : base(leftHand, quantifier, valueProvider) { }
public void GenerateCatalog(IFilterItem filter) { Filter = filter; GenerateCatalog(); }
/// <summary> /// Add new FilterItem to list. /// </summary> /// <param name="item">FilterItem which will be added.</param> /// <inheritdoc /> public void Add(IFilterItem item) { _filters.Add(item); }
/// <summary> /// Initializes a new insstance of an GreaterThanEqualToQuantifierFilter. /// </summary> /// <param name="leftHand">The value being compared to the set of values.</param> /// <param name="quantifier">The quantifier to use to compare the value to the set of values.</param> /// <param name="valueProvider">The source of values.</param> public GreaterThanEqualToQuantifierFilter(IFilterItem leftHand, Quantifier quantifier, IValueProvider valueProvider) : base(leftHand, quantifier, valueProvider) { }
/// <summary> /// Initializes a new instance of a LikeFilter. /// </summary> /// <param name="leftHand">The left hand item.</param> /// <param name="rightHand">The right hand item.</param> public LikeFilter(IFilterItem leftHand, IFilterItem rightHand) : base(leftHand, rightHand) { }
private IFilter buildQuantifierFilter(MatchResult result, IFilterItem leftHand, Quantifier quantifier, IValueProvider valueProvider) { MatchResult equalToResult = result.Matches[SqlGrammar.ComparisonOperator.EqualTo]; if (equalToResult.IsMatch) { return new EqualToQuantifierFilter(leftHand, quantifier, valueProvider); } MatchResult notEqualToResult = result.Matches[SqlGrammar.ComparisonOperator.NotEqualTo]; if (notEqualToResult.IsMatch) { return new NotEqualToQuantifierFilter(leftHand, quantifier, valueProvider); } MatchResult lessThanEqualToResult = result.Matches[SqlGrammar.ComparisonOperator.LessThanEqualTo]; if (lessThanEqualToResult.IsMatch) { return new LessThanEqualToQuantifierFilter(leftHand, quantifier, valueProvider); } MatchResult greaterThanEqualToResult = result.Matches[SqlGrammar.ComparisonOperator.GreaterThanEqualTo]; if (greaterThanEqualToResult.IsMatch) { return new GreaterThanEqualToQuantifierFilter(leftHand, quantifier, valueProvider); } MatchResult lessThanResult = result.Matches[SqlGrammar.ComparisonOperator.LessThan]; if (lessThanResult.IsMatch) { return new LessThanQuantifierFilter(leftHand, quantifier, valueProvider); } MatchResult greaterThanResult = result.Matches[SqlGrammar.ComparisonOperator.GreaterThan]; if (greaterThanResult.IsMatch) { return new GreaterThanQuantifierFilter(leftHand, quantifier, valueProvider); } throw new InvalidOperationException(); }
/// <summary> /// Initializes a new instance of a GreaterThanEqualToFilter. /// </summary> /// <param name="leftHand">The left hand item.</param> /// <param name="rightHand">The right hand item.</param> public GreaterThanEqualToFilter(IFilterItem leftHand, IFilterItem rightHand) : base(leftHand, rightHand) { }
/// <summary> /// Initializes a new instance of a LessThanFilter. /// </summary> /// <param name="leftHand">The left hand item.</param> /// <param name="rightHand">The right hand item.</param> public LessThanFilter(IFilterItem leftHand, IFilterItem rightHand) : base(leftHand, rightHand) { }