mirror of
https://github.com/keymanapp/keyman.git
synced 2026-10-10 07:57:28 +00:00
fix(web): add code, comment fixes from PR review
This commit is contained in:
parent
1755556a20
commit
c6e492313b
2 changed files with 10 additions and 4 deletions
|
|
@ -195,9 +195,15 @@ export class SearchQuotientCluster implements SearchQuotientNode {
|
|||
return false;
|
||||
}
|
||||
|
||||
// We need to check if the parents match. Done naively in the manner below, this is O(N^2).
|
||||
// Granted, we shouldn't have _that_ many incoming paths.
|
||||
if(this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
|
||||
// We need to check if the parents match.
|
||||
// First, is the parent count the same?
|
||||
if(this.parents.length != space.parents.length) {
|
||||
return false;
|
||||
} else if (this.parents.find((path) => !space.parents.find((path2) => path.isSameNode(path2)))) {
|
||||
// Done naively in the manner above, checking each pair of nodes, to
|
||||
// ensure a match is found for each, is O(N^2).
|
||||
//
|
||||
// Granted, we shouldn't have _that_ many incoming paths.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ export abstract class SearchQuotientSpur implements SearchQuotientNode {
|
|||
}
|
||||
|
||||
isSameNode(space: SearchQuotientNode): boolean {
|
||||
// Easiest cases: when the instances or their ' `spaceId` matches, we have
|
||||
// Easiest cases: when the instances or their `spaceId` matches, we have
|
||||
// a perfect match.
|
||||
if(this == space || this.spaceId == space.spaceId) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue