/**
   * Get a user connection infos
   *
   * @param userName the user
   * @return the ConnectInfo
   */
  public ConnectInfo getConnectInfo(String userName) {
    for (int i = 0; i < this.connections.size(); i++) {
      ConnectInfo ci = (ConnectInfo) this.connections.get(i);
      if (ci.getName().equals(userName)) return ci;
    }

    return null;
  }
 /**
  * Overlay a single disease reaction onto a normal reaction.
  *
  * @param normalReaction
  * @param diseaseReaction
  * @param overlaidObjects
  */
 private void overlayDiseaseReaction(HyperEdge normalReaction, GKInstance diseaseReaction)
     throws Exception {
   // Make a copy of the HyperEdge for future process that is related to Vertex and JSON generation
   HyperEdge reactionCopy = normalReaction.shallowCopy();
   reactionCopy.setReactomeId(diseaseReaction.getDBID());
   reactionCopy.setDisplayName(diseaseReaction.getDisplayName());
   reactionCopy.setLineColor(DefaultRenderConstants.DEFAULT_DISEASE_BACKGROUND);
   displayedObject.addComponent(reactionCopy);
   overlaidObjects.add(reactionCopy);
   // Want to handle inputs, outputs and catalysts since regulators can
   // be ignored
   List<Node> nodes = new ArrayList<Node>();
   nodes.addAll(normalReaction.getInputNodes());
   nodes.addAll(normalReaction.getOutputNodes());
   nodes.addAll(normalReaction.getHelperNodes());
   // List objects not listed in the disease reaction as crossed objects
   Set<GKInstance> participants = InstanceUtilities.getReactionParticipants(diseaseReaction);
   Set<Long> diseaseIds = new HashSet<Long>();
   for (GKInstance participant : participants) {
     diseaseIds.add(participant.getDBID());
     if (participant.getSchemClass().isValidAttribute(ReactomeJavaConstants.hasMember)) {
       List<GKInstance> list = participant.getAttributeValuesList(ReactomeJavaConstants.hasMember);
       if (list != null && list.size() > 0) {
         for (GKInstance inst : list) diseaseIds.add(inst.getDBID());
       }
     }
     if (participant.getSchemClass().isValidAttribute(ReactomeJavaConstants.hasCandidate)) {
       List<GKInstance> list =
           participant.getAttributeValuesList(ReactomeJavaConstants.hasCandidate);
       if (list != null && list.size() > 0) {
         for (GKInstance inst : list) diseaseIds.add(inst.getDBID());
       }
     }
   }
   Set<GKInstance> lofInstances = new HashSet<GKInstance>();
   Map<Node, GKInstance> normalToDiseaseEntity =
       mapMutatedToNormalNodes(diseaseReaction, normalReaction, nodes, lofInstances);
   for (Node node : nodes) {
     if (!diseaseIds.contains(node.getReactomeId())) {
       // Check if it should be mapped to a normal entity
       GKInstance diseaseEntity = normalToDiseaseEntity.get(node);
       if (diseaseEntity == null) crossedObjects.add(node); // Just crossed out
       else {
         Node diseaseNode =
             replaceNormalNode(node, diseaseEntity, contains(diseaseEntity, lofInstances));
         if (diseaseNode == null) continue; // Just in case
         // Re-link to diseaseNode
         ConnectInfo connectInfo = reactionCopy.getConnectInfo();
         List<?> widgets = connectInfo.getConnectWidgets();
         for (Object obj : widgets) {
           ConnectWidget widget = (ConnectWidget) obj;
           if (widget.getConnectedNode() == node) widget.replaceConnectedNode(diseaseNode);
         }
       }
     } else overlaidObjects.add(node);
   }
 }
  /**
   * Get the complete ConnectInfo
   *
   * @param ConnectInfo the user
   * @return the complete ConnectInfo
   */
  private ConnectInfo getCompleteConnectInfo(ConnectInfo ci) {
    Iterator i = this.connections.iterator();

    while (i.hasNext()) {
      ConnectInfo tmp = (ConnectInfo) i.next();
      if (ci.getName().equals(tmp.getName())) return tmp;
    }

    return ci;
  }
 /**
  * Remove a ConnectionInfo
  *
  * @param user the user name
  */
 private void removeConnectInfo(String user) {
   for (int i = 0; i < this.connections.size(); i++) {
     ConnectInfo ci = (ConnectInfo) this.connections.get(i);
     if (ci.getName().equals(user)) {
       this.connections.remove(ci);
       break;
     }
   }
   sendUserList();
 }
  /**
   * Check if a user is already known
   *
   * @param ConnectInfo the user
   * @return true or false
   */
  private boolean isAlreadyKnown(ConnectInfo ci) {
    boolean result = false;
    Iterator i = this.connections.iterator();

    while (i.hasNext() && !result) {
      ConnectInfo tmp = (ConnectInfo) i.next();
      result = ci.getName().equals(tmp.getName());
    }

    return result;
  }
 /**
  * Remove a ConnectionInfo
  *
  * @param ci the connect info
  */
 private void removeConnectInfo(ConnectInfo ci) {
   removeConnectInfo(ci.getName());
 }