Spit out annotations used in showAnnotations param

Update Class, Member, and Method infos to track what annotations
were used to bypass @hide and the like. Pass those out as an
array to be rendered in the HTML.

Bug: 16848303
Change-Id: I98ebc574d4b8eaaa1134e260518ddc2ddd43f99f
diff --git a/src/com/google/doclava/AnnotationInstanceInfo.java b/src/com/google/doclava/AnnotationInstanceInfo.java
index ff17e8d..c72ca9a 100644
--- a/src/com/google/doclava/AnnotationInstanceInfo.java
+++ b/src/com/google/doclava/AnnotationInstanceInfo.java
@@ -16,6 +16,8 @@
 
 package com.google.doclava;
 
+import com.google.clearsilver.jsilver.data.Data;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 
@@ -117,4 +119,32 @@
 
       return allResolved;
   }
+
+  public static void makeLinkListHDF(Data data, String base, AnnotationInstanceInfo[] annotations) {
+    if (annotations == null) return;
+
+    final int N = annotations.length;
+    for (int i = 0; i < N; i++) {
+      AnnotationInstanceInfo aii = annotations[i];
+      aii.type().makeShortDescrHDF(data, base + "." + i);
+    }
+  }
+
+  /**
+   * Get a new list containing the set of annotations that are shared between
+   * the input annotations collection and the names of annotations passed in
+   * the showAnnotations parameter
+   */
+  public static ArrayList<AnnotationInstanceInfo> getShowAnnotationsIntersection(
+          ArrayList<AnnotationInstanceInfo> annotations) {
+    ArrayList<AnnotationInstanceInfo> list = new ArrayList<AnnotationInstanceInfo>();
+    if (annotations != null) {
+      for (AnnotationInstanceInfo info : annotations) {
+        if (Doclava.showAnnotations.contains(info.type().qualifiedName())) {
+          list.add(info);
+        }
+      }
+    }
+    return list;
+  }
 }