Просмотр исходного кода

improve structure/unit areEqual methods

- always equal when objects are identical
Alexander Rose 2 лет назад
Родитель
Сommit
e7b35daf45
2 измененных файлов с 2 добавлено и 0 удалено
  1. 1 0
      src/mol-model/structure/structure/structure.ts
  2. 1 0
      src/mol-model/structure/structure/unit.ts

+ 1 - 0
src/mol-model/structure/structure/structure.ts

@@ -1059,6 +1059,7 @@ namespace Structure {
     }
     }
 
 
     export function areUnitIdsAndIndicesEqual(a: Structure, b: Structure) {
     export function areUnitIdsAndIndicesEqual(a: Structure, b: Structure) {
+        if (a === b) return true;
         if (!areUnitIdsEqual(a, b)) return false;
         if (!areUnitIdsEqual(a, b)) return false;
 
 
         for (let i = 0, il = a.units.length; i < il; i++) {
         for (let i = 0, il = a.units.length; i < il; i++) {

+ 1 - 0
src/mol-model/structure/structure/unit.ts

@@ -490,6 +490,7 @@ namespace Unit {
     }
     }
 
 
     export function areConformationsEqual(a: Unit, b: Unit) {
     export function areConformationsEqual(a: Unit, b: Unit) {
+        if (a === b) return true;
         if (!SortedArray.areEqual(a.elements, b.elements)) return false;
         if (!SortedArray.areEqual(a.elements, b.elements)) return false;
         return isSameConformation(a, b.model);
         return isSameConformation(a, b.model);
     }
     }