Ejemplo n.º 1
0
  /** Computes the latest module builds that correspond to this build. */
  public Map<IvyModule, IvyBuild> getModuleLastBuilds() {
    Collection<IvyModule> mods = getParent().getModules();

    // identify the build number range. [start,end)
    IvyModuleSetBuild nb = getNextBuild();
    int end = nb != null ? nb.getNumber() : Integer.MAX_VALUE;

    // preserve the order by using LinkedHashMap
    Map<IvyModule, IvyBuild> r = new LinkedHashMap<IvyModule, IvyBuild>(mods.size());

    for (IvyModule m : mods) {
      IvyBuild b = m.getNearestOldBuild(end - 1);
      if (b != null && b.getNumber() >= getNumber()) r.put(m, b);
    }

    return r;
  }
Ejemplo n.º 2
0
  /**
   * Finds {@link Action}s from all the module builds that belong to this {@link IvyModuleSetBuild}.
   * One action per one {@link IvyModule}, and newer ones take precedence over older ones.
   */
  public <T extends Action> List<T> findModuleBuildActions(Class<T> action) {
    Collection<IvyModule> mods = getParent().getModules();
    List<T> r = new ArrayList<T>(mods.size());

    // identify the build number range. [start,end)
    IvyModuleSetBuild nb = getNextBuild();
    int end = nb != null ? nb.getNumber() - 1 : Integer.MAX_VALUE;

    for (IvyModule m : mods) {
      IvyBuild b = m.getNearestOldBuild(end);
      while (b != null && b.getNumber() >= number) {
        T a = b.getAction(action);
        if (a != null) {
          r.add(a);
          break;
        }
        b = b.getPreviousBuild();
      }
    }

    return r;
  }