Skip to content

Commit

Permalink
Fix casing in merge list and improve Javadocs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmyers committed May 31, 2024
1 parent fbe0c33 commit 6526836
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
*
Expand Down Expand Up @@ -59,7 +60,7 @@ public enum MergeMode {
ADD,

/**
* Merges the two history objects, overwriting any parts of existing object
* Mode to merge the two history objects, overwriting any parts of existing object
* that the additions match. The final product is then sorted in the usual
* history order (first bare variables, then date objects in order).
* <p>
Expand Down Expand Up @@ -97,7 +98,7 @@ public enum MergeMode {
OVERWRITE,

/**
* Merges the two objects, overwriting any parts of the existing object
* Mode to merge the two objects, overwriting any parts of the existing object
* that the additions match, except for ObjectVariables whose name is
* in the set of elements not to merge.
* <p>
Expand Down Expand Up @@ -138,6 +139,12 @@ public enum MergeMode {
* @see initAutoMergeList
*/
AUTO,

/**
* Mode to merge the two objects, deleting any parts of the existing object that
* the modifications match. A date object will not be deleted unless all
* its contents have been deleted.
*/
DELETE
}

Expand All @@ -158,7 +165,7 @@ public ClausewitzHistoryMergeTool() {
* Reads province history files from the given data source in an attempt to
* deduce which items may appear more than once and which can only appear
* once. This information is used when merging objects with
* {@link MergeMode.AUTO}.
* {@code MergeMode.AUTO}.
* @param data
*/
public void initAutoMergeList(ClausewitzDataSource data) {
Expand All @@ -184,7 +191,7 @@ private void checkDuplicateValues(GenericObject obj) {
}

public void initAutoMergeList(Collection<String> notToMerge) {
elementsToNotMerge.addAll(notToMerge);
elementsToNotMerge.addAll(notToMerge.stream().map(String::toLowerCase).collect(Collectors.toList()));
}

public void mergeHistObjects(GenericObject existing, GenericObject modifications) {
Expand Down

0 comments on commit 6526836

Please sign in to comment.