private Behavior GetOrAdd( Func <IStat> lazyAffectedStat, NodeType affectNodeType, IBehaviorPathRule affectedPaths, Func <IValue, IValue> valueTransformation, CacheKey cacheKey) { return(GetOrAdd(new LazyStatList(lazyAffectedStat), affectNodeType, affectedPaths, valueTransformation, cacheKey)); }
/* * Rounding: * - Each stat can have different rounding behaviors * - This can affect nodes of all NodeTypes * - Modifies the output of affected nodes by rounding it. * - Affects all paths */ public Behavior(IReadOnlyList<IStat> affectedStats, IReadOnlyList<NodeType> affectedNodeTypes, IBehaviorPathRule affectedPathsRule, IValueTransformation transformation) : base(true) { AffectedStats = affectedStats; AffectedNodeTypes = affectedNodeTypes; AffectedPathsRule = affectedPathsRule; Transformation = transformation; }
private Behavior GetOrAdd( IReadOnlyList <IStat> affectedStats, IReadOnlyList <NodeType> affectNodeTypes, IBehaviorPathRule affectedPathsRule, Func <IValue, IValue> valueTransformation, CacheKey cacheKey) { return(_cache.GetOrAdd(cacheKey, _ => new Behavior(affectedStats, affectNodeTypes, affectedPathsRule, new ValueTransformation(valueTransformation)))); }
public Transformation(IBehaviorPathRule pathRule, IValueTransformation transformation) { _pathRule = pathRule; _transformation = transformation; }
private Behavior GetOrAdd( IReadOnlyList <IStat> affectedStats, NodeType affectNodeType, IBehaviorPathRule affectedPaths, Func <IValue, IValue> valueTransformation, CacheKey cacheKey) { return(GetOrAdd(affectedStats, new[] { affectNodeType }, affectedPaths, valueTransformation, cacheKey)); }
private Behavior GetOrAdd( IStat affectedStat, NodeType affectNodeType, IBehaviorPathRule affectedPaths, Func <IValue, IValue> valueTransformation, CacheKey cacheKey) { return(GetOrAdd(new[] { affectedStat }, affectNodeType, affectedPaths, valueTransformation, cacheKey)); }