Esempio n. 1
0
 protected ParameterScope(ParameterScopeLevel scopeLevel, ParameterScope parentScope)
 {
     ScopeLevel  = scopeLevel;
     ParentScope = parentScope;
     if (parentScope != null)
     {
         parentScope.RegisterChildScope(this);
     }
     ChildScopes = new List <ParameterScope>();
 }
Esempio n. 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));
        }
Esempio n. 3
0
 protected override float EvaluateInner(ParameterScope scope)
 {
     return(DefaultValue);
 }
Esempio n. 4
0
 protected abstract T EvaluateInner(ParameterScope scope);
Esempio n. 5
0
 public void RemoveChild(ParameterScope scope)
 {
     ChildScopes.Remove(scope);
     scope.ParentScope = null;
 }
Esempio n. 6
0
 public void SetParentScope(ParameterScope scope)
 {
     // TECH DEBT - unregister previous parent
     ParentScope = scope;
     scope.RegisterChildScope(this);
 }
Esempio n. 7
0
 public void RegisterChildScope(ParameterScope scope)
 {
     ChildScopes.Add(scope);
 }