public ClassDiagramWithAllState GetTree(ClassDiagramExtrinsicState extrinsicState) { ClassDiagramWithIntrinsicState treeWithIntrinsicState; if (_sharedTrees.ContainsKey(extrinsicState.TreeType)) { treeWithIntrinsicState = _sharedTrees[extrinsicState.TreeType]; } else { treeWithIntrinsicState = new ClassDiagramWithIntrinsicState(); string resourceName = string.Format(ResourceNamePattern, extrinsicState.TreeType); treeWithIntrinsicState.LoadFromResource(resourceName, ReferenceType); _sharedTrees.Add(extrinsicState.TreeType, treeWithIntrinsicState); } return(new ClassDiagramWithAllState(treeWithIntrinsicState, extrinsicState)); }
internal ClassDiagramWithAllState(ClassDiagramWithIntrinsicState sharedPart, ClassDiagramExtrinsicState 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 }