33 lines
957 B
JavaScript
Raw Normal View History

2020-05-17 09:48:24 +02:00
"use strict";
class EqualsExp {
2020-05-16 23:12:29 +02:00
constructor(attributeType, attributeName, attributeValue) {
this.attributeType = attributeType;
this.attributeName = attributeName;
this.attributeValue = attributeValue;
}
execute(noteSet) {
const attrs = findAttributes(this.attributeType, this.attributeName);
const resultNoteSet = new NoteSet();
for (const attr of attrs) {
const note = attr.note;
if (noteSet.hasNoteId(note.noteId) && attr.value === this.attributeValue) {
if (attr.isInheritable) {
resultNoteSet.addAll(note.subtreeNotesIncludingTemplated);
}
else if (note.isTemplate) {
resultNoteSet.addAll(note.templatedNotes);
}
else {
resultNoteSet.add(note);
}
}
}
}
}
2020-05-17 09:48:24 +02:00
module.exports = EqualsExp;