From all available landmarks pick just a few active ones
428906
boolean initActiveLandmarks(int fromNode, int toNode, int[] activeLandmarkIndices,
                                int[] activeFroms, int[] activeTos, boolean reverse) {
        if (fromNode < 0 || toNode < 0)
            throw new IllegalStateException("from " + fromNode + " and to "
                    + toNode + " nodes have to be 0 or positive to init landmarks");

        int subnetworkFrom = subnetworkStorage.getSubnetwork(fromNode);
        int subnetworkTo = subnetworkStorage.getSubnetwork(toNode);
        if (subnetworkFrom <= UNCLEAR_SUBNETWORK || subnetworkTo <= UNCLEAR_SUBNETWORK)
            return false;
        if (subnetworkFrom != subnetworkTo) {
            throw new ConnectionNotFoundException("Connection between locations not found. Different subnetworks " + subnetworkFrom + " vs. " + subnetworkTo, new HashMap<String, Object>());
        }

        int[] tmpIDs = landmarkIDs.get(subnetworkFrom);

        // kind of code duplication to approximate
        List<Map.Entry<Integer, Integer>> list = new ArrayList<>(tmpIDs.length);
        for (int lmIndex = 0; lmIndex < tmpIDs.length; lmIndex++) {
            int fromWeight = getFromWeight(lmIndex, toNode) - getFromWeight(lmIndex, fromNode);
            int toWeight = getToWeight(lmIndex, fromNode) - getToWeight(lmIndex, toNode);

            list.add(new MapEntry<>(reverse
                    ? Math.max(-fromWeight, -toWeight)
                    : Math.max(fromWeight, toWeight), lmIndex));
        }

        Collections.sort(list, SORT_BY_WEIGHT);

        if (activeLandmarkIndices[0] >= 0) {
            IntHashSet set = new IntHashSet(activeLandmarkIndices.length);
            set.addAll(activeLandmarkIndices);
            int existingLandmarkCounter = 0;
            final int COUNT = Math.min(activeLandmarkIndices.length - 2, 2);
            for (int i = 0; i < activeLandmarkIndices.length; i++) {
                if (i >= activeLandmarkIndices.length - COUNT + existingLandmarkCounter) {
                    // keep at least two of the previous landmarks (pick the best)
                    break;
                } else {
                    activeLandmarkIndices[i] = list.get(i).getValue();
                    if (set.contains(activeLandmarkIndices[i]))
                        existingLandmarkCounter++;
                }
            }

        } else {
            for (int i = 0; i < activeLandmarkIndices.length; i++) {
                activeLandmarkIndices[i] = list.get(i).getValue();
            }
        }

        // store weight values of active landmarks in 'cache' arrays
        for (int i = 0; i < activeLandmarkIndices.length; i++) {
            int lmIndex = activeLandmarkIndices[i];
            activeFroms[i] = getFromWeight(lmIndex, toNode);
            activeTos[i] = getToWeight(lmIndex, toNode);
        }
        return true;
    }
275152
function select(start, end, allDay) {
		currentView.select(start, end, allDay===undefined ? true : allDay);
	}
1228690
def location_on_land(self, coords_only=False):
        
        place = self.random_element(self.land_coords)
        return (place[0], place[1]) if coords_only else place
25472
def select_one(select, tag, namespaces=None, flags=0, **kwargs):
    """"""

    return compile(select, namespaces, flags, **kwargs).select_one(tag)
967096
def select_location(self):
        """"""
        location = osp.normpath(getexistingdirectory(self,
                                                     _("Select directory"),
                                                     self.location))

        if location:
            if is_writable(location):
                self.location = location
                self.update_location()
395401
def pickable(self, value=None):
        """"""
        if value is None:
            return self.GetPickable()
        else:
            self.SetPickable(value)
            return self
694959
def get_active_entry(user, select_for_update=False):
    """"""
    entries = apps.get_model('entries', 'Entry').no_join
    if select_for_update:
        entries = entries.select_for_update()
    entries = entries.filter(user=user, end_time__isnull=True)

    if not entries.exists():
        return None
    if entries.count() > 1:
        raise ActiveEntryError('Only one active entry is allowed.')
    return entries[0]
379533
def active(self):
        
        result = 0
        for actor in self.actors:
            if not actor.skip:
                result += 1
        return result
732269
function updatePossibleNavigations(element) {
  let canSelectNext;
  let canSelectPrevious;
  const items = element.items;
  if (items == null || items.length === 0) {
    // No items to select.
    canSelectNext = false;
    canSelectPrevious = false;
  } if (element.selectionWraps) {
    // Since there are items, can always go next/previous.
    canSelectNext = true;
    canSelectPrevious = true;
  } else {
    const index = element.selectedIndex;
    if (index < 0 && items.length > 0) {
      // Special case. If there are items but no selection, declare that it's
      // always possible to go next/previous to create a selection.
      canSelectNext = true;
      canSelectPrevious = true;
    } else {
      // Normal case: we have an index in a list that has items.
      canSelectPrevious = (index > 0);
      canSelectNext = (index < items.length - 1);
    }
  }
  if (element.canSelectNext !== canSelectNext) {
    element.canSelectNext = canSelectNext;
  }
  if (element.canSelectPrevious !== canSelectPrevious) {
    element.canSelectPrevious = canSelectPrevious;
  }
}
801075
def active(self):
        """"""
        # TODO avoid direct usage of transport object.
        marks = tuple(int(x) for x in transport.ask('MACT').split(','))
        return marks[1:]
472259
def _selection_by_callable(self, view, num_slices, non_empty_slices):
        """"""

        selected = [sl for sl in non_empty_slices
                    if self._sampler(self._get_axis(self._image, view, sl))]

        return selected[:num_slices]
1100414
def set_unavailable(self):
        """"""
        show = PresenceShow.NONE
        self.set_presence(PresenceState(available=False, show=show))
659133
def skip_all(self):
        """"""

        storage, streaming = self.engine.count()

        if self.selector.output:
            self.offset = streaming
        else:
            self.offset = storage

        self._count = 0
253798
private Node buildFromPoints(int lower, int upper) {
		if (upper == lower) {
			return null;
		}

		final Node node = new Node();
		node.index = lower;

		if (upper - lower > 1) {

			// choose an arbitrary vantage point and move it to the start
			int i = random.nextInt(upper - lower - 1) + lower;
			listSwap(items, lower, i);
			listSwap(indexes, lower, i);

			int median = (upper + lower + 1) / 2;

			// partition around the median distance
			// TODO: use the QuickSelect class?
			nthElement(lower + 1, upper, median, items[lower]);

			// what was the median?
			node.threshold = distance(items[lower], items[median]);

			node.index = lower;
			node.left = buildFromPoints(lower + 1, median);
			node.right = buildFromPoints(median, upper);
		}

		return node;
	}
1316880
private void selectPoint(int mx, int my) {
		if (!isEnabled()) {
			return;
		}
		
		for (int i=1;i<list.size()-1;i++) {
			if (checkPoint(mx,my,(ControlPoint) list.get(i))) {
				selected = (ControlPoint) list.get(i);
				return;
			}
		}
		if (checkPoint(mx,my,(ControlPoint) list.get(0))) {
			selected = (ControlPoint) list.get(0);
			return;
		}
		if (checkPoint(mx,my,(ControlPoint) list.get(list.size()-1))) {
			selected = (ControlPoint) list.get(list.size()-1);
			return;
		}
		
		selected = null;
	}
1081491
def randomLocation(cls, radius, width, height, origin=None):
        '''
        
        '''
        return cls(width,
                   height,
                   Point.randomLocation(radius, origin))
440189
def activateRandomLocation(self):
    
    self.bumpPhases = np.array([np.random.random(2)]).T
    self._computeActiveCells()