Skip to content

Commit

Permalink
Implement code quality suggestions #323
Browse files Browse the repository at this point in the history
  • Loading branch information
pkiraly committed Dec 7, 2023
1 parent 14bb335 commit d8bdeb5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,38 +36,44 @@ public Marc21BibliographicRecord(String id) {
super(id);
}

@Override
public Control008 getControl008() {
return (Control008) this.control008;
}

@Override
public void setControl008(MarcPositionalControlField control008) {
this.control008 = control008;
control008.setMarcRecord(this);
controlfieldIndex.put(control008.getDefinition().getTag(), Arrays.asList(control008));
}


@Override
public List<DataField> getAuthorityFields() {
if (authorityTags == null) {
initializeAuthorityTags();
}
return getAuthorityFields(authorityTags);
}

@Override
public Map<DataField, AuthorityCategory> getAuthorityFieldsMap() {
if (authorityTags == null) {
initializeAuthorityTags();
}
return getAuthorityFields(authorityTagsMap);
}

@Override
public boolean isAuthorityTag(String tag) {
if (authorityTagsIndex == null) {
initializeAuthorityTags();
}
return authorityTagsIndex.getOrDefault(tag, false);
}

@Override
public boolean isSkippableAuthoritySubfield(String tag, String code) {
if (authorityTagsIndex == null)
initializeAuthorityTags();
Expand All @@ -78,13 +84,15 @@ public boolean isSkippableAuthoritySubfield(String tag, String code) {
return skippableAuthoritySubfields.get(tag).getOrDefault(tag, false);
}

@Override
public boolean isSubjectTag(String tag) {
if (subjectTagIndex == null) {
initializeAuthorityTags();
}
return subjectTagIndex.getOrDefault(tag, false);
}

@Override
public boolean isSkippableSubjectSubfield(String tag, String code) {
if (subjectTagIndex == null)
initializeAuthorityTags();
Expand Down Expand Up @@ -122,6 +130,7 @@ private void initializeAuthorityTags() {
authorityTagsMap.put(AuthorityCategory.OTHER, List.of("720", "753", "754"));
}

@Override
public Map<ThompsonTraillFields, List<String>> getThompsonTraillTagsMap() {
if (thompsonTraillTagMap == null)
initializeThompsonTraillTags();
Expand Down Expand Up @@ -152,6 +161,7 @@ private void initializeThompsonTraillTags() {
thompsonTraillTagMap.put(ThompsonTraillFields.COUNTRY_OF_PUBLICATION, Arrays.asList("008/15"));
}

@Override
public Map<ShelfReadyFieldsBooks, Map<String, List<String>>> getShelfReadyMap() {
if (shelfReadyMap == null)
initializeShelfReadyMap();
Expand Down

0 comments on commit d8bdeb5

Please sign in to comment.