Class COSIncrement

    • Field Detail

      • objects

        private final java.util.Set<COSBase> objects
        Contains the COSBases, that shall be added to the increment at top level.
      • excluded

        private final java.util.Set<COSBase> excluded
        Contains the direct COSBases, that are either contained written directly by structures contained in objects or that must be excluded from being written as indirect COSObjects for other reasons.
      • processedObjects

        private final java.util.Set<COSObject> processedObjects
        Contains all COSObjects, that have already been processed by this COSIncrement and shall not be processed again.
      • initialized

        private boolean initialized
        Whether this COSIncrement has already been determined, or must still be evaluated.
    • Method Detail

      • collect

        private boolean collect​(COSDictionary dictionary)
        Collect all updates made to the given COSDictionary and it's contained structures.
        Parameters:
        dictionary - The COSDictionary updates shall be collected for.
        Returns:
        Returns true, if the COSDictionary represents a direct child structure, that would require it´s parent to be updated instead.
      • collect

        private boolean collect​(COSArray array)
        Collect all updates made to the given COSArray and it's contained structures.
        Parameters:
        array - The COSDictionary updates shall be collected for.
        Returns:
        Returns true, if the COSArray´s elements changed. A COSArray shall always be treated as a direct structure, that would require it´s parent to be updated instead.
      • collect

        private boolean collect​(COSObject object)
        Collect all updates made to the given COSObject and it's contained structures.
        Parameters:
        object - The COSObject updates shall be collected for.
        Returns:
        Always returns false. COSObjects by definition are indirect and shall never cause a parent structure to be updated.
      • add

        private void add​(COSBase object)
        The given object and actual {COSBase}s shall be part of the increment and must be added to objects, if possible.
        null values shall be skipped.
        Parameters:
        object - The COSBase to add to objects.
        See Also:
        objects
      • isExcluded

        private boolean isExcluded​(COSBase base)
        Returns true, if the given COSBase has been excluded from the increment, and hence is contained in excluded.
        Parameters:
        base - The COSBase to check for exclusion.
        Returns:
        true, if the given COSBase has been excluded from the increment, and hence is contained in excluded.
        See Also:
        excluded
      • getObjects

        public java.util.Set<COSBase> getObjects()
        Returns all indirect COSBases, that shall be written to an increment as top level COSObjects.
        Calling this method will cause the increment to be initialized.
        Returns:
        All indirect COSBases, that shall be written to an increment as top level COSObjects.
        See Also:
        objects
      • iterator

        public java.util.Iterator<COSBase> iterator()
        Return an iterator for the determined objects contained in this COSIncrement.
        Specified by:
        iterator in interface java.lang.Iterable<COSBase>
        Returns:
        An iterator for the determined objects contained in this COSIncrement.