code: public int addAnnotationDefinition(
              TableAnnotationDefinition annotationDefinition, int did) {
          if (annotationDefinition == null) {
              throw new InvalidArgument("annotation definition is null");
          }
  
          if (annotationDefinitions.add(annotationDefinition)) {
              int nextIndex = annotationDefinitions.size() - 1;
  
              definitionIndex.put(annotationDefinition, nextIndex);
              indexDefinition.put(nextIndex, annotationDefinition);
          }
  
          Integer adi = definitionIndex.get(annotationDefinition);
          Set<Integer> dadi = documentAnnotationDefinitions.get(did);
          if (dadi == null) {
              dadi = new LinkedHashSet<Integer>();
              documentAnnotationDefinitions.put(did, dadi);
          }
  
          dadi.add(adi);
          return adi;
      }
docs: Adds an annotation definition to the {@code annotationDefinitions} set.
  The insertion index is captured by {@code definitionIndex}.
  
  @param annotationDefinition {@link TableAnnotationDefinition}, the
  annotation definition to add, which cannot be null
  @return {@code int}, the index of the added annotation definition, which
  must be &gt;= 0.
  @throws InvalidArgument Thrown if the {@code annotationDefinition}
  argument is null