code: protected void setChangeType(Change change) {
      if (db.getTextNode(change.getKey()) == null) {
        // addition (key appears in the import source but not in the db)
        change.setType(Change.TYPE_KEY_ADDITION);
        return;
      }
  
      if (change.hasMasterLanguage()) {
        String dbMasterValue = change.getDbMasterValue();
        if (dbMasterValue == null) {
          // master language value does not exist in the db
          change.setType(Change.TYPE_MASTER_LANGUAGE_ADDITION);
          return;
        }
        if (!dbMasterValue.equals(change.getImportedMasterValue())) {
          // master language value has changed
          change.setType(Change.TYPE_MASTER_VALUE_CHANGED);
          return;
        }
      }
  
      // check the database value
      String dbValue = change.getDbValue();
      if (dbValue == null) {
        // value does not exist in the database
        change.setType(Change.TYPE_LANGUAGE_ADDITION);
        return;
      }
  
      String importedValue = change.getImportedValue();
      Status importedStatus = change.getImportedStatus();
  
      Status dbStatus = change.getDbStatus();
  
      if (dbValue.equals(importedValue)) {
        // values are the same, check status now
        if (importedStatus.compareTo(dbStatus) < 0) {
          change.setType(Change.TYPE_IMPORTED_STATUS_OLDER);
        } else if (importedStatus.compareTo(dbStatus) > 0) {
          change.setType(Change.TYPE_IMPORTED_STATUS_NEWER);
        }
      } else {
        // values have changed
        if (dbStatus == importedStatus) {
          change.setType(Change.TYPE_VALUE_CHANGED);
        } else {
          change.setType(Change.TYPE_VALUE_AND_STATUS_CHANGED);
        }
      }
    }
docs: Sets the change type of a given basic change (i.e. a change with
  the following attributes present: key, language, imported value,
  imported status).
  @param change the change