Skip to content

Commit

Permalink
Fix getRoleMapToSameNamespaceTag and isCircularMappingExist
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Jul 15, 2024
1 parent 9e41c4f commit 7d91d94
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main/java/org/verapdf/tools/TaggedPDFHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ public static String getRoleMapToSameNamespaceTag(StructureType type) {
StructureType curr = getEquivalent(prev, Collections.emptyMap());
Map<String, ASAtom> processedTypes = new HashMap<>();
while (curr != null) {
if (prev.getNameSpaceURI() != null) {
processedTypes.put(prev.getNameSpaceURI(), prev.getType());
}
if (curr.getNameSpaceURI() != null && processedTypes.containsKey(curr.getNameSpaceURI())) {
ASAtom processedType = processedTypes.get(curr.getNameSpaceURI());
if (curr.getType() != null && !Objects.equals(curr.getType(), processedType)) {
Expand All @@ -196,9 +199,6 @@ public static String getRoleMapToSameNamespaceTag(StructureType type) {
if (isVisited(curr)) {
return null;
}
if (curr.getNameSpaceURI() != null) {
processedTypes.put(curr.getNameSpaceURI(), curr.getType());
}
addVisited(curr);
prev = curr;
curr = getEquivalent(prev, Collections.emptyMap());
Expand All @@ -217,6 +217,9 @@ public static Boolean isCircularMappingExist(StructureType type) {
StructureType curr = getEquivalent(prev, Collections.emptyMap());
Map<String, ASAtom> processedTypes = new HashMap<>();
while (curr != null) {
if (prev.getNameSpaceURI() != null) {
processedTypes.put(prev.getNameSpaceURI(), prev.getType());
}
if (curr.getNameSpaceURI() != null && processedTypes.containsKey(curr.getNameSpaceURI())) {
ASAtom processedType = processedTypes.get(curr.getNameSpaceURI());
if (curr.getType() != null && Objects.equals(curr.getType(), processedType)) {
Expand All @@ -226,9 +229,6 @@ public static Boolean isCircularMappingExist(StructureType type) {
if (isVisited(curr)) {
return false;
}
if (curr.getNameSpaceURI() != null) {
processedTypes.put(curr.getNameSpaceURI(), curr.getType());
}
addVisited(curr);
prev = curr;
curr = getEquivalent(prev, Collections.emptyMap());
Expand Down

0 comments on commit 7d91d94

Please sign in to comment.