Class COSUpdateState
- java.lang.Object
-
- org.apache.pdfbox.cos.COSUpdateState
-
public class COSUpdateState extends java.lang.ObjectACOSUpdateStateinstance manages update states for aCOSUpdateInfo. Such states are used to create aCOSIncrementfor the incremental saving of aCOSDocument.- See Also:
COSDocumentState,COSUpdateInfo,COSIncrement
-
-
Field Summary
Fields Modifier and Type Field Description private COSDocumentStateoriginDocumentStateTheCOSDocumentStatetheupdateInfois linked to.private booleanupdatedThe actual update state ofupdateInfo.private COSUpdateInfoupdateInfoTheCOSUpdateInfotheCOSUpdateStatedoes manage update states for.
-
Constructor Summary
Constructors Constructor Description COSUpdateState(COSUpdateInfo updateInfo)Creates a newCOSUpdateStatefor the givenCOSUpdateInfo.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voiddereferenceChild(COSBase child)This shallsetOriginDocumentState(COSDocumentState, boolean)for the dereferenced child, initializing itsoriginDocumentState.COSDocumentStategetOriginDocumentState()Returns theoriginDocumentState, that is linked to the managedupdateInfo.(package private) booleanisAcceptingUpdates()Returnstrue, if the linkedoriginDocumentStateCOSDocumentState.isAcceptingUpdates()and such aCOSDocumentStatehas been linked to thisCOSUpdateState.booleanisUpdated()Returns the actualupdatedstate of the managedupdateInfo.voidsetOriginDocumentState(COSDocumentState originDocumentState)private voidsetOriginDocumentState(COSDocumentState originDocumentState, boolean dereferencing)(package private) COSIncrementtoIncrement()Uses the managedupdateInfoas the base object of a newCOSIncrement.(package private) voidupdate()Callsupdate(boolean)withtrueas the new update state.
This shall only then have an effect, ifisAcceptingUpdates()returnstrue.(package private) voidupdate(boolean updated)Sets theupdatedstate of the managedupdateInfoto the given state.
This shall only then have an effect, ifisAcceptingUpdates()returnstrue.(package private) voidupdate(java.lang.Iterable<COSBase> children)Shall callupdate()for thisCOSUpdateStateand shallsetOriginDocumentState(COSDocumentState)for the given children, initializing theirupdatedstate andoriginDocumentState.(package private) voidupdate(COSArray children)Shall callupdate()for thisCOSUpdateStateand shallsetOriginDocumentState(COSDocumentState)for the given children, initializing theirupdatedstate andoriginDocumentState.(package private) voidupdate(COSBase child)Shall callupdate()for thisCOSUpdateStateand shallsetOriginDocumentState(COSDocumentState)for the given child, initializing it´supdatedstate andoriginDocumentState.
-
-
-
Field Detail
-
updateInfo
private final COSUpdateInfo updateInfo
TheCOSUpdateInfotheCOSUpdateStatedoes manage update states for.
-
originDocumentState
private COSDocumentState originDocumentState
TheCOSDocumentStatetheupdateInfois linked to.
-
updated
private boolean updated
The actual update state ofupdateInfo.true, ifupdateInfohas been updated after the document completed parsing.false, ifupdateInfohas remained unaltered since the document completed parsing.
-
-
Constructor Detail
-
COSUpdateState
public COSUpdateState(COSUpdateInfo updateInfo)
Creates a newCOSUpdateStatefor the givenCOSUpdateInfo.- Parameters:
updateInfo- TheCOSUpdateInfo, that shall be managed by thisCOSUpdateState.
-
-
Method Detail
-
setOriginDocumentState
public void setOriginDocumentState(COSDocumentState originDocumentState)
Links the given
COSDocumentStateto theupdatedstate of the managedupdateInfo.
This shall also initialize
updatedaccordingly and will also set the sameCOSDocumentStatefor all possibly contained substructures.Should
originDocumentStatealready have been set, by a prior call to this method, this shall deny to overwrite it.COSDocumentState.isAcceptingUpdates()shall determine, whether updates toupdateInfoare allowed.As long as no
COSDocumentStateis linked to thisCOSUpdateState, it shall not accept updates.- Parameters:
originDocumentState- TheCOSDocumentStatethat shall be linked to thisCOSUpdateState.- See Also:
originDocumentState,updated
-
setOriginDocumentState
private void setOriginDocumentState(COSDocumentState originDocumentState, boolean dereferencing)
Links the given
COSDocumentStateto theupdatedstate of the managedupdateInfo.
This shall also initialize
updatedaccordingly and will also set the sameCOSDocumentStatefor all possibly contained substructures.Should
originDocumentStatealready have been set, by a prior call to this method, this shall deny to overwrite it.COSDocumentState.isAcceptingUpdates()shall determine, whether updates toupdateInfoare allowed.As long as no
COSDocumentStateis linked to thisCOSUpdateState, it shall not accept updates.Additionally to
setOriginDocumentState(COSDocumentState), this shall also deny changingupdated, should the flagdereferencingindicate, that this is caused by dereferencing aCOSObject.- Parameters:
originDocumentState- TheCOSDocumentStatethat shall be linked to thisCOSUpdateState.dereferencing-true, if this update of theCOSDocumentStateis caused by dereferencing aCOSObject.- See Also:
originDocumentState,updated
-
getOriginDocumentState
public COSDocumentState getOriginDocumentState()
Returns the
originDocumentState, that is linked to the managedupdateInfo.COSDocumentState.isAcceptingUpdates()shall determine, whether updates toupdateInfoare allowed.As long as no
COSDocumentStateis linked to thisCOSUpdateState, it shall not accept updates.- Returns:
- The
COSDocumentStatelinked to thisCOSUpdateState. - See Also:
setOriginDocumentState(COSDocumentState)
-
isAcceptingUpdates
boolean isAcceptingUpdates()
Returnstrue, if the linkedoriginDocumentStateCOSDocumentState.isAcceptingUpdates()and such aCOSDocumentStatehas been linked to thisCOSUpdateState.- Returns:
true, if the linkedoriginDocumentStateCOSDocumentState.isAcceptingUpdates()and such aCOSDocumentStatehas been linked to thisCOSUpdateState.- See Also:
originDocumentState,COSDocumentState.isAcceptingUpdates()
-
isUpdated
public boolean isUpdated()
Returns the actualupdatedstate of the managedupdateInfo.- Returns:
- The actual
updatedstate of the managedupdateInfo - See Also:
updated
-
update
void update()
Callsupdate(boolean)withtrueas the new update state.
This shall only then have an effect, ifisAcceptingUpdates()returnstrue.- See Also:
update(boolean),updated,isAcceptingUpdates()
-
update
void update(boolean updated)
Sets theupdatedstate of the managedupdateInfoto the given state.
This shall only then have an effect, ifisAcceptingUpdates()returnstrue.- Parameters:
updated- The state to set forupdated.- See Also:
update(boolean),updated,isAcceptingUpdates()
-
update
void update(COSBase child)
Shall call
update()for thisCOSUpdateStateand shallsetOriginDocumentState(COSDocumentState)for the given child, initializing it´supdatedstate andoriginDocumentState.This shall have no effect for a child, that is not an instance of
COSUpdateInfo.- Parameters:
child- The child that shall also be updated.- See Also:
update(),setOriginDocumentState(COSDocumentState)
-
update
void update(COSArray children)
Shall call
update()for thisCOSUpdateStateand shallsetOriginDocumentState(COSDocumentState)for the given children, initializing theirupdatedstate andoriginDocumentState.This shall have no effect for a child, that is not an instance of
COSUpdateInfo.- Parameters:
children- The children that shall also be updated.- See Also:
update(),setOriginDocumentState(COSDocumentState)
-
update
void update(java.lang.Iterable<COSBase> children)
Shall call
update()for thisCOSUpdateStateand shallsetOriginDocumentState(COSDocumentState)for the given children, initializing theirupdatedstate andoriginDocumentState.This shall have no effect for a child, that is not an instance of
COSUpdateInfo.- Parameters:
children- The children that shall also be updated.- See Also:
update(),setOriginDocumentState(COSDocumentState)
-
dereferenceChild
void dereferenceChild(COSBase child)
This shallsetOriginDocumentState(COSDocumentState, boolean)for the dereferenced child, initializing itsoriginDocumentState.This shall have no effect for a child, that is not an instance of
COSUpdateInfoand will never change the child´supdatedstate.- Parameters:
child- The child, that has been dereferenced.- See Also:
setOriginDocumentState(COSDocumentState, boolean)
-
toIncrement
COSIncrement toIncrement()
Uses the managedupdateInfoas the base object of a newCOSIncrement.- Returns:
- A
COSIncrementbased on the managedupdateInfo. - See Also:
COSUpdateInfo,COSIncrement
-
-