Esempio n. 1
0
 public Score scoreMostSpecific(Context context, CategoryType t1, CategoryType t2)
 {
     if (t1.Equals(t2))
     {
         return(Score.SIMILAR);
     }
     if (this.Equals(t1))
     {
         return(Score.BETTER);
     }
     if (this.Equals(t2))
     {
         return(Score.WORSE);
     }
     // since this derives from both t1 and t2, return the most specific of t1 and t2
     if (t1.isMoreSpecificThan(context, t2))
     {
         return(Score.BETTER);
     }
     if (t2.isMoreSpecificThan(context, t1))
     {
         return(Score.WORSE);
     }
     return(Score.SIMILAR); // should never happen
 }
Esempio n. 2
0
 public bool isDerivedFrom(Context context, CategoryDeclaration decl, CategoryType other)
 {
     if (decl.getDerivedFrom() == null)
     {
         return(false);
     }
     foreach (String derived in decl.getDerivedFrom())
     {
         CategoryType ct = new CategoryType(derived);
         if (ct.Equals(other) || ct.isDerivedFrom(context, other))
         {
             return(true);
         }
     }
     return(false);
 }