1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.internal.storage.pack;
11
12 import org.eclipse.jgit.lib.AnyObjectId;
13 import org.eclipse.jgit.lib.ObjectId;
14
15
16
17
18 public final class BitmapCommit extends ObjectId {
19
20 private final boolean reuseWalker;
21
22 private final int flags;
23
24 private final boolean addToIndex;
25
26 BitmapCommit(AnyObjectId objectId, boolean reuseWalker, int flags) {
27 super(objectId);
28 this.reuseWalker = reuseWalker;
29 this.flags = flags;
30 this.addToIndex = false;
31 }
32
33 BitmapCommit(AnyObjectId objectId, boolean reuseWalker, int flags,
34 boolean addToIndex) {
35 super(objectId);
36 this.reuseWalker = reuseWalker;
37 this.flags = flags;
38 this.addToIndex = addToIndex;
39 }
40
41 boolean isReuseWalker() {
42 return reuseWalker;
43 }
44
45 int getFlags() {
46 return flags;
47 }
48
49
50
51
52
53
54
55 public boolean isAddToIndex() {
56 return addToIndex;
57 }
58
59
60
61
62
63
64
65
66 public static Builder newBuilder(AnyObjectId objId) {
67 return new Builder().setId(objId);
68 }
69
70
71
72
73
74
75
76
77
78
79 public static Builder copyFrom(BitmapCommit commit) {
80 return new Builder().setId(commit)
81 .setReuseWalker(commit.isReuseWalker())
82 .setFlags(commit.getFlags())
83 .setAddToIndex(commit.isAddToIndex());
84 }
85
86
87
88
89 public static class Builder {
90 private AnyObjectId objectId;
91
92 private boolean reuseWalker;
93
94 private int flags;
95
96 private boolean addToIndex;
97
98
99 private Builder() {
100 }
101
102
103
104
105
106
107
108
109 public Builder setId(AnyObjectId objectId) {
110 this.objectId = objectId;
111 return this;
112 }
113
114
115
116
117
118
119
120
121
122 public Builder setReuseWalker(boolean reuseWalker) {
123 this.reuseWalker = reuseWalker;
124 return this;
125 }
126
127
128
129
130
131
132
133
134 public Builder setFlags(int flags) {
135 this.flags = flags;
136 return this;
137 }
138
139
140
141
142
143
144
145
146
147
148 public Builder setAddToIndex(boolean addToIndex) {
149 this.addToIndex = addToIndex;
150 return this;
151 }
152
153
154
155
156
157
158 public BitmapCommit build() {
159 return new BitmapCommit(objectId, reuseWalker, flags,
160 addToIndex);
161 }
162 }
163 }