예제 #1
0
 protected ParameterScope(ParameterScopeLevel scopeLevel, ParameterScope parentScope)
 {
     ScopeLevel  = scopeLevel;
     ParentScope = parentScope;
     if (parentScope != null)
     {
         parentScope.RegisterChildScope(this);
     }
     ChildScopes = new List <ParameterScope>();
 }
예제 #2
0
        public T Evaluate(ParameterScope scope)
        {
            var newScope = scope;

            // if we haven't been given the right scope, look for it at a higher level
            if (scope.ScopeLevel != scopeLevel)
            {
                newScope = scope.GetHigherScope(scopeLevel);
            }
            if (newScope == null)
            {
                throw new Exception($"Could not find scope at level {scopeLevel}. Object passed was at level {scope.ScopeLevel}.");
            }

            return(EvaluateInner(newScope));
        }
예제 #3
0
 protected override float EvaluateInner(ParameterScope scope)
 {
     return(DefaultValue);
 }
예제 #4
0
 protected abstract T EvaluateInner(ParameterScope scope);
예제 #5
0
 public void RemoveChild(ParameterScope scope)
 {
     ChildScopes.Remove(scope);
     scope.ParentScope = null;
 }
예제 #6
0
 public void SetParentScope(ParameterScope scope)
 {
     // TECH DEBT - unregister previous parent
     ParentScope = scope;
     scope.RegisterChildScope(this);
 }
예제 #7
0
 public void RegisterChildScope(ParameterScope scope)
 {
     ChildScopes.Add(scope);
 }