1
2
3
4
5
6
7
8
9
10
11
12
13 package org.eclipse.jgit.treewalk;
14
15 import java.io.IOException;
16
17 import org.eclipse.jgit.errors.CorruptObjectException;
18 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
19 import org.eclipse.jgit.lib.ObjectId;
20 import org.eclipse.jgit.lib.ObjectReader;
21
22
23
24
25 public class EmptyTreeIterator extends AbstractTreeIterator {
26
27
28
29 public EmptyTreeIterator() {
30
31 }
32
33 EmptyTreeIterator(AbstractTreeIterator p) {
34 super(p);
35 pathLen = pathOffset;
36 }
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 public EmptyTreeIterator(final AbstractTreeIterator p,
55 final byte[] childPath, final int childPathOffset) {
56 super(p, childPath, childPathOffset);
57 pathLen = childPathOffset - 1;
58 }
59
60
61 @Override
62 public AbstractTreeIterator createSubtreeIterator(ObjectReader reader)
63 throws IncorrectObjectTypeException, IOException {
64 return new EmptyTreeIterator(this);
65 }
66
67
68 @Override
69 public boolean hasId() {
70 return false;
71 }
72
73
74 @Override
75 public ObjectId getEntryObjectId() {
76 return ObjectId.zeroId();
77 }
78
79
80 @Override
81 public byte[] idBuffer() {
82 return zeroid;
83 }
84
85
86 @Override
87 public int idOffset() {
88 return 0;
89 }
90
91
92 @Override
93 public void reset() {
94
95 }
96
97
98 @Override
99 public boolean first() {
100 return true;
101 }
102
103
104 @Override
105 public boolean eof() {
106 return true;
107 }
108
109
110 @Override
111 public void next(int delta) throws CorruptObjectException {
112
113 }
114
115
116 @Override
117 public void back(int delta) throws CorruptObjectException {
118
119 }
120
121
122 @Override
123 public void stopWalk() {
124 if (parent != null)
125 parent.stopWalk();
126 }
127
128
129 @Override
130 protected boolean needsStopWalk() {
131 return parent != null && parent.needsStopWalk();
132 }
133 }