Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update getTag for GFOpMarkedContent #611

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,25 @@ public List<? extends Object> getLinkedObjects(String link) {
}
}

public List<CosName> getTag() {
if (this.arguments.size() > 1) {
COSBase name = this.arguments.get(this.arguments.size() - 2);
if (name.getType() == COSObjType.COS_NAME) {
List<CosName> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
list.add(new GFCosName((COSName) name));
return Collections.unmodifiableList(list);
}
public List<CosName> getLinkTag() {
COSName tag = getTag();
if (tag != null) {
List<CosName> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
list.add(new GFCosName(tag));
return Collections.unmodifiableList(list);
}
return Collections.emptyList();
}

public COSName getTag() {
if (this.arguments.size() > 1) {
COSBase name = this.arguments.get(this.arguments.size() - 2);
if (name.getType() == COSObjType.COS_NAME) {
return (COSName) name;
}
}
return null;
}

protected List<CosDict> getPropertiesDict() {
if (this.propertiesDict != null) {
Expand All @@ -122,10 +130,10 @@ public List<CosLang> getLang() {
}

public String getParentsTags() {
List<CosName> tagList = getTag();
COSName tagName = getTag();
String tag = "";
if (tagList.size() != 0) {
tag = tagList.get(0).getinternalRepresentation();
if (tagName != null) {
tag = tagName.getString();
}
String parentsTags = "";
if (markedContent != null) {
Expand Down Expand Up @@ -241,13 +249,7 @@ public COSString getInheritedStringAttribute(ASAtom key) {
if (string != null) {
return string;
}
if (markedContent != null) {
string = markedContent.getInheritedStringAttribute(key);
if (string != null) {
return string;
}
}
return null;
return markedContent != null ? markedContent.getInheritedStringAttribute(key) : null;
}

public COSString getStringAttribute(ASAtom key) {
Expand All @@ -261,13 +263,7 @@ public Long getInheritedMCID() {
if (mcid != null) {
return mcid;
}
if (markedContent != null) {
mcid = markedContent.getInheritedMCID();
if (mcid != null) {
return mcid;
}
}
return null;
return markedContent != null ? markedContent.getInheritedMCID() : null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public List<? extends Object> getLinkedObjects(
String link) {
switch (link) {
case TAG:
return this.getTag();
return this.getLinkTag();
case PROPERTIES:
return this.getPropertiesDict();
case LANG:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public GFOp_BMC(List<COSBase> arguments, GFOpMarkedContent markedContent, String
public List<? extends Object> getLinkedObjects(String link) {
switch (link) {
case TAG:
return this.getTag();
return this.getLinkTag();
case PROPERTIES:
return this.getPropertiesDict();
default:
Expand All @@ -58,16 +58,14 @@ public List<? extends Object> getLinkedObjects(String link) {
}

@Override
public List<CosName> getTag() {
if (!this.arguments.isEmpty()) {
COSBase name = this.arguments.get(this.arguments.size() - 1);
if (name.getType() == COSObjType.COS_NAME) {
List<CosName> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
list.add(new GFCosName((COSName) name));
return Collections.unmodifiableList(list);
}
}
return Collections.emptyList();
}
public COSName getTag() {
if (!this.arguments.isEmpty()) {
COSBase name = this.arguments.get(this.arguments.size() - 1);
if (name.getType() == COSObjType.COS_NAME) {
return (COSName) name;
}
}
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public List<? extends Object> getLinkedObjects(
String link) {
switch (link) {
case TAG:
return this.getTag();
return this.getLinkTag();
case PROPERTIES:
return this.getPropertiesDict();
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,21 @@ public GFOp_MP(List<COSBase> arguments) {
}

@Override
public List<? extends Object> getLinkedObjects(
String link) {
public List<? extends Object> getLinkedObjects(String link) {
if (TAG.equals(link)) {
return this.getTag();
return this.getLinkTag();
}
return super.getLinkedObjects(link);
}

@Override
public List<CosName> getTag() {
public COSName getTag() {
if (!this.arguments.isEmpty()) {
COSBase name = this.arguments.get(this.arguments.size() - 1);
if (name.getType() == COSObjType.COS_NAME) {
List<CosName> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
list.add(new GFCosName((COSName) name));
return Collections.unmodifiableList(list);
return (COSName) name;
}
}
return Collections.emptyList();
return null;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
package org.verapdf.gf.model.impl.pd.gfse.contents;

import org.verapdf.as.ASAtom;
import org.verapdf.cos.COSName;
import org.verapdf.cos.COSObject;
import org.verapdf.cos.COSString;
import org.verapdf.gf.model.impl.operator.inlineimage.GFOp_EI;
Expand Down Expand Up @@ -140,11 +141,8 @@ public String getExtraContext() {

@Override
public String gettag() {
List<CosName> tag = operator.getTag();
if (tag != null && tag.size() != 0) {
return tag.get(0).getinternalRepresentation();
}
return null;
COSName tag = operator.getTag();
return tag != null ? tag.getString() : null;
}

@Override
Expand Down
Loading