Class ObjectPath
- Direct Known Subclasses:
-
TrailerPath
You could say that CompareObjectPath instance consists of two parts: direct path and indirect path. Direct path defines path to the currently comparing objects in relation to base objects. It could be empty, which would mean that currently comparing objects are base objects themselves. Base objects are the two indirect objects from the comparing documents which are in the same position in the pdf trees. Another part, indirect path, defines which indirect objects were met during comparison process to get to the current base objects. Indirect path is needed to avoid infinite loops during comparison.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates empty ObjectPath.ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject) Creates CompareObjectPath with corresponding base objects in two documents.ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject, Stack<LocalPathItem> path, Stack<IndirectPathItem> indirects) Creates CompareObjectPath with corresponding base objects in two documents.ObjectPath(ObjectPath objectPath) Creates anObjectPathobject from anotherObjectPathobject, passed as argument. -
Method Summary
Modifier and TypeMethodDescriptionbooleanMethod returns true if thisObjectPathinstance equals to the passed object.Method returns current basePdfIndirectReferenceobject in the cmp document.Method returns current basePdfIndirectReferenceobject in the out document.Gets indirect path which denotes sequence of the indirect references that were passed in comparing process to get to the current base objects.Gets local (or direct) path that denotes sequence of the path items from base object to the comparing direct object.inthashCode()Method returns a hash code of thisObjectPathinstance.booleanisComparing(PdfIndirectReference cmpObject, PdfIndirectReference outObject) This method is used to define if given objects were already met in the path to the current base objects.voidpop()Removes the last path item from the direct path.voidpushArrayItemToPath(int index) Adds array item to the direct path.voidAdds dictionary item to the direct path.voidpushOffsetToPath(int offset) Adds offset item to the direct path.resetDirectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject) Creates a new ObjectPath instance with two new given base objects, which are supposed to be nested in the base objects of the current instance of the ObjectPath.toString()Method returns a string representation of the direct path stored in thisObjectPathinstance.Creates an xml node that describes a direct path stored in this ObjectPath instance.
-
Field Details
-
path
-
-
Constructor Details
-
ObjectPath
public ObjectPath()Creates empty ObjectPath. -
ObjectPath
Creates anObjectPathobject from anotherObjectPathobject, passed as argument.- Parameters:
-
objectPath- anObjectPathobject to create from.
-
ObjectPath
Creates CompareObjectPath with corresponding base objects in two documents.- Parameters:
-
baseCmpObject- base object in cmp document. -
baseOutObject- base object in out document.
-
ObjectPath
public ObjectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject, Stack<LocalPathItem> path, Stack<IndirectPathItem> indirects) Creates CompareObjectPath with corresponding base objects in two documents.- Parameters:
-
baseCmpObject- base object in cmp document -
baseOutObject- base object in out document -
path- local path that denotes sequence of the path items from base object to the comparing direct object -
indirects- indirect path which denotes sequence of the indirect references that were passed in comparing process to get to the current base objects
-
-
Method Details
-
resetDirectPath
public ObjectPath resetDirectPath(PdfIndirectReference baseCmpObject, PdfIndirectReference baseOutObject) Creates a new ObjectPath instance with two new given base objects, which are supposed to be nested in the base objects of the current instance of the ObjectPath. This method is used to avoid infinite loop in case of circular references in pdf documents objects structure.Basically, this method creates copy of the current CompareObjectPath instance, but resets information of the direct paths, and also adds current CompareObjectPath instance base objects to the indirect references chain that denotes a path to the new base objects.
- Parameters:
-
baseCmpObject- new base object in cmp document. -
baseOutObject- new base object in out document. - Returns:
- new ObjectPath instance, which stores chain of the indirect references which were already met to get to the new base objects.
-
isComparing
This method is used to define if given objects were already met in the path to the current base objects. If this method returns true it basically means that we found a loop in the objects structure and that we already compared these objects.- Parameters:
-
cmpObject- cmp object to check if it was already met in base objects path. -
outObject- out object to check if it was already met in base objects path. - Returns:
- true if given objects are contained in the path and therefore were already compared.
-
pushArrayItemToPath
public void pushArrayItemToPath(int index) Adds array item to the direct path. SeeArrayPathItem.- Parameters:
-
index- index in the array of the direct object to be compared.
-
pushDictItemToPath
Adds dictionary item to the direct path. SeeDictPathItem.- Parameters:
-
key- key in the dictionary to which corresponds direct object to be compared.
-
pushOffsetToPath
public void pushOffsetToPath(int offset) Adds offset item to the direct path. SeeOffsetPathItem.- Parameters:
-
offset- offset to the specific byte in the stream that is compared.
-
pop
public void pop()Removes the last path item from the direct path. -
getLocalPath
Gets local (or direct) path that denotes sequence of the path items from base object to the comparing direct object.- Returns:
- direct path to the comparing object.
-
getIndirectPath
Gets indirect path which denotes sequence of the indirect references that were passed in comparing process to get to the current base objects.- Returns:
- indirect path to the current base objects.
-
getBaseCmpObject
Method returns current basePdfIndirectReferenceobject in the cmp document.- Returns:
-
current base
PdfIndirectReferenceobject in the cmp document.
-
getBaseOutObject
Method returns current basePdfIndirectReferenceobject in the out document.- Returns:
- current base object in the out document.
-
toXmlNode
Creates an xml node that describes a direct path stored in this ObjectPath instance.- Parameters:
-
document- xml document, to which this xml node will be added. - Returns:
- an xml node describing direct path.
-
toString
Method returns a string representation of the direct path stored in thisObjectPathinstance. -
hashCode
public int hashCode()Method returns a hash code of thisObjectPathinstance.- Overrides:
-
hashCodein classObject - Returns:
-
a int hash code of this
ObjectPathinstance.
-
equals
Method returns true if thisObjectPathinstance equals to the passed object.- Overrides:
-
equalsin classObject - Returns:
-
true - if this
ObjectPathinstance equals to the passed object.
-