コード例 #1
0
 /**
  * Determine if the program element is shown, according to the given level of visibility.
  *
  * @param ped The given program element.
  * @param visLevel The desired visibility level; "public", "protected", "package" or "private". If
  *     null, only check for an exclude tag.
  * @return boolean Set if this element is shown.
  */
 public boolean shownElement(Doc doc, String visLevel) {
   // If a doc block contains @exclude or a similar such tag,
   // then don't display it.
   if (doExclude && excludeTag != null && doc != null) {
     String rct = doc.getRawCommentText();
     if (rct != null && rct.indexOf(excludeTag) != -1) {
       return false;
     }
   }
   if (visLevel == null) {
     return true;
   }
   ProgramElementDoc ped = null;
   if (doc instanceof ProgramElementDoc) {
     ped = (ProgramElementDoc) doc;
   }
   if (visLevel.compareTo("private") == 0) return true;
   // Show all that is not private
   if (visLevel.compareTo("package") == 0) return !ped.isPrivate();
   // Show all that is not private or package
   if (visLevel.compareTo("protected") == 0) return !(ped.isPrivate() || ped.isPackagePrivate());
   // Show all that is not private or package or protected,
   // i.e. all that is public
   if (visLevel.compareTo("public") == 0) return ped.isPublic();
   return false;
 } // shownElement()