EnumCheck.cs

Go to the documentation of this file.
00001 using System;
00002 using System.Collections.Generic;
00003 using System.Text;
00004 using HouseOver.THARM.Buildings;
00005 
00006 namespace HouseOver.THARM.Search
00007 {
00011     [Serializable]
00012     public class EnumCheck : Check
00013     {
00015         private Enum value;
00016 
00018         public Enum Value
00019         {
00020             get { return value; }
00021             set { this.value = value; }
00022         }
00023 
00031         public EnumCheck(string fieldName, string humanReadableName, bool fieldRequired, Type fieldType) : base(fieldName, humanReadableName, fieldRequired, fieldType)
00032         {
00033         }
00034 
00040         public override bool Verify(object obj)
00041         {
00042             if (!fieldRequired)
00043                 return true;
00044 
00045             if (!FieldType.IsInstanceOfType(obj))
00046                 return false;
00047 
00048             Enum e = obj as Enum;
00049             if (e == null)
00050                 return false;
00051 
00052             return e.Equals(value);
00053         }
00054     }
00055 }

Generated on Wed Jan 10 03:42:42 2007 for THARM by  doxygen 1.5.1-p1