MarketRule
The rule, activating action at market condition occurrence.
Inherits: BaseLogReceiver
Implements: IMarketRule, IDisposable
Constructors
protected MarketRule(TToken token)
marketRule = MarketRule(token)
Initialize MarketRule.
- token
- Token rules.
Properties
public IMarketRuleContainer Container { get; set; }
value = marketRule.Container
marketRule.Container = value
The rules container.
public virtual ISynchronizedCollection<IMarketRule> ExclusiveRules { get; }
value = marketRule.ExclusiveRules
Rules, opposite to given rule. They are deleted automatically at activation of this rule.
public bool IsActive { get; set; }
value = marketRule.IsActive
marketRule.IsActive = value
Is the rule currently activated.
public virtual bool IsSuspended { get; set; }
value = marketRule.IsSuspended
marketRule.IsSuspended = value
Is the rule suspended.
Methods
protected virtual void Activate(TArg arg)
marketRule.Activate(arg)
To activate the rule.
- arg
- The value, which will be sent to processor, registered through Action{.
public MarketRule<TToken, TArg> Activated(Action handler)
result = marketRule.Activated(handler)
To add the processor, which will be called at action activation.
- handler
- The handler.
Returns: Rule.
public MarketRule<TToken, TArg> Activated<TResult>(Action<TResult> handler)
result = marketRule.Activated(handler)
To add the processor, accepting argument from Func{, which will be called at action activation.
- handler
- The handler.
Returns: Rule.
protected virtual bool CanFinish()
result = marketRule.CanFinish()
Can the rule be ended.
Returns: , if rule is not required any more. Otherwise, .
protected override void DisposeManaged()
marketRule.DisposeManaged()
Release resources.
public MarketRule<TToken, TArg> Do(Action<TArg> action)
result = marketRule.Do(action)
To add the action, activated at occurrence of condition.
- action
- Action.
Returns: Rule.
public MarketRule<TToken, TArg> Do(Action<MarketRule<TToken, TArg>, TArg> action)
result = marketRule.Do(action)
To add the action, activated at occurrence of condition.
- action
- Action.
Returns: Rule.
public MarketRule<TToken, TArg> Do(Action action)
result = marketRule.Do(action)
To add the action, activated at occurrence of condition.
- action
- Action.
Returns: Rule.
public MarketRule<TToken, TArg> Do<TResult>(Func<MarketRule<TToken, TArg>, TArg, TResult> action)
result = marketRule.Do(action)
To add the action, returning result, activated at occurrence of condition.
- action
- The action, returning a result.
Returns: Rule.
public MarketRule<TToken, TArg> Do<TResult>(Func<TArg, TResult> action)
result = marketRule.Do(action)
To add the action, returning result, activated at occurrence of condition.
- action
- The action, returning a result.
Returns: Rule.
public MarketRule<TToken, TArg> Do<TResult>(Func<TResult> action)
result = marketRule.Do(action)
To add the action, returning result, activated at occurrence of condition.
- action
- The action, returning a result.
Returns: Rule.
public override string ToString()
result = marketRule.ToString()
Преобразовать к строковому представлению.
Returns: Строковое представление.
public MarketRule<TToken, TArg> Until(Func<bool> canFinish)
result = marketRule.Until(canFinish)
To make the rule periodical (will be called until returns ).
- canFinish
- The criteria for end of periodicity.
Returns: Rule.