Example #1
0
        public StarWithAllState GetStar(StarExtrinsicState extrinsicState)
        {
            // TODO: this function is having a problem I don't know where
            string resourceName = string.Format(ResourceNamePattern, extrinsicState.StarType);

            StarWithIntrinsicState starWithIntrinsicState;

            if (_sharedStars.ContainsKey(extrinsicState.StarType))
            {
                starWithIntrinsicState = _sharedStars[extrinsicState.StarType];
            }
            else
            {
                starWithIntrinsicState = new StarWithIntrinsicState();
                starWithIntrinsicState.LoadFromResource(resourceName, ReferenceType);
                _sharedStars.Add(extrinsicState.StarType, starWithIntrinsicState);
            }

            return(new StarWithAllState(starWithIntrinsicState, extrinsicState));
        }
Example #2
0
 internal StarWithAllState(StarWithIntrinsicState sharedPart, StarExtrinsicState nonsharedPart)
 {
     IntrinsicState = sharedPart;               // From a decorator perspective, this is the decorated object
     ExtrinsicState = nonsharedPart;            // From a decorator perspective, this is the added feature or
                                                // capability that this object (a decorator) is adding
 }