示例#1
0
 public static Object HandleIdentifier(KAOSMetaModelElement elm)
 {
     if (elm == null){
     return null;
       }
       return elm.GetType().GetProperty("Identifier").GetValue(elm, null);
 }
示例#2
0
        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
        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
 public static bool HasIdentifier(KAOSMetaModelElement elm)
 {
     return elm.GetType().GetProperty("Identifier") != null;
 }
示例#5
0
 public void Remove(KAOSMetaModelElement element)
 {
     if (this._elements.ContainsKey(element.Identifier))
         this._elements.Remove (element.Identifier);
 }