Gets index of the given timeline event

@param event given event
@return int positive index or -1 if the given event is not available in the timeline
766398
public int getIndex(TimelineEvent event) {
        int index = -1;

        if (event != null) {
            for (int i = 0; i < events.size(); i++) {
                if (events.get(i).equals(event)) {
                    index = i;

                    break;
                }
            }
        }

        return index;
    }
1165015
public int getIndex(String feature)
	{
		//logger.debug("FeatureIndex.get : " + feature + "(" + count + ")");
		Integer index = (Integer) map.get(feature);

		if (index == null)
			return -1;

		return index.intValue();
	}
60606
public int getIndex(T value) {
        int count = getItemCount();
        for (int i = 0; i < count; i++) {
            if (Objects.equals(getValue(i), value)) {
                return i;
            }
        }
        return -1;
    }
594999
public void setEvent(int index, int event) {
        if (events == null || index < 0 || index >= events.length) {
            throw new IndexOutOfBoundsException("index = " + index + ", limit = " + (events == null ? "null" : events.length));
        }

        events[index] = (byte)event;
    }
1036882
public void update(TimelineEvent event, TimelineUpdater timelineUpdater) {
        int index = getIndex(event);
        if (index >= 0) {
            events.set(index, event);

            if (timelineUpdater != null) {
                // update UI
                timelineUpdater.update(event, index);
            }
        }
    }
1047934
public static function on($event, $fn, $priority = 0)
    {
        if (!static::bound($event)) {
            static::$events[$event] = [];
        }

        static::$events[$event][] = new Listener($fn, $priority);

        uasort(static::$events[$event], function (Listener $a, Listener $b) {
            return $a->getPriority() < $b->getPriority();
        });
    }
121121
def get_index(self):
        ''''''
        index = 0
        # Go down until you reach the newest frame:
        iter_frame = self
        while iter_frame.newer():
            index += 1
            iter_frame = iter_frame.newer()
        return index
145672
protected function get_course_timestamp_limits($event) {
        $values = [];
        $mapper = container::get_event_mapper();
        $starttime = $event->get_times()->get_start_time();

        list($min, $max) = component_callback(
            'core_course',
            'core_calendar_get_valid_event_timestart_range',
            [$mapper->from_event_to_legacy_event($event), $event->get_course()->get_proxied_instance()],
            [false, false]
        );

        // The callback will return false for either of the
        // min or max cutoffs to indicate that there are no
        // valid timestart values. In which case the event is
        // not draggable.
        if ($min === false || $max === false) {
            return ['draggable' => false];
        }

        if ($min) {
            $values = array_merge($values, $this->get_timestamp_min_limit($starttime, $min));
        }

        if ($max) {
            $values = array_merge($values, $this->get_timestamp_max_limit($starttime, $max));
        }

        return $values;
    }
1122315
protected Coordinate getPanPosition(MouseEvent<?> event) {
		if (snappingActive) {
			return getTransformer().worldToPan(getWorldPosition(event));
		}
		return super.getPanPosition(event);
	}
136808
function(timeline) {
        let eventIndex;

        const events = timeline.getEvents();

        if (!initialEventId) {
            // we were looking for the live timeline: initialise to the end
            eventIndex = events.length;
        } else {
            for (let i = 0; i < events.length; i++) {
                if (events[i].getId() == initialEventId) {
                    eventIndex = i;
                    break;
                }
            }

            if (eventIndex === undefined) {
                throw new Error("getEventTimeline result didn't include requested event");
            }
        }

        const endIndex = Math.min(events.length,
                                eventIndex + Math.ceil(initialWindowSize / 2));
        const startIndex = Math.max(0, endIndex - initialWindowSize);
        self._start = new TimelineIndex(timeline, startIndex - timeline.getBaseIndex());
        self._end = new TimelineIndex(timeline, endIndex - timeline.getBaseIndex());
        self._eventCount = endIndex - startIndex;
    }
1304888
public final int getIndex( int coordinate[] ) {
		int index = coordinate[0]*strides[0];
		for (int i = 1; i < coordinate.length; i++) {
			index += strides[i]*coordinate[i];
		}

		return index;
	}
1254700
public static TimelineUpdater getCurrentInstance(String id) {
        FacesContext fc = FacesContext.getCurrentInstance();

        @SuppressWarnings("unchecked")
        Map<String, TimelineUpdater> map = (Map<String, TimelineUpdater>) fc.getAttributes().get(TimelineUpdater.class.getName());
        if (map == null) {
            return null;
        }

        UIComponent timeline = fc.getViewRoot().findComponent(id);
        if (timeline == null || !(timeline instanceof Timeline)) {
            throw new FacesException("Timeline component with Id " + id + " was not found");
        }

        TimelineUpdater timelineUpdater = map.get(((Timeline) timeline).resolveWidgetVar());
        if (timelineUpdater != null) {
            timelineUpdater.id = id;
        }

        return timelineUpdater;
    }
460029
public function dispatch(Event $event)
        {
            $message = sprintf(self::FMT_INF_DISPATCHING, $event->getId(), count($this->subscriptions));
            $this->logger->info($message);

            $dispatchCount = 0;

            foreach ($this->subscriptions as $subscription) {
                $result = $this->tryDispatch($subscription, $event);

                $dispatchCount += (int)$result;
            }

            $message = sprintf(self::FMT_INF_DISPATCHED, $event->getId(), $dispatchCount);
            $this->logger->info($message);

            return $dispatchCount;
        }
1041752
public function handlePreIndex(PreIndexEvent $event)
    {
        $metadata = $event->getMetadata();
        $reflection = $metadata->getClassMetadata()->reflection;

        if (
            false === $reflection->isSubclassOf(FileVersionMeta::class)
            && FileVersionMeta::class !== $metadata->getName()) {
            return;
        }

        $document = $event->getDocument();
        $subject = $event->getSubject();
        $locale = $subject->getLocale();

        $fileVersion = $subject->getFileVersion();
        $file = $fileVersion->getFile();
        $media = $file->getMedia();

        // Do not try and get the image URL if the mime type is not in the
        // list of mime types for which thumbnails are generated.
        foreach ($this->thumbnailMimeTypes as $type) {
            if (fnmatch($type, $fileVersion->getMimeType())) {
                $document->setImageUrl($this->getImageUrl($media, $locale));
                break;
            }
        }

        $document->addField($this->factory->createField(
            'media_id',
            $media->getId()
        ));

        $document->addField($this->factory->createField(
            'media_mime',
            $fileVersion->getMimeType()
        ));

        if ($collection = $media->getCollection()) {
            $document->addField($this->factory->createField(
                'collection_id',
                $collection->getId()
            ));
        }
    }
881114
public int getValueIndex() {

        int result = 0;
        Node previousSibling = getElement().getPreviousSibling();
        while (previousSibling != null) {
            result++;
            previousSibling = previousSibling.getPreviousSibling();
        }
        return result;
    }
194740
public int indexOf(Object o) {
		try {
			for (int i = 0; i < events.size(); i++) {
				if (events.get(i).equals(o)) {
					return i;
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return -1;
	}
1065268
protected Integer getCorrectIndex(Integer index) {
    Integer size = jsonNode.size();
    Integer newIndex = index;

    // reverse walking through the array
    if(index < 0) {
      newIndex = size + index;
    }

    // the negative index would be greater than the size a second time!
    if(newIndex < 0) {
      throw LOG.indexOutOfBounds(index, size);
    }

    // the index is greater as the actual size
    if(index > size) {
     throw LOG.indexOutOfBounds(index, size);
    }

    return newIndex;
  }