示例#1
0
        public static object GetAnnotationPropertyValue(this AnnotatedElement annotatedElement, string annotationName, string propertyName)
        {
            var annot = annotatedElement.Annotations.FirstOrDefault(a => a.Name == annotationName);

            if (annot != null)
            {
                return(annot.GetPropertyValue(propertyName));
            }
            return(null);
        }
示例#2
0
        public static bool HasAnnotationProperty(this AnnotatedElement annotatedElement, string annotationName, string propertyName)
        {
            var annot = annotatedElement.Annotations.FirstOrDefault(a => a.Name == annotationName);

            if (annot != null)
            {
                return(annot.HasProperty(propertyName));
            }
            return(false);
        }
示例#3
0
        public int Compare(AnnotatedElement <T> x, AnnotatedElement <T> y)
        {
            int rc = x.Index.CompareTo(y.Index);

            if (rc != 0)
            {
                return(rc);
            }

            rc = _ElementComparer.Compare(x.Element, y.Element);
            if (rc != 0)
            {
                return(rc);
            }

            rc = x.IsFirst.CompareTo(y.IsFirst);
            if (rc != 0)
            {
                return(rc);
            }

            return(x.IsLast.CompareTo(y.IsLast));
        }
示例#4
0
 public override AnnotationProperty AnnotatedElement_SetAnnotationPropertyValue(AnnotatedElement @this, string annotationName, string propertyName, object propertyValue)
 {
     if (@this == null) return null;
     Annotation annot = @this.AddAnnotation(annotationName);
     return annot.SetPropertyValue(propertyName, propertyValue);
 }
示例#5
0
 public override bool AnnotatedElement_HasAnnotationProperty(AnnotatedElement @this, string annotationName, string propertyName)
 {
     if (@this == null) return false;
     Annotation annot = @this.GetAnnotation(annotationName);
     if (annot != null)
     {
         return annot.HasProperty(propertyName);
     }
     return false;
 }
示例#6
0
 public override bool AnnotatedElement_HasAnnotation(AnnotatedElement @this, string name)
 {
     return @this.GetAnnotation(name) != null;
 }
示例#7
0
 public override IList<Annotation> AnnotatedElement_GetAnnotations(AnnotatedElement @this, string name)
 {
     List<Annotation> result = new List<Soal.Annotation>();
     if (@this == null) return result;
     foreach (var annot in @this.Annotations)
     {
         if (annot.Name == name)
         {
             result.Add(annot);
         }
     }
     return result;
 }
示例#8
0
 public override object AnnotatedElement_GetAnnotationPropertyValue(AnnotatedElement @this, string annotationName, string propertyName)
 {
     if (@this == null) return null;
     Annotation annot = @this.GetAnnotation(annotationName);
     if (annot != null)
     {
         return annot.GetPropertyValue(propertyName);
     }
     return null;
 }
示例#9
0
 public override Annotation AnnotatedElement_GetAnnotation(AnnotatedElement @this, string name)
 {
     return @this.GetAnnotations(name).FirstOrDefault();
 }
示例#10
0
 public override Annotation AnnotatedElement_AddAnnotation(AnnotatedElement @this, string name)
 {
     Annotation result = @this.GetAnnotation(name);
     if (result == null)
     {
         result = SoalFactory.Instance.CreateAnnotation();
         result.Name = name;
         @this.Annotations.Add(result);
     }
     return result;
 }
示例#11
0
 public static Annotation GetAnnotation(this AnnotatedElement annotatedElement, string annotationName)
 {
     return(annotatedElement.Annotations.FirstOrDefault(a => a.Name == annotationName));
 }
示例#12
0
 public static bool HasAnnotation(this AnnotatedElement annotatedElement, string annotationName)
 {
     return(annotatedElement.Annotations.Any(a => a.Name == annotationName));
 }
示例#13
0
文件: Soal.cs 项目: Bubesz/soal-cs
 /// <summary>
 /// Implements the constructor: AnnotatedElement()
 /// </summary>
 public virtual void AnnotatedElement(AnnotatedElement @this)
 {
 }