상속: IKeyedItem
예제 #1
0
        public ClassMemberDescriptor(ClassDescriptor descriptor, MemberInfo member)
        {
            var property = member as PropertyInfo;
            this.AccessModifier = AccessModifier.Public;

            if (property != null)
            {
                this.MemberType = property.PropertyType;
            }

            var field = member as FieldInfo;

            if (field != null)
            {
                this.MemberType = field.FieldType;
            }

            this.AccessModifier = AccessModifier.GetAccessModifier(member);


            if (this.MemberType == null)
                throw new NPlantException("Member's could not be interpretted as either a property or a field");
            
            _descriptor = descriptor;
            
            this.Name = member.Name;
            this.Key = this.Name;
            _metaModel = ClassDiagramVisitorContext.Current.GetTypeMetaModel(this.MemberType);
            this.IsInherited = member.DeclaringType != descriptor.ReflectedType;
        }
예제 #2
0
        public void AddRelated(ClassDescriptor parent, ClassDescriptor child, ClassDiagramRelationshipTypes relationshipType, int level, string name = null)
        {
            if (! AlreadyRegistered(child))
                _unvisitedRelatedClasses.Enqueue(child);

            var relationship = new ClassDiagramRelationship(name, parent, child, relationshipType);

            if (!_relationships.Contains(relationship))
                _relationships.Add(relationship);
        }
예제 #3
0
        private bool IsBaseClassVisible(ClassDescriptor @class, ClassDiagramVisitorContext context)
        {
            if (_diagram.RootClasses.InnerList.Any(x => x.ReflectedType == @class.ReflectedType.BaseType))
                return true;

            if (context.VisitedRelatedClasses.Any(x => x.ReflectedType == @class.ReflectedType.BaseType))
                return true;

            return false;
        }
        private bool AlreadyRegistered(ClassDescriptor child)
        {
            if(_visitedRelatedClasses.Contains(child))
                return true;

            if (_unvisitedRelatedClasses.Contains(child))
                return true;
            
            if (this.Diagram.RootClasses.InnerList.Contains(child))
                return true;

            return false;
        }
예제 #5
0
        private void AssignToPackage(ClassDescriptor rootClass, Dictionary<string, List<string>> packageMap,
                                     string classDefinition, List<string> unpackaged)
        {
            foreach (var package in _diagram.Packages)
            {
                if (package.IsMatch(rootClass))
                {
                    AppendClassToPackageMap(packageMap, package.Name, classDefinition);
                    return;
                }
            }

            unpackaged.Add(classDefinition);
        }
예제 #6
0
 public ClassWriter(ClassDiagram diagram, ClassDescriptor @class)
 {
     _diagram = diagram;
     this._class = @class;
 }
예제 #7
0
 public ClassWriter(ClassDiagram diagram, ClassDescriptor @class)
 {
     _diagram    = diagram;
     this._class = @class;
 }
예제 #8
0
 protected override void OnRootClassVisited(ClassDescriptor rootClass)
 {
     _classes.Add(rootClass);
 }
예제 #9
0
 private string WriteClassDefinition(ClassDescriptor @class)
 {
     var writer = @class.GetWriter(_diagram);
     return writer.Write(_context);
 }
예제 #10
0
 protected virtual void OnRootClassVisited(ClassDescriptor rootClass)
 {
 }
 protected override void OnRootClassVisited(ClassDescriptor rootClass)
 {
     _classes.Add(rootClass);
 }
예제 #12
0
 public ForMemberDescriptor(ClassDescriptor descriptor, MemberInfo member)
 {
     _descriptor = descriptor;
     _member     = member;
 }
예제 #13
0
 public bool IsMatch(ClassDescriptor classDescriptor)
 {
     return _matcher.Any(matcher => matcher(classDescriptor));
 }