using System;
using System.ComponentModel;
using System.Runtime.Serialization;
using AnticipatingMinds.Genesis.CodeDOM;
namespace AnticipatingMinds.Genesis.KnowledgeManagement{
/// <summary>
/// Summary description for PropertyApplicabilityScope.
/// </summary>
[Serializable]
public class PropertyApplicabilityScope : TypeMemberApplicabilityScope, ISerializable, ICloneable
{
#region Instance constructors
public PropertyApplicabilityScope():base()
{
}
public PropertyApplicabilityScope(PropertyApplicabilityScope propertyApplicabilityScope) : base(propertyApplicabilityScope)
{
if(propertyApplicabilityScope.PropertyType != null)
PropertyType = ((ICloneable)propertyApplicabilityScope.PropertyType).Clone() as TypeReferenceApplicabilityScope;
}
#endregion Instance constructors
#region ISerializable Implementation
private PropertyApplicabilityScope(SerializationInfo info, StreamingContext context) : base(info,context)
{
PropertyType = info.GetValue("PropertyType",typeof(TypeReferenceApplicabilityScope)) as TypeReferenceApplicabilityScope;
}
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info,context);
info.AddValue("PropertyType",PropertyType,typeof(TypeReferenceApplicabilityScope));
}
#endregion
#region ICloneable Members
public override object Clone()
{
return new PropertyApplicabilityScope(this);
}
#endregion
#region Public instance properties
[Category("Behavior")]
[System.ComponentModel.Editor(typeof(TypeReferenceScopeEditor),typeof(System.Drawing.Design.UITypeEditor))]
[TypeConverter(typeof(ApplicabilityScopeTypeConverter))]
[DefaultValue(null)]
[Description("The data type of the property being declared.")]
public TypeReferenceApplicabilityScope PropertyType
{
get
{
return propertyType;
}
set
{
propertyType = value;
}
}
public override string Title
{
get
{
return "Property Declaration";
}
}
#endregion Public instance properties
#region Protected instance methods
protected override bool DoesElementMatchScopeConditions(CodeElement codeElement)
{
if(!(codeElement is CodeTypePropertyDeclaration))
return false;
if(PropertyType != null)
if(!PropertyType.IsElementInScope((codeElement as CodeTypePropertyDeclaration).ReturnType))
return false;
return base.DoesElementMatchScopeConditions(codeElement);
}
#endregion Protected instance methods
#region Private instance fields
TypeReferenceApplicabilityScope propertyType = null;
#endregion Private instance fields
}
}
|