GraveDecision ( @NotNull FileMarkupInfo newMarkup, @Nullable FileMarkupInfo oldMarkup, @Nullable Boolean isNewMoreRelevant ) { if (oldMarkup == null && !newMarkup.isEmpty()) { // put zombie's limbs return STORE_NEW; } if (oldMarkup == null) { // no a limb to put in grave return KEEP_OLD; } if (oldMarkup.contentHash() != newMarkup.contentHash() && !newMarkup.isEmpty()) { // fresh limbs return STORE_NEW; } if (oldMarkup.contentHash() != newMarkup.contentHash()) { // graved zombie is rotten and there is no a limb to bury return REMOVE_OLD; } if (newMarkup.isEmpty()) { // graved zombie is still fresh return KEEP_OLD; } if (isNewMoreRelevant == null) { // should never happen. file is closed without being opened before return STORE_NEW; } if (isNewMoreRelevant) { // limbs form complete zombie return STORE_NEW; } return KEEP_OLD; }