1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.revwalk;
12
13 abstract class AbstractRevQueue extends Generator {
14 static final AbstractRevQueue EMPTY_QUEUE = new AlwaysEmptyQueue();
15
16
17 int outputType;
18
19 AbstractRevQueue(boolean firstParent) {
20 super(firstParent);
21 }
22
23
24
25
26
27
28
29
30
31
32
33 public abstract void add(RevCommit c);
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48 public final void add(RevCommit c, RevFlag queueControl) {
49 if (!c.has(queueControl)) {
50 c.add(queueControl);
51 add(c);
52 }
53 }
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 public final void addParents(RevCommit c, RevFlag queueControl) {
69 final RevCommit[] pList = c.parents;
70 if (pList == null) {
71 return;
72 }
73 for (int i = 0; i < pList.length; i++) {
74 if (firstParent && i > 0) {
75 break;
76 }
77 add(pList[i], queueControl);
78 }
79 }
80
81
82
83
84
85
86 @Override
87 public abstract RevCommit next();
88
89
90
91
92 public abstract void clear();
93
94 abstract boolean everbodyHasFlag(int f);
95
96 abstract boolean anybodyHasFlag(int f);
97
98 @Override
99 int outputType() {
100 return outputType;
101 }
102
103
104
105
106
107
108
109
110
111 protected static void describe(StringBuilder s, RevCommit c) {
112 s.append(c.toString());
113 s.append('\n');
114 }
115
116 private static class AlwaysEmptyQueue extends AbstractRevQueue {
117 private AlwaysEmptyQueue() {
118 super(false);
119 }
120
121 @Override
122 public void add(RevCommit c) {
123 throw new UnsupportedOperationException();
124 }
125
126 @Override
127 public RevCommit next() {
128 return null;
129 }
130
131 @Override
132 boolean anybodyHasFlag(int f) {
133 return false;
134 }
135
136 @Override
137 boolean everbodyHasFlag(int f) {
138 return true;
139 }
140
141 @Override
142 public void clear() {
143
144 }
145
146 }
147 }