Beispiel #1
0
        public bool isDerivedFromAnonymous(Context context, CategoryDeclaration thisDecl, CategoryDeclaration otherDecl)
        {
            // an anonymous category extends 1 and only 1 category
            String baseName = otherDecl.getDerivedFrom()[0];

            // check we derive from root category (if not extending 'any')
            if (!"any".Equals(baseName) && !thisDecl.isDerivedFrom(context, new CategoryType(baseName)))
            {
                return(false);
            }
            foreach (String attribute in otherDecl.GetAllAttributes(context))
            {
                if (!thisDecl.hasAttribute(context, attribute))
                {
                    return(false);
                }
            }
            return(true);
        }