Пример #1
0
  /**
   * Adds a specific <tt>LocalCandidate</tt> to the list of <tt>LocalCandidate</tt>s harvested for
   * {@link #hostCandidate} by this harvest.
   *
   * @param candidate the <tt>LocalCandidate</tt> to be added to the list of
   *     <tt>LocalCandidate</tt>s harvested for {@link #hostCandidate} by this harvest
   * @return <tt>true</tt> if the list of <tt>LocalCandidate</tt>s changed as a result of the method
   *     invocation; otherwise, <tt>false</tt>
   */
  protected boolean addCandidate(LocalCandidate candidate) {
    boolean added;

    // try to add the candidate to the component and then only add it to the
    // harvest if it wasn't deemed redundant
    if (!candidates.contains(candidate)
        && hostCandidate.getParentComponent().addLocalCandidate(candidate)) {
      added = candidates.add(candidate);
    } else {
      added = false;
    }
    return added;
  }
Пример #2
0
 /**
  * Gets the <tt>Candidate</tt>s harvested for {@link #hostCandidate} during this harvest.
  *
  * @return an array containing the <tt>Candidate</tt>s harvested for {@link #hostCandidate} during
  *     this harvest
  */
 LocalCandidate[] getCandidates() {
   return candidates.toArray(NO_CANDIDATES);
 }
Пример #3
0
 /**
  * Gets the number of <tt>Candidate</tt>s harvested for {@link #hostCandidate} during this
  * harvest.
  *
  * @return the number of <tt>Candidate</tt>s harvested for {@link #hostCandidate} during this
  *     harvest
  */
 int getCandidateCount() {
   return candidates.size();
 }