+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Get all the event declarations in this stream.
+ *
+ * @return The event declarations for this stream
+ * @since 3.1
+ */
+ public @NonNull Collection<IEventDeclaration> getEventDeclarations() {
+ List<IEventDeclaration> retVal = new ArrayList<>(fEvents);
+ retVal.removeAll(Collections.<IEventDeclaration> singletonList(null));
+ return retVal;
+ }
+
+ /**
+ * Get the event declaration for a given ID.
+ *
+ * @param eventId
+ * The ID, can be {@link EventDeclaration#UNSET_EVENT_ID}, or any
+ * positive value
+ * @return The event declaration with the given ID for this stream, or
+ * 'null' if there are no declaration with this ID
+ * @throws IllegalArgumentException
+ * If the passed ID is invalid
+ * @since 3.1
+ */
+ public @Nullable IEventDeclaration getEventDeclaration(int eventId) {
+ int eventIndex = (eventId == EventDeclaration.UNSET_EVENT_ID) ? 0 : eventId;
+ if (eventIndex < 0) {
+ /* Any negative value other than UNSET_EVENT_ID is invalid */
+ throw new IllegalArgumentException("Event ID cannot be negative."); //$NON-NLS-1$
+ }
+ if (eventIndex >= fEvents.size()) {
+ /* This ID could be valid, but there are no declarations with it */
+ return null;
+ }
+ return fEvents.get(eventIndex);