Beispiel #1
0
  /**
   * Two rules have the same signature if they have: same name same return value same args I do a
   * simple string compare now, but later the type could be pulled out so it is insensitive to names
   * of args etc...
   */
  public boolean sameSignature(Rule rule) {
    boolean nSame = true;
    boolean aSame = true;
    boolean rSame = true;

    nSame = name.equals(rule.getName());
    if (args != null) {
      aSame = args.equals(rule.getArgs());
    }
    if (returnValue != null) {
      rSame = returnValue.equals(rule.getReturnValue());
    }
    return nSame && aSame && rSame;
  }
Beispiel #2
0
 /**
  * If 'rule' narrows the visible of 'this', return true; For example, 'this' is public and 'rule'
  * is private, true is returned. You cannot narrow the vis. of a rule.
  */
 public boolean narrowerVisibility(Rule rule) {
   if (visibility.equals("public")) {
     if (!rule.equals("public")) {
       return true; // everything narrower than public
     }
     return false;
   } else if (visibility.equals("protected")) {
     if (rule.equals("private")) {
       return true; // private narrower than protected
     }
     return false;
   } else if (visibility.equals("private")) {
     return false; // nothing is narrower than private
   }
   return false;
 }