public void Setup() { _called = null; var configurator = new RuntimeConfiguratorImpl(); var productionNode = new DelegateProductionNode <A>(16, (session, x) => _called = x); var constantNode = new ConstantNode <A>(42); var joinNode = configurator.CreateNode(id => new JoinNode <A>(id, constantNode)); var constantNode2 = new ConstantNode <A>(27); var joinNode2 = configurator.CreateNode(id => new JoinNode <A>(id, constantNode2)); joinNode2.AddActivation(productionNode); joinNode.AddActivation(joinNode2); var engine = new OdoyuleRulesEngine(configurator); AlphaNode <A> alphaNode = engine.GetAlphaNode <A>(); alphaNode.AddActivation(joinNode); using (StatefulSession session = engine.CreateSession()) { session.Add(new A()); session.Run(); } }
public override bool Visit <T>(DelegateConsequence <T> consequence, Func <SemanticModelVisitor, bool> next) { _conditionCompiler.MatchJoinNode <T>(joinNode => { DelegateProductionNode <T> node = _configurator.Delegate(consequence.Callback); joinNode.AddActivation(node); }); return(base.Visit(consequence, next)); }
public override bool Visit <T>(DelegateProductionNode <T> node, Func <RuntimeVisitor, bool> next) { _current = _vertices.Get(node.Id, id => new Vertex(typeof(DelegateProductionNode <>), typeof(T), typeof(T).Tokens())); if (_stack.Count > 0) { _edges.Add(new Edge(_stack.Peek(), _current, _current.TargetType.Name)); } return(Next(() => base.Visit(node, next))); }
public void Setup() { _called = null; var configurator = new RuntimeConfiguratorImpl(); var engine = configurator.RulesEngine; PropertyNode <A, decimal> propertyNode = configurator.Property <A, decimal>(x => x.Amount); ConditionNode <Token <A, decimal> > conditionNode = configurator.Condition <A, decimal>(x => x > 10000.0m); propertyNode.AddActivation(conditionNode); AlphaNode <Token <A, decimal> > edgeAlpha = configurator.Alpha <A, decimal>(); conditionNode.AddActivation(edgeAlpha); AlphaNode <A> alphaNode = configurator.GetAlphaNode <A>(); alphaNode.AddActivation(propertyNode); JoinNode <A> joinNode = configurator.Join(alphaNode); DelegateProductionNode <A> productionNode = configurator.Delegate <A>((session, x) => _called = x); joinNode.AddActivation(productionNode); LeftJoinNode <A, decimal> leftNode = configurator.Left <A, decimal>(alphaNode); leftNode.AddActivation(joinNode); edgeAlpha.AddActivation(leftNode); using (StatefulSession session = engine.CreateSession()) { session.Add(new A(10001.0m)); session.Run(); } }
public void Setup() { _called = null; var productionNode = new DelegateProductionNode<A>(16, (session,x) => _called = x); var constantNode = new ConstantNode<A>(42); var joinNode = new JoinNode<A>(69, constantNode); joinNode.AddActivation(productionNode); var engine = new OdoyuleRulesEngine(new OdoyuleRuntimeConfigurator()); AlphaNode<A> alphaNode = engine.GetAlphaNode<A>(); alphaNode.AddActivation(joinNode); using (Session session = engine.CreateSession()) { session.Add(new A()); session.Run(); } }
public void Setup() { _called = null; var configurator = new OdoyuleRuntimeConfigurator(); var productionNode = new DelegateProductionNode <Tuple <A, B> >(16, (session, x) => _called = x); var constantNode = new ConstantNode <A>(42); JoinNode <A> joinNodeA = configurator.CreateNode(id => new JoinNode <A>(id, constantNode)); var constantNode2 = new ConstantNode <B>(27); JoinNode <B> joinNodeB = configurator.CreateNode(id => new JoinNode <B>(id, constantNode2)); OuterJoinNode <A, B> outerJoinNode = configurator.CreateNode(id => new OuterJoinNode <A, B>(id, joinNodeB)); outerJoinNode.AddActivation(productionNode); joinNodeA.AddActivation(outerJoinNode); var engine = new OdoyuleRulesEngine(configurator); AlphaNode <A> alphaNode = engine.GetAlphaNode <A>(); alphaNode.AddActivation(joinNodeA); AlphaNode <B> alphaNodeB = engine.GetAlphaNode <B>(); alphaNodeB.AddActivation(joinNodeB); using (Session session = engine.CreateSession()) { session.Add(new A()); session.Add(new B()); session.Run(); } }
public void Setup() { _called = null; var configurator = new OdoyuleRuntimeConfigurator(); var productionNode = new DelegateProductionNode<Tuple<A,B>>(16, (session, x) => _called = x); var constantNode = new ConstantNode<A>(42); JoinNode<A> joinNodeA = configurator.CreateNode(id => new JoinNode<A>(id, constantNode)); var constantNode2 = new ConstantNode<B>(27); JoinNode<B> joinNodeB = configurator.CreateNode(id => new JoinNode<B>(id, constantNode2)); OuterJoinNode<A, B> outerJoinNode = configurator.CreateNode(id => new OuterJoinNode<A, B>(id, joinNodeB)); outerJoinNode.AddActivation(productionNode); joinNodeA.AddActivation(outerJoinNode); var engine = new OdoyuleRulesEngine(configurator); AlphaNode<A> alphaNode = engine.GetAlphaNode<A>(); alphaNode.AddActivation(joinNodeA); AlphaNode<B> alphaNodeB = engine.GetAlphaNode<B>(); alphaNodeB.AddActivation(joinNodeB); using (Session session = engine.CreateSession()) { session.Add(new A()); session.Add(new B()); session.Run(); } }
public void Setup() { _called = null; var productionNode = new DelegateProductionNode <A>(16, (session, x) => _called = x); var constantNode = new ConstantNode <A>(42); var joinNode = new JoinNode <A>(69, constantNode); joinNode.AddActivation(productionNode); var engine = new OdoyuleRulesEngine(new OdoyuleRuntimeConfigurator()); AlphaNode <A> alphaNode = engine.GetAlphaNode <A>(); alphaNode.AddActivation(joinNode); using (Session session = engine.CreateSession()) { session.Add(new A()); session.Run(); } }
public override bool Visit <T>(DelegateProductionNode <T> node, Func <RuntimeVisitor, bool> next) { Append("DelegateProductionNode[{0}]", Tokens <T>()); return(Indent(next)); }
public void Setup() { _called = null; var configurator = new RuntimeConfiguratorImpl(); var productionNode = new DelegateProductionNode<A>(16, (session,x) => _called = x); var constantNode = new ConstantNode<A>(42); var joinNode = configurator.CreateNode(id => new JoinNode<A>(id, constantNode)); var constantNode2 = new ConstantNode<A>(27); var joinNode2 = configurator.CreateNode(id => new JoinNode<A>(id, constantNode2)); joinNode2.AddActivation(productionNode); joinNode.AddActivation(joinNode2); var engine = new OdoyuleRulesEngine(configurator); AlphaNode<A> alphaNode = engine.GetAlphaNode<A>(); alphaNode.AddActivation(joinNode); using (StatefulSession session = engine.CreateSession()) { session.Add(new A()); session.Run(); } }
public virtual bool Visit <T>(DelegateProductionNode <T> node, Func <RuntimeVisitor, bool> next) where T : class { return(next(this)); }