/**
   * Pathway information is added to the pathway element model.
   *
   * @param title
   * @param version
   * @param organism
   * @param commentList
   * @param bioPaxRefs
   * @return pwElt
   */
  public static PathwayElement createMapInfo(
      String title,
      String version,
      String organism,
      List<String> commentList,
      List<String> bioPaxRefs) {

    // create pathwayElement line
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.MAPPINFO);
    if (!(title.equals(""))) pwElt.setMapInfoName(title);
    if (!(version.equals(""))) pwElt.setVersion(version);
    if (!(organism.equals(""))) pwElt.setOrganism(organism);

    if (commentList.size() > 0) {
      for (int i = 0; i < commentList.size(); i += 2) {
        pwElt.addComment(commentList.get(i), commentList.get(i + 1));
      }
    }

    if (bioPaxRefs.size() > 0) {
      for (int i = 0; i < bioPaxRefs.size(); i++) {
        pwElt.addBiopaxRef(bioPaxRefs.get(i));
      }
    }
    return pwElt;
  }
  /**
   * DataNode values are added to the pathway element model.
   *
   * @param centerX
   * @param centerY
   * @param width
   * @param height
   * @param textLabel
   * @param identifier
   * @param source
   * @param dnType
   * @param graphId
   * @param color
   * @param fontSize
   * @param zOrder
   * @param vAlign
   * @param groupRef
   * @param bioPaxRefs
   * @param commentList
   * @return pwElt
   */
  public static PathwayElement createDataNode(
      Double centerX,
      Double centerY,
      Double width,
      Double height,
      String textLabel,
      String identifier,
      DataSource source,
      String dnType,
      String graphId,
      Color color,
      Double fontSize,
      Integer zOrder,
      String vAlign,
      String groupRef,
      List<String> bioPaxRefs,
      List<String> commentList) {

    // create pathwayElement data node
    PathwayElement pwElt = PathwayElement.createPathwayElement(ObjectType.DATANODE);

    // for better definition of identifier and database
    Xref ref = new Xref(identifier, source);

    // put variables in element
    if (centerX != null) {
      pwElt.setMCenterX(centerX);
    } else {
      System.out.println("No CenterX for datanode!!");
      throw new EmptyStackException();
    }
    if (centerY != null) {
      pwElt.setMCenterY(centerY);
    } else {
      System.out.println("No centerY for datanode!!");
      throw new EmptyStackException();
    }
    if (width != null) {
      pwElt.setMWidth(width);
    } else {
      System.out.println("No width for datanode!!");
      throw new EmptyStackException();
    }
    if (height != null) {
      pwElt.setMHeight(height);
    } else {
      System.out.println("No height for datanode!!");
      throw new EmptyStackException();
    }
    if (!(textLabel.equals(""))) pwElt.setTextLabel(textLabel);
    else {
      System.out.println("No label name for datanode!!");
      throw new EmptyStackException();
    }
    if (!(ref.getId().isEmpty())) pwElt.setElementID(ref.getId());
    if (ref.getDataSource() != null) pwElt.setDataSource(ref.getDataSource());
    if (dnType != null) pwElt.setDataNodeType(dnType);
    if (!(graphId.equals(""))) {
      pwElt.setGraphId(graphId);
    } else {
      System.out.println("No GraphId for datanode!!");
      throw new EmptyStackException();
    }
    if (color != null) {
      pwElt.setColor(color);
    }
    if (fontSize != null) pwElt.setMFontSize(fontSize);
    if (zOrder != -1) pwElt.setZOrder(zOrder);
    // System.out.println(groupRef);
    // if (!(groupRef.equals(""))) pwElt.setGraphRef(groupRef);

    if (vAlign.toLowerCase() == "middle") {
      pwElt.setValign(ValignType.MIDDLE);
    } else if (vAlign.toLowerCase() == "bottom") {
      pwElt.setValign(ValignType.BOTTOM);
    } else if (vAlign.toLowerCase() == "top") {
      pwElt.setValign(ValignType.TOP);
    } else {
      pwElt.setValign(ValignType.MIDDLE);
    }

    if (bioPaxRefs.size() > 0) {
      for (int i = 0; i < bioPaxRefs.size(); i++) {
        pwElt.addBiopaxRef(bioPaxRefs.get(i));
      }
    }

    if (commentList.size() > 0) {
      for (int i = 0; i < commentList.size(); i += 2) {
        pwElt.addComment(commentList.get(i), commentList.get(i + 1));
      }
    }
    return pwElt;
  }