All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.verapdf.gf.model.impl.containers.StaticContainers Maven / Gradle / Ivy

There is a newer version: 1.26.5
Show newest version
/**
 * This file is part of validation-model, a module of the veraPDF project.
 * Copyright (c) 2015, veraPDF Consortium 
 * All rights reserved.
 * 

* validation-model is free software: you can redistribute it and/or modify * it under the terms of either: *

* The GNU General public license GPLv3+. * You should have received a copy of the GNU General Public License * along with validation-model as the LICENSE.GPL file in the root of the source * tree. If not, see http://www.gnu.org/licenses/ or * https://www.gnu.org/licenses/gpl-3.0.en.html. *

* The Mozilla Public License MPLv2+. * You should have received a copy of the Mozilla Public License along with * validation-model as the LICENSE.MPL file in the root of the source tree. * If a copy of the MPL was not distributed with this file, you can obtain one at * http://mozilla.org/MPL/2.0/. */ package org.verapdf.gf.model.impl.containers; import org.verapdf.as.ASAtom; import org.verapdf.cos.COSKey; import org.verapdf.gf.model.impl.pd.colors.GFPDSeparation; import org.verapdf.gf.model.impl.pd.util.TaggedPDFRoleMapHelper; import org.verapdf.model.operator.Glyph; import org.verapdf.model.pdlayer.PDColorSpace; import org.verapdf.model.pdlayer.PDFont; import org.verapdf.pd.PDDocument; import org.verapdf.pdfa.flavours.PDFAFlavour; import java.util.*; /** * @author Timur Kamalov */ public class StaticContainers { private static ThreadLocal document = new ThreadLocal<>(); private static ThreadLocal flavour = new ThreadLocal<>(); // TaggedPDF private static ThreadLocal roleMapHelper = new ThreadLocal<>(); //PBoxPDSeparation private static ThreadLocal>> separations = new ThreadLocal<>(); private static ThreadLocal> inconsistentSeparations = new ThreadLocal<>(); //ColorSpaceFactory private static ThreadLocal> cachedColorSpaces = new ThreadLocal<>(); //FontFactory private static ThreadLocal> cachedFonts = new ThreadLocal<>(); private static ThreadLocal> fileSpecificationKeys = new ThreadLocal<>(); private static ThreadLocal> transparencyVisitedContentStreams = new ThreadLocal<>(); private static ThreadLocal validPDF = new ThreadLocal<>(); private static ThreadLocal> cachedGlyphs = new ThreadLocal<>(); public static void clearAllContainers() { document.set(null); flavour.set(null); roleMapHelper.set(null); separations.set(new HashMap<>()); inconsistentSeparations.set(new ArrayList<>()); cachedColorSpaces.set(new HashMap<>()); cachedFonts.set(new HashMap<>()); fileSpecificationKeys.set(new HashSet<>()); transparencyVisitedContentStreams.set(new Stack<>()); cachedGlyphs.set(new HashMap<>()); validPDF.set(true); } public static PDDocument getDocument() { return document.get(); } public static void setDocument(PDDocument document) { StaticContainers.document.set(document); } public static PDFAFlavour getFlavour() { return flavour.get(); } public static void setFlavour(PDFAFlavour flavour) { StaticContainers.flavour.set(flavour); } public static TaggedPDFRoleMapHelper getRoleMapHelper() { return roleMapHelper.get(); } public static void setRoleMapHelper(Map roleMap) { StaticContainers.roleMapHelper = new ThreadLocal<>(); roleMapHelper.set(new TaggedPDFRoleMapHelper(roleMap)); } public static void setRoleMapHelper(TaggedPDFRoleMapHelper roleMapHelper) { StaticContainers.roleMapHelper.set(roleMapHelper); } public static Map> getSeparations() { if (separations.get() == null) { separations.set(new HashMap<>()); } return separations.get(); } public static void setSeparations(Map> separations) { StaticContainers.separations.set(separations); } public static List getInconsistentSeparations() { if (inconsistentSeparations.get() == null) { inconsistentSeparations.set(new ArrayList<>()); } return inconsistentSeparations.get(); } public static void setInconsistentSeparations(List inconsistentSeparations) { StaticContainers.inconsistentSeparations.set(inconsistentSeparations); } public static Map getCachedColorSpaces() { if (cachedColorSpaces.get() == null) { cachedColorSpaces.set(new HashMap<>()); } return cachedColorSpaces.get(); } public static void setCachedColorSpaces(Map cachedColorSpaces) { StaticContainers.cachedColorSpaces.set(cachedColorSpaces); } public static Map getCachedFonts() { if (cachedFonts.get() == null) { cachedFonts.set(new HashMap<>()); } return cachedFonts.get(); } public static void setCachedFonts(Map cachedFonts) { StaticContainers.cachedFonts.set(cachedFonts); } public static Set getFileSpecificationKeys() { if (fileSpecificationKeys.get() == null) { fileSpecificationKeys.set(new HashSet<>()); } return fileSpecificationKeys.get(); } public static void setFileSpecificationKeys(Set fileSpecificationKeys) { StaticContainers.fileSpecificationKeys.set(fileSpecificationKeys); } public static Stack getTransparencyVisitedContentStreams() { if (transparencyVisitedContentStreams.get() == null) { transparencyVisitedContentStreams.set(new Stack<>()); } return transparencyVisitedContentStreams.get(); } public static void setTransparencyVisitedContentStreams(Stack transparencyVisitedContentStreams) { StaticContainers.transparencyVisitedContentStreams.set(transparencyVisitedContentStreams); } public static boolean getValidPDF() { return validPDF.get(); } public static void setValidPDF(boolean validPDF) { StaticContainers.validPDF.set(validPDF); } public static Map getCachedGlyphs() { if (cachedGlyphs.get() == null) { cachedGlyphs.set(new HashMap<>()); } return cachedGlyphs.get(); } public static void setCachedGlyphs(Map cachedGlyphs) { StaticContainers.cachedGlyphs.set(cachedGlyphs); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy