Ejemplo n.º 1
0
 public HashSet <string> GetPool(string pool)
 {
     if (!HasPool(pool))
     {
         throw InvalidAspectException.FromPool(pool);
     }
     return(new HashSet <string>(_pools[pool]));
 }
Ejemplo n.º 2
0
        public int GetAffinity(string aspect)
        {
            // validate the aspect
            if (!_aspectGlossary.Contains(aspect))
            {
                throw InvalidAspectException.FromAspect(aspect);
            }

            if (_affinities.ContainsKey(aspect))
            {
                return(_affinities[aspect]);
            }

            // If an aspect is not represented, we consider it to have an affinity
            // of 0, i.e. no positive or negative relation.
            return(0);
        }
Ejemplo n.º 3
0
        public void SetAffinity(string aspect, int val)
        {
            // validate the aspect
            if (!_aspectGlossary.Contains(aspect))
            {
                throw InvalidAspectException.FromAspect(aspect);
            }

            // bound the affinity value
            int boundedVal = val;

            if (val > MaxAffinity)
            {
                boundedVal = MaxAffinity;
            }
            else if (val < MinAffinity)
            {
                boundedVal = MinAffinity;
            }

            // TODO: handle opposed and related aspects, etc.

            _affinities[aspect] = boundedVal;
        }