Class HopCount.Answer
- java.lang.Object
-
- org.apache.manifoldcf.crawler.jobs.HopCount.Answer
-
- Enclosing class:
- HopCount
protected static class HopCount.Answer extends java.lang.Object
This class represents an answer - which consists both of an answer value, and also the dependencies of that answer (i.e. the add dependencies and delete dependencies).
-
-
Field Summary
Fields Modifier and Type Field Description protected int
answer
The answer valueprotected java.util.HashSet<DeleteDependency>
deleteDependencies
This is the set of delete dependencies.
-
Constructor Summary
Constructors Constructor Description Answer()
Constructor.Answer(int value)
Answer(int answer, DeleteDependency[] deleteDeps)
Set an answer from initial data.Answer(HopCount.Answer other)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
countDeleteDependencies()
Get the number of delete dependenciesvoid
duplicate(HopCount.Answer other)
Copy the answer value from another answer objectint
getAnswer()
Get the current answer value.java.util.Iterator<DeleteDependency>
getDeleteDependencies()
Iterate over the delete dependencies.boolean
hasDependency(DeleteDependency dep)
Check if a delete dependency is presentvoid
initialize(int value)
Initialize this answer object.void
merge(HopCount.Answer childAnswer, boolean isIncrementingLink, java.lang.String linkType, java.lang.String parentIDHash, java.lang.String childIDHash)
Update the current answer, using a child link's information and answer.void
setAnswer(int answer, DeleteDependency[] deleteDeps)
Set an answer from initial data.protected void
setAnswerFromChild(int newAnswer, java.util.HashSet<DeleteDependency> childDeleteDependencies, java.lang.String linkType, java.lang.String parentIDHash, java.lang.String childIDHash)
Set answer from child
-
-
-
Field Detail
-
answer
protected int answer
The answer value
-
deleteDependencies
protected java.util.HashSet<DeleteDependency> deleteDependencies
This is the set of delete dependencies. It is keyed by a DeleteDependency object.
-
-
Constructor Detail
-
Answer
public Answer()
Constructor.
-
Answer
public Answer(HopCount.Answer other)
-
Answer
public Answer(int value)
-
Answer
public Answer(int answer, DeleteDependency[] deleteDeps)
Set an answer from initial data.
-
-
Method Detail
-
getAnswer
public int getAnswer()
Get the current answer value.
-
countDeleteDependencies
public int countDeleteDependencies()
Get the number of delete dependencies
-
getDeleteDependencies
public java.util.Iterator<DeleteDependency> getDeleteDependencies()
Iterate over the delete dependencies.
-
hasDependency
public boolean hasDependency(DeleteDependency dep)
Check if a delete dependency is present
-
initialize
public void initialize(int value)
Initialize this answer object. This sets the answer value to ANSWER_INFINITY and clears the maps.
-
duplicate
public void duplicate(HopCount.Answer other)
Copy the answer value from another answer object
-
merge
public void merge(HopCount.Answer childAnswer, boolean isIncrementingLink, java.lang.String linkType, java.lang.String parentIDHash, java.lang.String childIDHash)
Update the current answer, using a child link's information and answer. This method basically decides if the child is relevant, and if so merges the answer from the child together with the current value stored here.- Parameters:
childAnswer
- is the current answer found for the child.isIncrementingLink
- is true if this link is the kind being counted, and thus increments the hopcount.linkType
- is the type of THIS link (for building appropriate delete dependency).parentIDHash
- is the hash of the parent document id for THIS link.childIDHash
- is the hash of the child document id for THIS link.
-
setAnswerFromChild
protected void setAnswerFromChild(int newAnswer, java.util.HashSet<DeleteDependency> childDeleteDependencies, java.lang.String linkType, java.lang.String parentIDHash, java.lang.String childIDHash)
Set answer from child
-
setAnswer
public void setAnswer(int answer, DeleteDependency[] deleteDeps)
Set an answer from initial data.
-
-