From c04809cd98b79b346fdd42caaa785f62284fcd93 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 26 Jun 2024 23:01:06 +0300 Subject: [PATCH] Update GFPDExtGState methods --- .../gf/model/impl/pd/GFPDExtGState.java | 57 +++++++++---------- 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDExtGState.java b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDExtGState.java index 1d3321f54..26fa2f95e 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDExtGState.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/GFPDExtGState.java @@ -60,26 +60,6 @@ public GFPDExtGState(org.verapdf.pd.PDExtGState state) { super(state, EXT_G_STATE_TYPE); } - @Override - public String getTR() { - return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSTR()); - } - - @Override - public String getTR2() { - return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSTR2()); - } - - @Override - public String getSMask() { - return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSSMask()); - } - - @Override - public String getBM() { - return getStringProperty(((org.verapdf.pd.PDExtGState) simplePDObject).getCOSBM()); - } - private List getlinkBM() { COSObject BM = ((org.verapdf.pd.PDExtGState)simplePDObject).getCOSBM(); if (BM == null || BM.empty() || BM.getType() == COSObjType.COS_NULL) { @@ -130,17 +110,19 @@ public Double getCA() { return 2.0; // check is failed } - private static String getStringProperty(COSObject property) { - if (property == null - || property.empty() - || property.getType() == COSObjType.COS_NULL) { - return null; - } + @Override + public String getTR2NameValue() { + return simplePDObject.getNameKeyStringValue(ASAtom.TR2); + } - if (property.getType() == COSObjType.COS_NAME) { - return property.getName().getValue(); - } - return property.toString(); + @Override + public Boolean getcontainsTR() { + return simplePDObject.knownKey(ASAtom.TR); + } + + @Override + public Boolean getcontainsTR2() { + return simplePDObject.knownKey(ASAtom.TR2); } @Override @@ -153,6 +135,21 @@ public Boolean getcontainsHTO() { return this.simplePDObject.knownKey(ASAtom.HTO); } + @Override + public String getSMaskNameValue() { + return simplePDObject.getNameKeyStringValue(ASAtom.SMASK); + } + + @Override + public Boolean getcontainsSMask() { + return simplePDObject.knownKey(ASAtom.SMASK); + } + + @Override + public String getBMNameValue() { + return simplePDObject.getNameKeyStringValue(ASAtom.BM); + } + @Override public List getLinkedObjects(String link) { switch (link) {