예제 #1
0
        internal static UmlClass CreateObjectClass()
        {
            // objectClass initialization
            string[] objectMethods = {
				"public static bool Equals(object objA, object objB)",
				"public virtual bool Equals(object obj)",
				"public virtual int GetHashCode()",
				"public System.Type GetType()",
				"protected object MemberwiseClone()",
				"public static bool ReferenceEquals(object objA, object objB)",
				"public virtual string ToString()"
			};
            var objectClass = new UmlClass("Object") { Id = Guid.Empty };
            objectClass.AddConstructor();
            foreach (string methodDeclaration in objectMethods)
                objectClass.AddMethod().InitFromString(methodDeclaration);
            return objectClass;
        }
		static UnifiedModelingLanguage()
		{
            objectClass = UmlClass.CreateObjectClass();

			// validAccessModifiers initialization
			validAccessModifiers = new Dictionary<AccessModifier, string>(4);
			validAccessModifiers.Add(AccessModifier.Default, "Default");
			validAccessModifiers.Add(AccessModifier.Public, "Public");
            //validAccessModifiers.Add(AccessModifier.ProtectedInternal, "Protected Internal");
            //validAccessModifiers.Add(AccessModifier.Internal, "Internal");
			validAccessModifiers.Add(AccessModifier.Protected, "Protected");
			validAccessModifiers.Add(AccessModifier.Private, "Private");

			// validClassModifiers initialization
            validClassModifiers = new Dictionary<ClassModifier, string>(4);
            validClassModifiers.Add(ClassModifier.None, "None");
			validClassModifiers.Add(ClassModifier.Abstract, "Abstract");
			validClassModifiers.Add(ClassModifier.Sealed, "Sealed");
			validClassModifiers.Add(ClassModifier.Static, "Static");

			// validFieldModifiers initialization
			validFieldModifiers = new Dictionary<FieldModifier, string>(3);
			validFieldModifiers.Add(FieldModifier.Static, "Static");
			validFieldModifiers.Add(FieldModifier.Readonly, "Readonly");
            //validFieldModifiers.Add(FieldModifier.Constant, "Const");
            //validFieldModifiers.Add(FieldModifier.Hider, "New");
			validFieldModifiers.Add(FieldModifier.Volatile, "Volatile");

			// validOperationModifiers initialization
			validOperationModifiers = new Dictionary<OperationModifier, string>(7);
			validOperationModifiers.Add(OperationModifier.Static, "Static");
            //validOperationModifiers.Add(OperationModifier.Hider, "New");
			validOperationModifiers.Add(OperationModifier.Virtual, "Virtual");
			validOperationModifiers.Add(OperationModifier.Abstract, "Abstract");
			validOperationModifiers.Add(OperationModifier.Override, "Override");
			validOperationModifiers.Add(OperationModifier.Sealed, "Sealed");
			validOperationModifiers.Add(OperationModifier.Sealed | OperationModifier.Override,
				"Sealed Override");
			validOperationModifiers.Add(OperationModifier.Abstract | OperationModifier.Override,
				"Abstract Override");
		}
예제 #3
0
		public override ClassType Clone()
		{
            UmlClass newClass = new UmlClass();
            newClass.CopyFrom(this);
            newClass.Id = Guid.NewGuid();
			return newClass;
		}