/**
   * Compare this against the given QueryRow for equality.
   *
   * <p>Implentation Note: This is used implicitly by -[LiveQuery update] to decide whether the
   * query result has changed enough to notify the client. So it's important that it not give false
   * positives, else the app won't get notified of changes.
   *
   * @param object the QueryRow to compare this instance with.
   * @return true if equal, false otherwise.
   */
  @Override
  @InterfaceAudience.Public
  public boolean equals(Object object) {
    if (object == this) {
      return true;
    }
    if (!(object instanceof QueryRow)) {
      return false;
    }
    QueryRow other = (QueryRow) object;

    if (database == other.database
        && Utils.isEqual(key, other.getKey())
        && Utils.isEqual(sourceDocID, other.getSourceDocumentId())
        && Utils.isEqual(documentRevision, other.documentRevision)) {
      // If values were emitted, compare them. Otherwise we have nothing to go on so check
      // if _anything_ about the doc has changed (i.e. the sequences are different.)
      if (value != null || other.getValue() != null) {
        return value.equals(other.getValue());
      } else {
        return sequence == other.sequence;
      }
    }
    return false;
  }
  public void testAllDocsQueryPerformance() throws CouchbaseLiteException {
    if (!performanceTestsEnabled()) return;

    long start = System.currentTimeMillis();
    Query query = database.createAllDocumentsQuery();
    query.setAllDocsMode(Query.AllDocsMode.ALL_DOCS);
    QueryEnumerator rowEnum = query.run();
    while (rowEnum.hasNext()) {
      QueryRow row = rowEnum.next();
      assertNotNull(row.getDocument());
    }
    long end = System.currentTimeMillis();
    logPerformanceStats((end - start), getNumberOfDocuments() + ", " + getSizeOfDocument());
  }