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 classDiagnosticFrequencyMap.LimitedA 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 classDiagnosticFrequencyMap.UnlimitedA 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 booleanadd(org.eclipse.emf.common.util.Diagnostic diagnostic)Add a diagnostic.default booleanaddAll(java.util.Collection<?> diagnostics)Add a bunch of diagnostics.voidaddDiagnosticFilter(java.util.function.Predicate<? super org.eclipse.emf.common.util.Diagnostic> filter)Add a predicate that matches diagnostics that should be collected.default voidappendTo(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 ofdiagnostics.voidclear()Remove all diagnostics and histogram counts.intgetDiscardedSeverity()Query the greatest severity of diagnostics that had to be discarded because the map filled up.booleanisEmpty()Queries whether I am empty of any diagnostics.booleanisFull()Queries whether I am full to capacity, unable to accept any more diagnostics.static DiagnosticFrequencyMaplimitedTo(int size)Create a frequency map that retains at most the given number of most severe problems.intsize()Queries the number of diagnostics that I contain.static DiagnosticFrequencyMapunlimited()Create a frequency map of unlimited size that keeps all diagnostics added to it.
-
-
-
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:
trueI have no diagnostics;false, otherwise
-
isFull
boolean isFull()
Queries whether I am full to capacity, unable to accept any more diagnostics.- Returns:
trueif 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.OKif no diagnostics were discarded
-
add
boolean add(org.eclipse.emf.common.util.Diagnostic diagnostic)
Add a diagnostic.- Parameters:
diagnostic- a diagnostic to add- Returns:
trueif 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 allfilters (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:
trueif any of them were added;falseif 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 ofdiagnostics.- 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-
sizediagnostic frequency map - Throws:
java.lang.IllegalArgumentException- if thesizeis negative
-
-