private static StructureType getEquivalent(StructureType type, Map<ASAtom, ASAtom> rootRoleMap) { PDStructureNameSpace nameSpace = type.getNameSpace(); if (nameSpace != null) { PDNameSpaceRoleMapping nameSpaceMapping = nameSpace.getNameSpaceMapping(); if (nameSpaceMapping != null) { return nameSpaceMapping.getEquivalentType(type.getType()); } else if (!PDF_NAMESPACE.equals(nameSpace.getNS())) { return null; } } ASAtom equiv = rootRoleMap.get(type.getType()); return equiv == null ? null : StructureType.createStructureType(equiv); }
public static StructureType createStructureType(ASAtom type) { if (type != null) { return new StructureType(type, null); } return null; }
private static void addVisited(StructureType type) { ASAtom structType = type.getType(); PDStructureNameSpace nameSpace = type.getNameSpace(); if (nameSpace != null) { COSKey key = nameSpace.getObject().getObjectKey(); Set<COSKey> nameSpaces; if (visitedWithNS.containsKey(structType)) { nameSpaces = visitedWithNS.get(structType); } else { nameSpaces = new HashSet<>(); visitedWithNS.put(structType, nameSpaces); } nameSpaces.add(key); } else { visitedWithoutNS.add(structType); } }
@Override public String getstandardType() { if (StaticContainers.getFlavour().getPart() == PDFAFlavour.Specification.ISO_19005_4) { StructureType defaultStructureType = ((org.verapdf.pd.structure.PDStructElem) simplePDObject).getDefaultStructureType(); if (defaultStructureType != null) { return defaultStructureType.getType().getValue(); } } else { StructureType type = ((org.verapdf.pd.structure.PDStructElem) simplePDObject).getStructureType(); if (type != null) { return StaticContainers.getRoleMapHelper().getStandardType(type.getType()); } } return null; }
public static StructureType createStructureType(COSObject object) { if (object == null) { throw new IllegalArgumentException("Argument object can not be null"); } COSObjType objType = object.getType(); if (objType == COSObjType.COS_NAME) { return createStructureType(object, null); } else if (objType == COSObjType.COS_ARRAY && object.size() >= 2) { return createStructureType(object.at(0), object.at(1)); } return null; }
private static boolean isVisited(StructureType type) { ASAtom structType = type.getType(); PDStructureNameSpace nameSpace = type.getNameSpace(); if (nameSpace != null) { if (visitedWithNS.containsKey(structType)) { Set<COSKey> nameSpaces = visitedWithNS.get(structType); COSKey key = nameSpace.getObject().getObjectKey(); return nameSpaces.contains(key); } else { return false; } } else { return visitedWithoutNS.contains(structType); } }
public StructureType getEquivalentType(ASAtom type) { if (knownKey(type)) { return StructureType.createStructureType(getKey(type)); } return null; } }
private static boolean isStandardType(StructureType type) { String structureType = type.getType().getValue(); PDStructureNameSpace nameSpace = type.getNameSpace(); if (nameSpace != null) { switch (nameSpace.getNS()) { case PDF_NAMESPACE: return PDF_1_7_STANDART_ROLE_TYPES.contains(structureType); case PDF2_NAMESPACE: return PDF_2_0_STANDART_ROLE_TYPES.contains(structureType) || structureType.matches("^H[1-9][0-9]*$"); case MATH_ML_NAMESPACE: return true; default: return false; } } else { return PDF_1_7_STANDART_ROLE_TYPES.contains(structureType); } }
public StructureType getStructureType() { return StructureType.createStructureType(getKey(ASAtom.S), getKey(ASAtom.NS)); }
public static StructureType createStructureType(COSObject type, COSObject ns) { if (type != null && type.getType() == COSObjType.COS_NAME) { if (ns != null && ns.getType() == COSObjType.COS_DICT) { return new StructureType(type.getName(), PDStructureNameSpace.createNameSpace(ns)); } else { return new StructureType(type.getName(), null); } } return null; }