Example #1
0
        internal static void CopyAnnotations(AnnotatedElementBuilder from, AnnotatedElementBuilder to)
        {
            if (from == null)
            {
                return;
            }
            if (to == null)
            {
                return;
            }
            SoalFactory f = new Symbols.SoalFactory(to.MModel);

            foreach (var annot in from.Annotations)
            {
                AnnotationBuilder toAnnot = f.Annotation();
                toAnnot.Name = annot.Name;
                to.Annotations.Add(toAnnot);
                foreach (var annotProp in annot.Properties)
                {
                    AnnotationPropertyBuilder toAnnotProp = f.AnnotationProperty();
                    toAnnotProp.Name  = annotProp.Name;
                    toAnnotProp.Value = annotProp.Value;
                    toAnnot.Properties.Add(toAnnotProp);
                }
            }
        }
Example #2
0
 internal static void CopyAnnotationProperty(string annotationName, string propertyName, AnnotatedElementBuilder from, string targetAnnotationName, string targetPropertyName, AnnotatedElementBuilder to)
 {
     foreach (var annot in from.Annotations)
     {
         if (annot.Name == annotationName)
         {
             AnnotationPropertyBuilder annotProp = annot.Properties.FirstOrDefault(prop => prop.Name == propertyName);
             if (annotProp != null)
             {
                 to.SetAnnotationPropertyValue(targetAnnotationName, targetPropertyName, annotProp.Value);
             }
         }
     }
 }
Example #3
0
        internal static AnnotationBuilder CloneAnnotation(AnnotationBuilder annot)
        {
            SoalFactory       f       = new Symbols.SoalFactory(annot.MModel);
            AnnotationBuilder toAnnot = f.Annotation();

            toAnnot.Name = annot.Name;
            foreach (var annotProp in annot.Properties)
            {
                AnnotationPropertyBuilder toAnnotProp = f.AnnotationProperty();
                toAnnotProp.Name  = annotProp.Name;
                toAnnotProp.Value = annotProp.Value;
                toAnnot.Properties.Add(toAnnotProp);
            }
            return(toAnnot);
        }