Class NormalisedEventIterator


  • public class NormalisedEventIterator
    extends java.lang.Object
    NormalisedEventIterator implements an iterator interface similar to the C NormalisedEventIterator interface documented in the IAF manual, which can be used for iterating over the fields of a NormalisedEvent. The iterator takes a copy of the contents of the normalised event, so it may be used even after modifications have been made to the associated NormalisedEvent, although its contents will be stale.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean back()
      back Move the iterator to the previous element of the underlying normalised event instance.
      java.lang.String key()
      Return the key (name) associated with the current event element pointed to by the iterator.
      boolean next()
      Move the iterator to the next element of the underlying normalised event instance.
      boolean valid()
      Check whether the iterator points to a valid element of the normalised event.
      java.lang.String value()
      Return the value associated with the current event element pointed to by the iterator.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • valid

        public final boolean valid()
        Check whether the iterator points to a valid element of the normalised event. Typically used as part of the loop condition when iterating over the contents of an event.
        Returns:
        true if the iterator points to a valid element, false otherwise.
      • key

        public final java.lang.String key()
        Return the key (name) associated with the current event element pointed to by the iterator.
        Returns:
        The key/name of the current normalised event element
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - Thrown if valid() is false (due to no values being present, or iteration after the end of the available data.
      • value

        public final java.lang.String value()
        Return the value associated with the current event element pointed to by the iterator. The returned value may be an empty string "", or null to indicate a missing value.
        Returns:
        The value of the current normalised event element
        Throws:
        java.lang.ArrayIndexOutOfBoundsException - Thrown if valid() is false (due to no values being present, or iteration after the end of the available data.
      • next

        public final boolean next()
        Move the iterator to the next element of the underlying normalised event instance. The iterator must be in a valid state (such that the valid() function would return true) before this function is called. Note that the order in which elements is returned is not necessarily the same as the order in which they were added. The order may change as elements are added to or removed from the underlying event.
        Returns:
        true if the iterator still points to a valid event element after moving forwards, false otherwise.
      • back

        public final boolean back()
        back Move the iterator to the previous element of the underlying normalised event instance. The iterator must be in a valid state (such that the valid() function would return true) before this function is called. Note that the order in which elements is returned is not necessarily the same as the order in which they were added. The order may change as elements are added to or removed from the underlying event.
        Returns:
        true if the iterator still points to a valid event element after moving backwards, false otherwise.