private static BasicFilterBase Clone(this BasicFilterGroup group) { var result = new BasicFilterGroup(group.Operator); foreach (var node in group.Nodes) { result.Nodes.Add(Clone(node)); } return(result); }
public BaseCriteria Convert(BasicFilterGroup group) { if (group == null) { throw new ArgumentNullException("group"); } if (group.Nodes.IsEmptyOrNull()) { throw new ArgumentNullException("group.Nodes"); } var result = Criteria.Empty; foreach (var node in group.Nodes) { var sub = Convert(node); if (group.Operator == LogicalOp.And || group.Operator == LogicalOp.NotAnd) { result &= sub; } else { result |= sub; } } result = ~(result); if (group.Operator == LogicalOp.NotOr || group.Operator == LogicalOp.NotAnd) { result = ~(!result); } return(result); }