/** Method only to be used by RCSIMPs designated as fronts */
 public void calcAllAttackValues(String[] noAttack) {
   targets.clear(); // is this nessecary?
   for (int i = 0; i < owns.size(); i++) {
     enemy.calcAttackValue((RCSInfluenceMapPosition) owns.elementAt(i), noAttack);
   }
   calcTacticalStanding();
   // System.out.println("do I have any targets? : "+targets.size());
 }
  /**
   * Given a co-ord checks to see if a line from it passes through its influence circle to the
   * subsequent flanks associated with it. If it does then it is a rear unit.
   */
  public void passesThrough(RCSInfluenceMapPosition enemy, String type_REAR) {
    this.enemy = enemy;
    this.enemyPos = enemy.getCenter();

    RCSInfluenceMapPosition pos1;
    Rectangle2D.Double rect =
        new Rectangle2D.Double(
            center[0] - (totalValue / 2), center[1] - (totalValue / 2), totalValue, totalValue);

    // i =1 because the first element (0) is the front itself.
    for (int i = 1; i < owns.size(); i++) {
      pos1 = (RCSInfluenceMapPosition) owns.elementAt(i);

      if (rect.intersectsLine(enemyPos[0], enemyPos[1], pos1.getCenter()[0], pos1.getCenter()[1])) {
        pos1.setType(type_REAR);
      }
    }
  }
  public void updateGraphics(Graphics2D g2) {
    c1 = g2.getColor();
    amplified = (int) totalValue * amplifier;
    g2.drawOval(
        (int) (center[0] - (amplified / 2)),
        (int) (center[1] - (amplified / 2)),
        amplified,
        amplified);

    double[] tDoub;
    for (int i = 0; i < positions.size(); i++) {
      tDoub = (double[]) positions.elementAt(i);
      g2.drawLine((int) center[0], (int) center[1], (int) tDoub[1], (int) tDoub[2]);
      g2.drawString(
          type + " (" + totalValue + ")" + "(" + tactical_standing + ")",
          (int) center[0],
          (int) center[1]);
    }

    RCSInfluenceMapPosition pos1;
    g2.setColor(Color.yellow);
    for (int i = 0; i < owns.size(); i++) {
      pos1 = (RCSInfluenceMapPosition) owns.elementAt(i);
      g2.drawLine(
          (int) center[0], (int) center[1], (int) pos1.getCenter()[0], (int) pos1.getCenter()[1]);
    }
    g2.setColor(c1);

    if (enemyPos != null) {
      g2.setColor(Color.white);
      g2.drawLine((int) center[0], (int) center[1], (int) enemyPos[0], (int) enemyPos[1]);
      if (umb != -1) {
        g2.drawOval(
            (int) (center[0] - (umb / 2)), (int) (center[1] - (umb / 2)), (int) umb, (int) umb);
      }
      g2.setColor(c1);
    }
  }
  /**
   * Given pos1 the attack values are calculated between it and the positions held in 'owns' (pos2).
   * the attack_value and pos2 are then added to result[] and added to pos1's 'targets' vector.
   */
  public void calcAttackValue(RCSInfluenceMapPosition pos1, String[] noAttack) {
    RCSInfluenceMapPosition pos2;
    double attack_value;

    for (int i = 0; i < owns.size(); i++) {
      pos2 = (RCSInfluenceMapPosition) owns.elementAt(i);
      if (isMember(pos2.getType(), noAttack) == false) {
        attack_value =
            (pos1.getTotalValue() - pos2.getTotalValue())
                / java.awt.geom.Point2D.distance(
                    pos1.getCenter()[0],
                    pos1.getCenter()[1],
                    pos2.getCenter()[0],
                    pos2.getCenter()[1]);
        pos1.addDoubleHigh(pos1.getTargets(), new objectTarget(attack_value, pos2));
      }
    }
  }