Use integer depth in PackWriter's DepthAwareVisitationPolicy

- ObjectWalk.getTreeDepth() returns int hence there is no need to use
long depths in the lowestDepthVisited map.
- Also fix boxing warnings introduced in 0a15cb3a.

Change-Id: I6d73b6f41d5d20975d02f376c8588e411eaff0ec
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2019-05-03 00:23:01 +02:00
parent 2e5bd2a362
commit 8f2b4c8a6e
1 changed files with 4 additions and 4 deletions

View File

@ -881,7 +881,7 @@ private ObjectWalk getObjectWalk() {
*/
private class DepthAwareVisitationPolicy
implements ObjectWalk.VisitationPolicy {
private final Map<ObjectId, Long> lowestDepthVisited = new HashMap<>();
private final Map<ObjectId, Integer> lowestDepthVisited = new HashMap<>();
private final ObjectWalk walk;
@ -891,16 +891,16 @@ private class DepthAwareVisitationPolicy
@Override
public boolean shouldVisit(RevObject o) {
Long lastDepth = lowestDepthVisited.get(o);
Integer lastDepth = lowestDepthVisited.get(o);
if (lastDepth == null) {
return true;
}
return walk.getTreeDepth() < lastDepth;
return walk.getTreeDepth() < lastDepth.intValue();
}
@Override
public void visited(RevObject o) {
lowestDepthVisited.put(o, (long) walk.getTreeDepth());
lowestDepthVisited.put(o, Integer.valueOf(walk.getTreeDepth()));
}
}