/**
  * Returns whether or not another player has the same name and id as this one.
  *
  * @param other The other player.
  * @return True if names and ids match, false otherwise.
  */
 @Override
 public boolean equals(Object other) {
   if (other == null || !(other instanceof Player)) {
     return false;
   }
   if (other == this) {
     return true;
   }
   Player otherPlayer = (Player) other;
   return (otherPlayer.name().equals(this.name()) && otherPlayer.id().equals(this.id()));
 }
  public void addEngines() {
    ArrayList<Player> disPlayers = new ArrayList<Player>();
    ArrayList<Player> ordPlayers = new ArrayList<Player>();
    PMS r = PMS.get();

    for (String id : configuration.getEnginesAsList(r.getRegistry())) {
      // boolean matched = false;
      for (Player p : PlayerFactory.getAllPlayers()) {
        if (p.id().equals(id)) {
          ordPlayers.add(p);
          // matched = true;
        }
      }
    }

    for (Player p : PlayerFactory.getAllPlayers()) {
      if (!ordPlayers.contains(p)) {
        ordPlayers.add(p);
        disPlayers.add(p);
      }
    }

    for (Player p : ordPlayers) {
      TreeNodeSettings en = new TreeNodeSettings(p.name(), p, null);
      if (disPlayers.contains(p)) {
        en.setEnable(false);
      }
      JComponent jc = en.getConfigPanel();
      if (jc == null) {
        jc = buildEmpty();
      }
      jc.addComponentListener(
          new ComponentAdapter() {
            @Override
            public void componentShown(ComponentEvent e) {
              handleCardComponentChange(e.getComponent());
            }
          });
      tabbedPane.add(en.id(), jc);
      parent[p.purpose()].add(en);
    }

    for (int i = 0; i < tree.getRowCount(); i++) {
      tree.expandRow(i);
    }

    tree.setSelectionRow(0);
  }