note cache breakup into classes, WIP

This commit is contained in:
zadam
2020-05-16 23:12:29 +02:00
parent e3071e630a
commit dcd371b5b1
23 changed files with 1174 additions and 1170 deletions

View File

@@ -0,0 +1,27 @@
export default class ExistsExp {
constructor(attributeType, attributeName) {
this.attributeType = attributeType;
this.attributeName = attributeName;
}
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)) {
if (attr.isInheritable) {
resultNoteSet.addAll(note.subtreeNotesIncludingTemplated);
}
else if (note.isTemplate) {
resultNoteSet.addAll(note.templatedNotes);
}
else {
resultNoteSet.add(note);
}
}
}
}
}