コード例 #1
0
ファイル: Main.cs プロジェクト: ancailliau/KAOSTools
 public static Object HandleIdentifier(KAOSMetaModelElement elm)
 {
     if (elm == null){
     return null;
       }
       return elm.GetType().GetProperty("Identifier").GetValue(elm, null);
 }
コード例 #2
0
ファイル: KAOSModel.cs プロジェクト: ancailliau/KAOSTools
        public void Add(KAOSMetaModelElement element)
        {
            var e = element;
            if (e.model != this)
                e = element.Copy ();

            if (e.model == null)
                e.model = this;

            if (this._elements.ContainsKey(e.Identifier))
                throw new InvalidOperationException ("Duplicated ID " + e.Identifier);

            this._elements.Add (e.Identifier, e);
        }
コード例 #3
0
ファイル: Helpers.cs プロジェクト: ancailliau/KAOSTools
        public static KAOSMetaModelElement OverrideKeys(this KAOSMetaModelElement o1, KAOSMetaModelElement o2)
        {
            if (string.IsNullOrEmpty (o1.Identifier))
                o1.Identifier = o2.Identifier;

            if (o1.GetType().GetProperty ("Name") != null
                && o2.GetType().GetProperty ("Name") != null
                && string.IsNullOrEmpty (o1.GetType ().GetProperty ("Name").GetValue (o1, null) as String))
                o1.GetType().GetProperty ("Name").SetValue (o1, o2.GetType().GetProperty ("Name").GetValue (o2, null), null);

            if (o1.GetType().GetProperty ("Signature") != null
                && o2.GetType().GetProperty ("Signature") != null
                && string.IsNullOrEmpty (o1.GetType ().GetProperty ("Signature").GetValue (o1, null) as String))
                o1.GetType().GetProperty ("Signature").SetValue (o1, o2.GetType().GetProperty ("Signature").GetValue (o2, null), null);

            return o1;
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: ancailliau/KAOSTools
 public static bool HasIdentifier(KAOSMetaModelElement elm)
 {
     return elm.GetType().GetProperty("Identifier") != null;
 }
コード例 #5
0
ファイル: KAOSModel.cs プロジェクト: ancailliau/KAOSTools
 public void Remove(KAOSMetaModelElement element)
 {
     if (this._elements.ContainsKey(element.Identifier))
         this._elements.Remove (element.Identifier);
 }