// <summary>This method is applicable only to objects represnting types and // checks if this type is the same or subtype of specified type</summary> /// <param name="superType">version history representing object type</param> /// <param name="kind">search kind</param> /// <param name="timestamp">timestamp used to locate version</param> /// <returns>true if this type is the same or is subtype of specified type</returns> public bool IsSubTypeOf(VersionHistory superType, SearchKind kind, DateTime timestamp) { if (vh == superType) { return(true); } foreach (VersionHistory subtype in this[Symbols.Subtype]) { if (kind == SearchKind.AllVersions) { foreach (Thing type in subtype.versions) { if (type.IsSubTypeOf(superType, kind, timestamp)) { return(true); } } } else { Thing type = subtype.GetVersion(kind, timestamp); if (type != null && type.IsSubTypeOf(superType, kind, timestamp)) { return(true); } } } return(false); }
/// <summary>Check if object belongs to the partiular type</summary> /// <param name="superType">version history representing object type</param> /// <param name="kind">search kind</param> /// <param name="timestamp">timestamp used to locate version</param> /// <returns>true if type of the object is the same or is subtype of specified type</returns> public bool IsInstanceOf(VersionHistory superType, SearchKind kind, DateTime timestamp) { return(type.IsSubTypeOf(superType, kind, timestamp)); }