Interface DiagnosticFrequencyMap

  • All Superinterfaces:
    java.lang.Iterable<org.eclipse.emf.common.util.Diagnostic>
    All Known Implementing Classes:
    DiagnosticFrequencyMap.Limited, DiagnosticFrequencyMap.Unlimited

    public interface DiagnosticFrequencyMap
    extends java.lang.Iterable<org.eclipse.emf.common.util.Diagnostic>
    A simple collector of diagnostics that maps them in a histogram by severity. Collected diagnostics are iterated in decreasing severity order.
    Since:
    1.21
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  DiagnosticFrequencyMap.Limited
      A frequency map of limited size that collects up to and no more than a certain number of diagnostics, keeping the most severe of them.
      static class  DiagnosticFrequencyMap.Unlimited
      A frequency map of unlimited size that keeps all diagnostics added to it.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean add​(org.eclipse.emf.common.util.Diagnostic diagnostic)
      Add a diagnostic.
      default boolean addAll​(java.util.Collection<?> diagnostics)
      Add a bunch of diagnostics.
      void addDiagnosticFilter​(java.util.function.Predicate<? super org.eclipse.emf.common.util.Diagnostic> filter)
      Add a predicate that matches diagnostics that should be collected.
      default void appendTo​(java.util.Collection<? super org.eclipse.emf.common.util.Diagnostic> diagnostics)
      Append the diagnostics that I have collected, in decreasing severity order, to a collection of diagnostics.
      void clear()
      Remove all diagnostics and histogram counts.
      int getDiscardedSeverity()
      Query the greatest severity of diagnostics that had to be discarded because the map filled up.
      boolean isEmpty()
      Queries whether I am empty of any diagnostics.
      boolean isFull()
      Queries whether I am full to capacity, unable to accept any more diagnostics.
      static DiagnosticFrequencyMap limitedTo​(int size)
      Create a frequency map that retains at most the given number of most severe problems.
      int size()
      Queries the number of diagnostics that I contain.
      static DiagnosticFrequencyMap unlimited()
      Create a frequency map of unlimited size that keeps all diagnostics added to it.
      • Methods inherited from interface java.lang.Iterable

        forEach, iterator, spliterator
    • Method Detail

      • clear

        void clear()
        Remove all diagnostics and histogram counts.
      • size

        int size()
        Queries the number of diagnostics that I contain.
        Returns:
        my size
      • isEmpty

        boolean isEmpty()
        Queries whether I am empty of any diagnostics.
        Returns:
        true I have no diagnostics; false, otherwise
      • isFull

        boolean isFull()
        Queries whether I am full to capacity, unable to accept any more diagnostics.
        Returns:
        true if I have reached my limit of diagnostics; false, otherwise
      • getDiscardedSeverity

        int getDiscardedSeverity()
        Query the greatest severity of diagnostics that had to be discarded because the map filled up.
        Returns:
        the highest discarded severity, or Diagnostic.OK if no diagnostics were discarded
      • add

        boolean add​(org.eclipse.emf.common.util.Diagnostic diagnostic)
        Add a diagnostic.
        Parameters:
        diagnostic - a diagnostic to add
        Returns:
        true if it was added; false, otherwise, for example if I am full
      • addDiagnosticFilter

        void addDiagnosticFilter​(java.util.function.Predicate<? super org.eclipse.emf.common.util.Diagnostic> filter)
        Add a predicate that matches diagnostics that should be collected. Diagnostics that do not match the filter are discarded, but their severity is retained for separate reporting if the client should so wish. A diagnostic is only accepted that satisfies all filters (overall, it's a conjunction).
        Parameters:
        filter - a predicate matching diagnostics to accept
      • addAll

        default boolean addAll​(java.util.Collection<?> diagnostics)
        Add a bunch of diagnostics.
        Parameters:
        diagnostics - some diagnostics to add
        Returns:
        true if any of them were added; false if none
        See Also:
        add(Diagnostic)
      • appendTo

        default void appendTo​(java.util.Collection<? super org.eclipse.emf.common.util.Diagnostic> diagnostics)
        Append the diagnostics that I have collected, in decreasing severity order, to a collection of diagnostics.
        Parameters:
        diagnostics - a collection of diagnostics to append to
      • unlimited

        static DiagnosticFrequencyMap unlimited()
        Create a frequency map of unlimited size that keeps all diagnostics added to it.
        Returns:
        a new unlimited-size diagnostic frequency map
      • limitedTo

        static DiagnosticFrequencyMap limitedTo​(int size)
        Create a frequency map that retains at most the given number of most severe problems.
        Parameters:
        size - the maximal size of diagnostic collection
        Returns:
        a new limited-size diagnostic frequency map
        Throws:
        java.lang.IllegalArgumentException - if the size is negative