Package net.sf.robocode.repository

Examples of net.sf.robocode.repository.IRobotItem


  private final int robotIndex;
  private final int teamIndex;

  public RobotStatics(RobotSpecification robotSpecification, int duplicate, boolean isLeader, BattleRules rules, String teamName, List<String> teamMembers, int robotIndex, int teamIndex) {
    IRobotItem robotItem = ((IRobotItem) HiddenAccess.getFileSpecification(robotSpecification));

    this.robotIndex = robotIndex;
    this.teamIndex = teamIndex;

    shortClassName = robotItem.getShortClassName();
    fullClassName = robotItem.getFullClassName();
    if (duplicate >= 0) {
      String countString = " (" + (duplicate + 1) + ')';

      name = robotItem.getUniqueFullClassNameWithVersion() + countString;
      shortName = robotItem.getUniqueShortClassNameWithVersion() + countString;
      veryShortName = robotItem.getUniqueVeryShortClassNameWithVersion() + countString;
    } else {
      name = robotItem.getUniqueFullClassNameWithVersion();
      shortName = robotItem.getUniqueShortClassNameWithVersion();
      veryShortName = robotItem.getUniqueVeryShortClassNameWithVersion();
    }

    this.isJuniorRobot = robotItem.isJuniorRobot();
    this.isAdvancedRobot = robotItem.isAdvancedRobot();
    this.isTeamRobot = robotItem.isTeamRobot();
    this.isDroid = robotItem.isDroid();
    this.isSentryRobot = robotItem.isSentryRobot();
    this.isInteractiveRobot = robotItem.isInteractiveRobot();
    this.isPaintRobot = robotItem.isPaintRobot();
    this.isTeamLeader = isLeader;
    this.battleRules = rules;

    if (teamMembers != null) {
      List<String> list = new ArrayList<String>();
View Full Code Here


  public void punishBadBehavior(BadBehavior badBehavior) {
    kill(); // Bug fix [2828479] - Missed onRobotDeath events

    statistics.setInactive();

    final IRobotItem repositoryItem = (IRobotItem) HiddenAccess.getFileSpecification(robotSpecification);

    StringBuffer message = new StringBuffer(getName()).append(' ');

    boolean disableInRepository = false; // Per default, robots are not disabled in the repository

    switch (badBehavior) {
    case CANNOT_START:
      message.append("could not be started or loaded.");
      disableInRepository = true; // Disable in repository when it cannot be started anyways
      break;

    case UNSTOPPABLE:
      message.append("cannot be stopped.");
      break;

    case SKIPPED_TOO_MANY_TURNS:
      message.append("has skipped too many turns.");
      break;

    case SECURITY_VIOLATION:
      message.append("has caused a security violation.");
      disableInRepository = true; // No mercy here!
      break;
    }

    if (disableInRepository) {
      repositoryItem.setValid(false);     
      message.append(" This ").append(repositoryItem.isTeam() ? "team" : "robot").append(
          " has been banned and will not be allowed to participate in battles.");
    }

    logMessage(message.toString());
  }
View Full Code Here

    return new RobotClassLoader(robotItem.getClassPathURL(), robotItem.getFullClassName());
  }

  public IHostingRobotProxy createRobotProxy(IHostManager hostManager, RobotSpecification robotSpecification, IRobotStatics statics, IRobotPeer peer) {
    IHostingRobotProxy robotProxy;
    final IRobotItem specification = (IRobotItem) HiddenAccess.getFileSpecification(robotSpecification);

    if (specification.isTeamRobot()) {
      robotProxy = new TeamRobotProxy(specification, hostManager, peer, (RobotStatics) statics);
    } else if (specification.isAdvancedRobot()) {
      robotProxy = new AdvancedRobotProxy(specification, hostManager, peer, (RobotStatics) statics);
    } else if (specification.isStandardRobot()) {
      robotProxy = new StandardRobotProxy(specification, hostManager, peer, (RobotStatics) statics);
    } else if (specification.isJuniorRobot()) {
      robotProxy = new JuniorRobotProxy(specification, hostManager, peer, (RobotStatics) statics);
    } else {
      throw new AccessControlException("Unknown robot type");
    }
    return robotProxy;
View Full Code Here

  public RobotType getRobotType(IRobotItem robotItem, boolean resolve, boolean message) {
    return getHost(robotItem).getRobotType(robotItem, resolve, message);
  }

  public IHostingRobotProxy createRobotProxy(RobotSpecification robotSpecification, RobotStatics statics, IRobotPeer peer) {
    IRobotItem specification = (IRobotItem) HiddenAccess.getFileSpecification(robotSpecification);
    return getHost(specification).createRobotProxy(this, robotSpecification, statics, peer);
  }
View Full Code Here

TOP

Related Classes of net.sf.robocode.repository.IRobotItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.