Obtaining Candidates
@return Indices of Candidates
779175
private Set<Integer> obtainCandidates(double[] q) {
        Set<Integer> candidates = new LinkedHashSet<>();
        for (Hash h : hash) {
            BucketEntry bucket = h.get(q);
            if (bucket != null) {
                int m = bucket.entry.size();
                for (int i = 0; i < m; i++) {
                    int index = bucket.entry.get(i);
                    candidates.add(index);
                }
            }
        }
        return candidates;
    }
494459
private static Method searchCandidates(List<Method> candidateMethods, Method bridgeMethod) {
		if (candidateMethods.isEmpty()) {
			return null;
		}
		Method previousMethod = null;
		boolean sameSig = true;
		for (Method candidateMethod : candidateMethods) {
			if (isBridgeMethodFor(bridgeMethod, candidateMethod, bridgeMethod.getDeclaringClass())) {
				return candidateMethod;
			}
			else if (previousMethod != null) {
				sameSig = sameSig &&
						Arrays.equals(candidateMethod.getGenericParameterTypes(), previousMethod.getGenericParameterTypes());
			}
			previousMethod = candidateMethod;
		}
		return (sameSig ? candidateMethods.get(0) : null);
	}
546962
private int collectCandidates(Map<Long, Score> candidates,
                                List<Bucket> buckets,
                                int threshold) {
    int ix;
    for (ix = 0; ix < threshold &&
           candidates.size() < (CUTOFF_FACTOR_1 * max_search_hits); ix++) {
      Bucket b = buckets.get(ix);
      long[] ids = b.records;
      double score = b.getScore();
      
      for (int ix2 = 0; ix2 < b.nextfree; ix2++) {
        Score s = candidates.get(ids[ix2]);
        if (s == null) {
          s = new Score(ids[ix2]);
          candidates.put(ids[ix2], s);
        }
        s.score += score;
      }
      if (DEBUG)
        System.out.println("Bucket " + b.nextfree + " -> " + candidates.size());
    }
    return ix;
  }
1079628
private String getIndex() {

        try {
            return parseMandatoryStringValue(XML_ELEMENT_INDEX);
        } catch (final Exception e) {
            LOG.info(Messages.get().getBundle().key(Messages.LOG_NO_INDEX_SPECIFIED_0), e);
            return null;
        }
    }
1224980
def get_candidate_election(self, candidate):
        """"""
        return CandidateElection.objects.get(
            candidate=candidate, election=self
        )
273379
def getInstIdFromIndices(self, *indices):
        """"""
        try:
            return self._idxToIdCache[indices]
        except TypeError:
            cacheable = False
        except KeyError:
            cacheable = True
        idx = 0
        instId = ()
        parentIndices = []
        for impliedFlag, modName, symName in self._indexNames:
            if idx >= len(indices):
                break
            mibObj, = mibBuilder.importSymbols(modName, symName)
            syntax = mibObj.syntax.clone(indices[idx])
            instId += self.valueToOid(syntax, impliedFlag, parentIndices)
            parentIndices.append(syntax)
            idx += 1
        if cacheable:
            self._idxToIdCache[indices] = instId
        return instId
1210126
public static List<String> findIndexNames(final String root) throws IOException, URISyntaxException {
        if (root == null) {
            return findIndexNames();
        }

        logger.debug("Looking for indices in classpath under [{}].", root);

        final List<String> indexNames = new ArrayList<>();
        final Set<String> keys = new HashSet<>();
        String[] resources = ResourceList.getResources(root + "/"); // "es/" or "a/b/c/"
        for (String resource : resources) {
            if (!resource.isEmpty()) {
                logger.trace(" - resource [{}].", resource);
                String key;
                if (resource.contains("/")) {
                    key = resource.substring(0, resource.indexOf("/"));
                } else {
                    key = resource;
                }
                if (!key.equals(Defaults.TemplateDir) && !keys.contains(key)) {
                    logger.trace(" - found [{}].", key);
                    keys.add(key);
                    indexNames.add(key);
                }
            }
        }

        return indexNames;
    }
1349124
public @Nonnull List<String> getJobs() {
        List<String> r = new ArrayList<>();
        r.addAll(usages.keySet());
        Collections.sort(r);
        return r;
    }
1318444
public static Method[] candidateMethods(Method[] methods, Class<?>[] argTypes) {
        return candidates(methods, collectSignatures(methods), collectVarArgs(methods), argTypes);
    }
1012329
def process(self, candidates):
        
        return sorted(candidates, key=attrgetter('score'), reverse=self.reverse)
781562
def create_next_candidates(prev_candidates, length):
    
    # Solve the items.
    item_set = set()
    for candidate in prev_candidates:
        for item in candidate:
            item_set.add(item)
    items = sorted(item_set)

    # Create the temporary candidates. These will be filtered below.
    tmp_next_candidates = (frozenset(x) for x in combinations(items, length))

    # Return all the candidates if the length of the next candidates is 2
    # because their subsets are the same as items.
    if length < 3:
        return list(tmp_next_candidates)

    # Filter candidates that all of their subsets are
    # in the previous candidates.
    next_candidates = [
        candidate for candidate in tmp_next_candidates
        if all(
            True if frozenset(x) in prev_candidates else False
            for x in combinations(candidate, length - 1))
    ]
    return next_candidates
672801
def _candidates_from_grid(self, n=1000):
        """"""
        used_vectors = set(tuple(v) for v in self.X)

        # if every point has been used before, gridding is done.
        grid_size = self.grid_width ** len(self.tunables)
        if len(used_vectors) == grid_size:
            return None

        all_vectors = set(itertools.product(*self._grid_axes))
        remaining_vectors = all_vectors - used_vectors
        candidates = np.array(list(map(np.array, remaining_vectors)))

        np.random.shuffle(candidates)
        return candidates[0:n]
434058
public Iterator<AbstractJobInputVertex> getInputVertices() {

		final Collection<AbstractJobInputVertex> coll = this.inputVertices.values();

		return coll.iterator();
	}
48414
public int[] getVertexPointIndices() {
        int[] indices = new int[numVertices];
        for (int i = 0; i < numVertices; i++) {
            indices[i] = vertexPointIndices[i];
        }
        return indices;
    }
1082922
public int[] getIndices(long idx)
	{
		int xIndices = (int)idx%dim1;
		int yIndices = (int)(idx-xIndices)/dim1;
		int []Indices = {xIndices,yIndices};
		return Indices;
	}
1068160
function (idx) {
			// Ensures that an index is within the number of candidates
			if (idx >= json.length || idx < 0) {
				if (json.length == 0)
					throw new Error("Candidate index is out of bounds (no candidates returned; requested " + idx + ")");
				else
					throw new Error("Candidate index is out of bounds (" + json.length + " candidates; indicies 0 through " +
						(json.length - 1) + " available; requested " + idx + ")");
			}
		}
160095
public int[] getSelectedComponents ()
    {
        int[] values = new int[_selected.size()];
        Iterator<Integer> iter = _selected.values().iterator();
        for (int ii = 0; iter.hasNext(); ii++) {
            values[ii] = iter.next().intValue();
        }
        return values;
    }