/**
   * Gets Interaction Detection element. It is possible that an interaction is missing important
   * attributes, such as Experimental System Name, XRef DB, and XRef ID. All of these attributes are
   * required by PSI. Rather than throwing an exception here, the data_mapper manually specifies
   * "Not Specified" for all missing attributes.
   *
   * @param interaction Interaction.
   * @return InteractionDetection Object.
   */
  private CvType getInteractionDetection(
      org.cytoscape.coreplugin.psi_mi.model.Interaction interaction) {
    CvType interactionDetection = new CvType();
    String idStr = null;

    try {
      idStr = (String) interaction.getAttribute(InteractionVocab.EXPERIMENTAL_SYSTEM_NAME);
    } catch (ClassCastException e) {
      idStr = null;
    }

    if (idStr == null) {
      idStr = "Not Specified";
    }

    String idRef = null;

    try {
      idRef = (String) interaction.getAttribute(InteractionVocab.EXPERIMENTAL_SYSTEM_XREF_ID);
    } catch (ClassCastException e) {
      idRef = null;
    }

    //  If there is no ID Ref, find a best match.
    if (idRef == null) {
      if (idStr.equals(EXP_AFFINITY_PRECIPITATION) || idStr.equals(EXP_AFFINITY_CHROMOTOGRAPHY)) {
        idStr = "affinity chromatography technologies";
        idRef = "MI:0004";
      } else if (idStr.equals(EXP_TWO_HYBRID)) {
        idStr = "classical two hybrid";
        idRef = "MI:0018";
      } else if (idStr.equals(EXP_PURIFIED_COMPLEX)) {
        idStr = "copurification";
        idRef = "MI:0025";
      } else {
        idRef = "Not Specified";
      }
    }

    NamesType names = createName(idStr, null);
    interactionDetection.setNames(names);

    String dbRef = null;

    try {
      dbRef = (String) interaction.getAttribute(InteractionVocab.EXPERIMENTAL_SYSTEM_XREF_DB);
    } catch (ClassCastException e) {
      dbRef = null;
    }

    if (dbRef == null) {
      dbRef = "PSI-MI";
    }

    XrefType xref = createXRef(dbRef, idRef);
    interactionDetection.setXref(xref);

    return interactionDetection;
  }
 public void alloc(int elemNumber) {
   if (elemNumber > 0) super.create(elemNumber, 1, CvType.makeType(_depth, _channels));
 }