private boolean isFlagBitSet(int bitNumber) { Long f = getIntegerKey(ASAtom.F); return f != null && (f.intValue() & (1 << bitNumber)) != 0; } }
public PDOutlineItem getNext() { return getOutlineItem(ASAtom.NEXT); }
private static Map<String, PDOutlineItem> getOutlinesMap(Deque<PDOutlineItem> stack) { Map<String, PDOutlineItem> result = new HashMap<>(); do { PDOutlineItem item = stack.pop(); PDOutlineItem nextSibling = item.getNext(); PDOutlineItem firstChild = item.getFirst(); if (nextSibling != null && !result.containsKey(nextSibling)) { stack.add(nextSibling); } if (firstChild != null && !result.containsKey(firstChild)) { stack.add(firstChild); } result.put(GFIDGenerator.generateID(item), item); } while (!stack.isEmpty()); return result; } }
private List<PDAction> getAction() { org.verapdf.pd.actions.PDAction action = ((PDOutlineItem) this.simplePDObject).getAction(); if (action != null) { List<PDAction> actions = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS); PDAction pdAction = GFPDAction.getAction(action); actions.add(pdAction); return Collections.unmodifiableList(actions); } return Collections.emptyList(); } }
private static List<PDOutlineItem> getPDChildren(PDOutlineDictionary dictionary) { List<PDOutlineItem> res = new ArrayList<>(); PDOutlineItem curr = dictionary.getFirst(); while (curr != null) { res.add(curr); curr = curr.getNext(); } return res; }
public static String generateID(PDOutlineItem item) { COSObject dictionary = item.getObject(); String value = getOutlineID(dictionary, ASAtom.PREV, ASAtom.NEXT); return value != null ? value : getOutlineID(dictionary, ASAtom.PARENT, ASAtom.FIRST); }
public PDAction getAction() { COSObject action = getKey(ASAtom.A); if (action != null && action.getType().isDictionaryBased()) { return new PDAction(action); } return null; }
protected PDOutlineItem getOutlineItem(ASAtom key) { COSObject first = getKey(key); if (first != null && first.getType().isDictionaryBased()) { return new PDOutlineItem(first); } return null; } }
public double[] getColor() { COSObject arr = getKey(ASAtom.C); if (arr != null && arr.getType() == COSObjType.COS_ARRAY) { if (arr.size().intValue() == 3) { Double redValue = arr.at(0).getReal(); Double greenValue = arr.at(1).getReal(); Double blueValue = arr.at(2).getReal(); if (redValue == null || greenValue == null || blueValue == null) { LOGGER.log(Level.FINE, "Outline's color contains non number value"); return null; } float red = redValue.floatValue(); float green = greenValue.floatValue(); float blue = blueValue.floatValue(); if (red < 0 || red > 1 || green < 0 || green > 1 || blue < 0 || blue > 1) { LOGGER.log(Level.FINE, "Outline's color contains wrong value"); return null; } return new double[]{red, green, blue}; } LOGGER.log(Level.FINE, "Outline's color contains not three elements"); return null; } return new double[]{0.0, 0.0, 0.0}; }
public PDOutlineItem getPrev() { return getOutlineItem(ASAtom.PREV); }