nl.tudelft.ewi.auta.srf.model.NoteCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of auta-srf Show documentation
Show all versions of auta-srf Show documentation
A facade for metric script executors
The newest version!
package nl.tudelft.ewi.auta.srf.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.stream.Collectors;
/**
* The collection of notes returned by a script.
*/
public class NoteCollection {
/**
* The note messages generated by the script.
*/
private Collection notes = new ArrayList<>();
/**
* Returns all notes in the collection.
*
* @return all notes
*/
public Collection getNotes() {
return this.notes;
}
/**
* Replaces the notes in the collection.
*
* @param notes the new notes
*/
public void setNotes(final Collection notes) {
this.notes = notes;
}
/**
* Returns all notes with the given severity in the collection.
*
* @param severity the severity to filter by
*
* @return all notes with that severity
*/
public Collection getNotesBySeverity(final Severity severity) {
return this.notes.stream()
.filter(n -> n.getSeverity() == severity)
.collect(Collectors.toList());
}
/**
* Adds a note to the collection.
*
* @param note the note to add
*/
public void addNote(final Note note) {
this.notes.add(note);
}
}