public static PropertyExpressionVisitor Create(Type type, RuntimeConfigurator configurator, NodeSelectorFactory nodeSelectorFactory) { Type visitorType = typeof(PropertyExpressionVisitor <>).MakeGenericType(type); return((PropertyExpressionVisitor)Activator.CreateInstance(visitorType, configurator, nodeSelectorFactory)); }
public static AddFactNode <T, TFact> AddFact <T, TFact>(this RuntimeConfigurator configurator, Func <T, TFact> factFactory) where T : class where TFact : class { return(configurator.CreateNode(id => new AddFactNode <T, TFact>(id, factFactory))); }
public static NodeSelectorFactory Create(RuntimeConfigurator configurator, NodeSelectorFactory factory, PropertyInfo propertyInfo) { Type type = typeof(PropertyNodeSelectorFactory <>).MakeGenericType(propertyInfo.PropertyType); return((NodeSelectorFactory)Activator.CreateInstance(type, configurator, factory, propertyInfo)); }
public static PropertyExpressionVisitor Create(Type type, RuntimeConfigurator configurator, NodeSelectorFactory nodeSelectorFactory) { Type visitorType = typeof(PropertyExpressionVisitor<>).MakeGenericType(type); return (PropertyExpressionVisitor)Activator.CreateInstance(visitorType, configurator, nodeSelectorFactory); }
public static NodeSelectorFactory Create(RuntimeConfigurator configurator, NodeSelectorFactory factory, PropertyInfo propertyInfo) { Type type = typeof(PropertyNodeSelectorFactory<>).MakeGenericType(propertyInfo.PropertyType); return (NodeSelectorFactory)Activator.CreateInstance(type, configurator, factory, propertyInfo); }
public PropertyNodeSelector(NodeSelector next, RuntimeConfigurator configurator, PropertyInfo property) { _next = next; _configurator = configurator; Property = property; }
public JoinNodeLocator(RuntimeConfigurator runtimeConfigurator, MemoryNode <T> left, MemoryNode <T> right) { _configurator = runtimeConfigurator; _left = left; _matchRight = node => MatchNode(node, right); _rightActivation = () => right as RightActivation <T>; }
public static EqualNode <T, TProperty> Equal <T, TProperty>(this RuntimeConfigurator configurator) where T : class { EqualNode <T, TProperty> node = configurator.CreateNode(id => new EqualNode <T, TProperty>(id, configurator)); return(node); }
public NotEqualNodeSelectorFactory(NodeSelectorFactory nextFactory, RuntimeConfigurator configurator, TValue value) { _nextFactory = nextFactory; _value = value; _configurator = configurator; }
public static OuterJoinNode <T1, T2> Outer <T1, T2>(this RuntimeConfigurator configurator, RightActivation <T2> rightActivation) where T1 : class where T2 : class { return(configurator.CreateNode(id => new OuterJoinNode <T1, T2>(id, rightActivation))); }
public LeftJoinNodeLocator(RuntimeConfigurator runtimeConfigurator, MemoryNode <Token <T, TDiscard> > left) { _configurator = runtimeConfigurator; _left = left; _matchRight = MatchConstantNode; _rightActivation = _configurator.Constant <T>; }
public OdoyuleRulesEngine(RuntimeConfigurator configurator) { _initializers = new GenericTypeCache <AlphaNodeInitializer>(typeof(AlphaNodeInitializerImpl <>)); _objectCache = new GenericTypeCache <ActivationTypeProxy>(typeof(ActivationTypeProxyImpl <>)); _types = new GenericTypeCache <Activation>(typeof(AlphaNode <>)); _configurator = configurator; }
public static Activation <T> Property <T, TProperty>(this RuntimeConfigurator configurator, Expression <Func <T, TProperty> > propertyExpression) where T : class { PropertyInfo propertyInfo = propertyExpression.GetPropertyInfo(); return(Property <T, TProperty>(configurator, propertyInfo)); }
public static NotNullNode <T, TProperty> NotNull <T, TProperty>(this RuntimeConfigurator configurator) where T : class where TProperty : class { TokenValueFactory <T, TProperty> tokenValue = Conditionals.Property <T, TProperty>(); return(configurator.CreateNode(id => new NotNullNode <T, TProperty>(id, tokenValue))); }
public static ExistsNode <T, TProperty> Exists <T, TProperty>(this RuntimeConfigurator configurator) where T : class where TProperty : class, IEnumerable { TokenValueFactory <T, TProperty> tokenValue = Conditionals.Property <T, TProperty>(); return(configurator.CreateNode(id => new ExistsNode <T, TProperty>(id, tokenValue))); }
public static PropertyNode <T, TProperty> Property <T, TProperty>( this RuntimeConfigurator configurator, PropertyInfo propertyInfo, Action <T, Action <TProperty> > propertyMatch) where T : class { PropertyNode <T, TProperty> propertyNode = configurator.CreateNode(id => new PropertyNode <T, TProperty>(id, propertyInfo, propertyMatch)); return(propertyNode); }
public static CompareNode <T, TProperty> Compare <T, TProperty>(this RuntimeConfigurator configurator, Comparator <TProperty, TProperty> comparator, TProperty value) where T : class { Value <TProperty> rightValue = Conditionals.Constant(value); return(Compare <T, TProperty>(configurator, comparator, rightValue)); }
public static CompareNode <T, TProperty> LessThanOrEqual <T, TProperty>(this RuntimeConfigurator configurator, TProperty value) where T : class where TProperty : IComparable <TProperty> { var comparator = new LessThanOrEqualValueComparator <TProperty>(); return(Compare <T, TProperty>(configurator, comparator, value)); }
public OuterJoinNodeLocator(RuntimeConfigurator runtimeConfigurator, MemoryNode <T1> left, MemoryNode <T2> right) { _configurator = runtimeConfigurator; _left = left; _right = right; _rightActivation = () => right as RightActivation <T2>; _matchRight = MatchNode; }
public static CompareNode <T, TProperty> GreaterThan <T, TProperty>(this RuntimeConfigurator configurator, TProperty value) where T : class where TProperty : IComparable <TProperty> { var comparator = new GreaterThanValueComparator <TProperty>(); return(Compare <T, TProperty>(configurator, comparator, value)); }
public static CompareNode <T, TProperty> Compare <T, TProperty>(this RuntimeConfigurator configurator, Comparator <TProperty, TProperty> comparator, Value <TProperty> value) where T : class { TokenValueFactory <T, TProperty> tokenValue = Conditionals.Property <T, TProperty>(); return(configurator.CreateNode(id => new CompareNode <T, TProperty>(id, tokenValue, comparator, value))); }
public static EachNode <T, TProperty, TElement> Each <T, TProperty, TElement>( this RuntimeConfigurator configurator, Action <TProperty, Action <TElement, int> > elementMatch) where T : class where TProperty : class, IEnumerable { TokenValueFactory <T, TProperty> tokenValue = Conditionals.Property <T, TProperty>(); return(configurator.CreateNode(id => new EachNode <T, TProperty, TElement>(id, tokenValue, elementMatch))); }
public CompareNodeSelectorFactory(NodeSelectorFactory nextFactory, RuntimeConfigurator configurator, Comparator <TValue, TValue> comparator, Value <TValue> value) { _nextFactory = nextFactory; _value = value; _configurator = configurator; _comparator = comparator; }
public CompareNodeSelector(NodeSelector next, RuntimeConfigurator configurator, Comparator <TProperty, TProperty> comparator, Value <TProperty> value) { _value = value; _next = next; _configurator = configurator; _comparator = comparator; }
public static PropertyNode <T, TProperty, TValue> Property <T, TProperty, TValue>( this RuntimeConfigurator configurator, PropertyInfo propertyInfo, PropertySelector <TProperty, TValue> propertySelector) where T : class { PropertyNode <T, TProperty, TValue> propertyNode = configurator.CreateNode( id => new PropertyNode <T, TProperty, TValue>(id, propertyInfo, propertySelector)); return(propertyNode); }
public RulesEngine Build() { RuntimeConfigurator runtimeConfigurator = _runtimeConfiguratorFactory(); RuleCompiler compiler = new OdoyuleRuleCompiler(runtimeConfigurator); _rules.Each(rule => compiler.Add(rule)); compiler.Compile(); return(runtimeConfigurator.RulesEngine); }
public static PropertyNode <T, TProperty> Property <T, TProperty>( this RuntimeConfigurator configurator, Expression <Func <T, TProperty> > propertyExpression) where T : class { PropertyInfo propertyInfo = propertyExpression.GetPropertyInfo(); PropertyNode <T, TProperty> propertyNode = configurator.CreateNode(id => new PropertyNode <T, TProperty>(id, propertyInfo)); return(propertyNode); }
public static CompareNode <T, TProperty> LessThanOrEqual <T, TProperty>(this RuntimeConfigurator configurator, TProperty value) where T : class where TProperty : IComparable <TProperty> { Value <TProperty> rightValue = Conditional.Constant(value); TokenValueFactory <T, TProperty> tokenValue = Conditional.Property <T, TProperty>(); var comparator = new LessThanOrEqualValueComparator <TProperty>(); return(configurator.CreateNode(id => new CompareNode <T, TProperty>(id, tokenValue, comparator, rightValue))); }
public static Activation <T> Property <T, TProperty>(this RuntimeConfigurator configurator, PropertyInfo propertyInfo) where T : class { PropertySelector propertySelector = configurator.GetPropertySelector(propertyInfo); Type propertyNodeType = typeof(PropertyNode <, ,>) .MakeGenericType(typeof(T), propertySelector.PropertyType, propertySelector.ValueType); return(configurator.CreateNode( id => (Activation <T>)Activator.CreateInstance(propertyNodeType, id, propertyInfo, propertySelector))); }
public RulesEngine Build() { RuntimeConfigurator runtimeConfigurator = _runtimeConfiguratorFactory(); foreach (var configuratorAction in _runtimeConfiguratorActions) { configuratorAction(runtimeConfigurator); } CompileRules(runtimeConfigurator); return(runtimeConfigurator.RulesEngine); }
public static NodeSelector Create(RuntimeConfigurator configurator, Type tokenType, NodeSelectorFactory nextSelectorFactory, object value) { Type[] arguments = tokenType.GetGenericArguments(); if (!arguments[1].IsInstanceOfType(value)) throw new RuntimeConfigurationException("Value type does not match token type: " + value.GetType().GetTypeName()); Type type = typeof(EqualNodeSelector<,>) .MakeGenericType(arguments); var nodeSelector = (NodeSelector)Activator.CreateInstance(type, configurator, nextSelectorFactory, value); return nodeSelector; }
public static NodeSelector Create <T, TProperty>(RuntimeConfigurator configurator, NodeSelectorFactory nextSelectorFactory, PropertyInfo propertyInfo) { PropertySelector propertySelector = configurator.GetPropertySelector(propertyInfo); Type type = typeof(PropertyNodeSelector <, ,>) .MakeGenericType(typeof(T), propertySelector.PropertyType, propertySelector.ValueType); var nodeSelector = (NodeSelector) Activator.CreateInstance(type, configurator, nextSelectorFactory, propertyInfo, propertySelector); return(nodeSelector); }
public static ConditionNode <Token <T1, T2> > Condition <T1, T2>( this RuntimeConfigurator configurator, Predicate <T2> condition) where T1 : class { ConditionNode <Token <T1, T2> > conditionNode = configurator.CreateNode( id => new ConditionNode <Token <T1, T2> >(id, (value, next) => { if (condition(value.Item2)) { next(); } })); return(conditionNode); }
protected PropertyExpressionVisitor(RuntimeConfigurator runtimeConfigurator) { Configurator = runtimeConfigurator; }
void CompileRules(RuntimeConfigurator runtimeConfigurator) { RuleCompiler compiler = new OdoyuleRuleCompiler(runtimeConfigurator); _rules.Each(compiler.Compile); }
public OdoyuleRuleCompiler(RuntimeConfigurator configurator) { _configurator = configurator; }
public OdoyuleRuleCompiler(RuntimeConfigurator configurator) { _configurator = configurator; _rules = new DictionaryCache<string, Rule>(rule => rule.RuleName); }