Examples of RobotItem


Examples of net.sf.robocode.repository.items.RobotItem

   * @param repository is the repository, where the source file is automatically added or updated,
   *                   when the source file is registered.
   * @return a RobotItem that has been created or updated in the repository.
   */
  private RobotItem register(URL sourceFileUrl, IRepositoryRoot root, IRepository repository) {
    RobotItem item = null;

    // Check if the source file is already registered in the repository with a project URL
    if (root instanceof ClasspathRoot) {
      String projectUrl = ((ClasspathRoot) root).getFriendlyProjectURL(sourceFileUrl);
      if (projectUrl != null) {
        IRepositoryItem repositoryItem = repository.getItem(projectUrl);
        if (repositoryItem instanceof RobotItem) {
          item = (RobotItem) repositoryItem;
        }
      }
    }

    // If no project URL was registered with the source file then check if the source file is registered
    // in the repository.
    if (item == null) {
      String friendlyUrl = UrlUtil.removeFileExtension(sourceFileUrl.toString());

      IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
      if (repositoryItem instanceof RobotItem) {
        item = (RobotItem) repositoryItem;
      }
    }

    // If the source file has not been registered then create a new RobotItem based on the source file URL
    if (item == null) {
      item = new RobotItem(sourceFileUrl, root);
    }

    // Add the root URL as source path with the RobotIteam
    item.addSourcePathURL(root.getURL());

    // Add or update the item in the repository and return it
    repository.addOrUpdateItem(item);
    return item;
  }
View Full Code Here

Examples of net.sf.robocode.repository.items.RobotItem

   * @param repository is the repository, where the class file is automatically added or updated,
   *                   when the class file is registered.
   * @return a RobotItem that has been created or updated in the repository.
   */
  private RobotItem register(URL classFileUrl, IRepositoryRoot root, IRepository repository) {
    RobotItem item = null;

    // Check if the class file is already registered in the repository
    String friendlyUrl = UrlUtil.removeFileExtension(classFileUrl.toString());
   
    IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
    if (repositoryItem instanceof RobotItem) {
      item = (RobotItem) repositoryItem;
    }

    // If the class file has not been registered then create a new RobotItem based on the class file URL
    if (item == null) {
      item = new RobotItem(classFileUrl, root);
    }

    // Set the class path URL and class URL on the RobotItem
    item.setClassPathURL(root.getURL());
    item.setClassURL(classFileUrl);

    // Add or update the item in the repository and return it
    repository.addOrUpdateItem(item);
    return item;
  }
View Full Code Here

Examples of net.sf.robocode.repository.items.RobotItem

   * @param repository is the repository, where the properties file is automatically added or updated,
   *                   when the properties file is registered.
   * @return a RobotItem that has been created or updated in the repository.
   */
  private RobotItem register(URL propertiesFileUrl, IRepositoryRoot root, IRepository repository) {
    RobotItem item = null;

    // Check if the properties file is already registered in the repository
    String friendlyUrl = UrlUtil.removeFileExtension(propertiesFileUrl.toString());

    IRepositoryItem repositoryItem = repository.getItem(friendlyUrl);
View Full Code Here

Examples of net.sf.robocode.repository.items.RobotItem

   *                   when the properties file is registered.
   * @return a new RobotItem that has been created or null if the RobotItem could not be created.
   */
  private RobotItem createRobotItem(URL propertiesFileUrl, IRepositoryRoot root, IRepository repository) {
    // Create a RobotItem based on the properties file URL
    RobotItem item = new RobotItem(propertiesFileUrl, root);

    // Check if the robot is for the Java platform
    String platform = item.getPlatform();
    if (platform.equalsIgnoreCase("Java")) {
      // Java platform -> set the properties URL on the RobotItem
      item.setPropertiesURL(propertiesFileUrl);
    } else {
      // Another platform -> Look for another properties handler
      PropertiesHandler otherHandler = Container.getComponent(PropertiesHandler.class,
          platform + "PropertiesHandler");

View Full Code Here

Examples of net.sf.robocode.repository.items.RobotItem

    }
    return null;
  }

  private IRepositoryItem register(URL itemURL, IRepositoryRoot root, IRepository repository) {
    RobotItem item = (RobotItem) repository.getItem(itemURL.toString());
    if (item == null) {
      item = createItem(itemURL, root, repository);
    }
    repository.addOrUpdateItem(item);
    return item;
View Full Code Here

Examples of net.sf.robocode.repository.items.RobotItem

      if (item.isTeam()) {
        teamId = item.getFullClassNameWithVersion() + "[" + teamId + "]";
        final Collection<RobotItem> members = getRobotItems((TeamItem) item);

        for (IRobotSpecItem member : members) {
          final RobotItem robot = (RobotItem) member;

          boolean tested = false;

          for (RobotSpecification loaded : battlingRobotsList) {
            if (HiddenAccess.getFileSpecification(loaded).equals(robot)) {
              tested = true;
              break;
            }
          }

          if (tested || robot.validate()) {
            battlingRobotsList.add(robot.createRobotSpecification(null, teamId));
          }
        }
      } else {
        final RobotItem robot = (RobotItem) item;

        if (robot.validate()) {
          battlingRobotsList.add(robot.createRobotSpecification(spec, null));
        } else {
          Logger.logError("Could not load robot: " + robot.getFullClassName());
          return false;
        }
      }
      return true;
    }
View Full Code Here

Examples of net.sf.robocode.repository.items.RobotItem

      String pUrl = root.toString() + entry.getName();
      IRepositoryItem repositoryItem = ItemHandler.registerItem(new URL(pUrl), JarRoot.this, repository);

      if (repositoryItem != null) {
        if (repositoryItem instanceof RobotItem) {
          RobotItem robotItem = (RobotItem) repositoryItem;

          robotItem.setClassPathURL(root);
        }
        repositoryItems.add(repositoryItem);
      }
    } catch (MalformedURLException e) {
      Logger.logError(e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.