-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b1be7a
commit b6f4c57
Showing
11 changed files
with
335 additions
and
19 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
src/main/java/org/verapdf/wcag/algorithms/entities/AnnotationNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/java/org/verapdf/wcag/algorithms/entities/IAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/main/java/org/verapdf/wcag/algorithms/entities/SemanticAnnot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package org.verapdf.wcag.algorithms.entities; | ||
|
||
import org.verapdf.wcag.algorithms.entities.enums.SemanticType; | ||
|
||
import java.util.LinkedList; | ||
import java.util.List; | ||
|
||
public class SemanticAnnot extends SemanticNode { | ||
|
||
protected final List<AnnotationNode> annotationNodes = new LinkedList<>(); | ||
|
||
public SemanticAnnot(SemanticAnnot annotationNode) { | ||
this.addAnnots(annotationNode.getAnnots()); | ||
setSemanticType(SemanticType.ANNOT); | ||
} | ||
|
||
public SemanticAnnot(AnnotationNode annotationNode) { | ||
super(annotationNode.getBoundingBox()); | ||
this.annotationNodes.add(annotationNode); | ||
setSemanticType(SemanticType.ANNOT); | ||
} | ||
|
||
public void addAnnots(List<AnnotationNode> annots) { | ||
this.annotationNodes.addAll(annots); | ||
for (AnnotationNode annotationNode : annots) { | ||
getBoundingBox().union(annotationNode.getBoundingBox()); | ||
} | ||
} | ||
|
||
public List<AnnotationNode> getAnnots() { | ||
return annotationNodes; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (!super.equals(o)) { | ||
return false; | ||
} | ||
if (!(o instanceof SemanticAnnot)) { | ||
return false; | ||
} | ||
SemanticAnnot that = (SemanticAnnot) o; | ||
return this.annotationNodes.equals(that.getAnnots()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
int result = super.hashCode(); | ||
result = 31 * result + annotationNodes.size(); | ||
for (AnnotationNode annotationNode : annotationNodes) { | ||
result = 31 * result + annotationNode.hashCode(); | ||
} | ||
return result; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder result = new StringBuilder("SemanticAnnot{"); | ||
result.append("pageNumber="); | ||
result.append(getBoundingBox().getPageNumber()); | ||
result.append(", boundingBox="); | ||
result.append(getBoundingBox()); | ||
result.append("}"); | ||
return result.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.