001//
002// Generated by protoc, do not edit by hand.
003//
004package org.apache.activemq.store.kahadb.data;
005
006
007public final class KahaRewrittenDataFileCommand extends KahaRewrittenDataFileCommandBase<KahaRewrittenDataFileCommand> implements org.apache.activemq.store.kahadb.JournalCommand<KahaRewrittenDataFileCommand> {
008
009   public java.util.ArrayList<String> missingFields() {
010      java.util.ArrayList<String> missingFields = super.missingFields();
011      if(  !hasSourceDataFileId() ) {
012         missingFields.add("sourceDataFileId");
013      }
014      return missingFields;
015   }
016
017   public void clear() {
018      super.clear();
019      clearSourceDataFileId();
020      clearRewriteType();
021      clearSkipIfSourceExists();
022   }
023
024   public KahaRewrittenDataFileCommand clone() {
025      return new KahaRewrittenDataFileCommand().mergeFrom(this);
026   }
027
028   public KahaRewrittenDataFileCommand mergeFrom(KahaRewrittenDataFileCommand other) {
029      if (other.hasSourceDataFileId()) {
030         setSourceDataFileId(other.getSourceDataFileId());
031      }
032      if (other.hasRewriteType()) {
033         setRewriteType(other.getRewriteType());
034      }
035      if (other.hasSkipIfSourceExists()) {
036         setSkipIfSourceExists(other.getSkipIfSourceExists());
037      }
038      return this;
039   }
040
041   public int serializedSizeUnframed() {
042      if (memoizedSerializedSize != -1)
043         return memoizedSerializedSize;
044
045      int size = 0;
046      if (hasSourceDataFileId()) {
047         size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(1, getSourceDataFileId());
048      }
049      if (hasRewriteType()) {
050         size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(2, getRewriteType());
051      }
052      if (hasSkipIfSourceExists()) {
053         size += org.apache.activemq.protobuf.CodedOutputStream.computeBoolSize(3, getSkipIfSourceExists());
054      }
055      memoizedSerializedSize = size;
056      return size;
057   }
058
059   public KahaRewrittenDataFileCommand mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException {
060      while (true) {
061         int tag = input.readTag();
062         if ((tag & 0x07) == 4) {
063            return this;
064         }
065         switch (tag) {
066         case 0:
067            return this;
068         default: {
069            break;
070         }
071         case 8:
072            setSourceDataFileId(input.readInt32());
073            break;
074         case 16:
075            setRewriteType(input.readInt32());
076            break;
077         case 24:
078            setSkipIfSourceExists(input.readBool());
079            break;
080         }
081      }
082   }
083   public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException {
084      if (hasSourceDataFileId()) {
085         output.writeInt32(1, getSourceDataFileId());
086      }
087      if (hasRewriteType()) {
088         output.writeInt32(2, getRewriteType());
089      }
090      if (hasSkipIfSourceExists()) {
091         output.writeBool(3, getSkipIfSourceExists());
092      }
093   }
094
095   public static KahaRewrittenDataFileCommand parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
096      return new KahaRewrittenDataFileCommand().mergeUnframed(data).checktInitialized();
097   }
098
099   public static KahaRewrittenDataFileCommand parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
100      return new KahaRewrittenDataFileCommand().mergeUnframed(data).checktInitialized();
101   }
102
103   public static KahaRewrittenDataFileCommand parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
104      return new KahaRewrittenDataFileCommand().mergeUnframed(data).checktInitialized();
105   }
106
107   public static KahaRewrittenDataFileCommand parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
108      return new KahaRewrittenDataFileCommand().mergeUnframed(data).checktInitialized();
109   }
110
111   public static KahaRewrittenDataFileCommand parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
112      return new KahaRewrittenDataFileCommand().mergeFramed(data).checktInitialized();
113   }
114
115   public static KahaRewrittenDataFileCommand parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
116      return new KahaRewrittenDataFileCommand().mergeFramed(data).checktInitialized();
117   }
118
119   public static KahaRewrittenDataFileCommand parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException {
120      return new KahaRewrittenDataFileCommand().mergeFramed(data).checktInitialized();
121   }
122
123   public static KahaRewrittenDataFileCommand parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException {
124      return new KahaRewrittenDataFileCommand().mergeFramed(data).checktInitialized();
125   }
126
127   public String toString() {
128      return toString(new java.lang.StringBuilder(), "").toString();
129   }
130
131   public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) {
132      if(  hasSourceDataFileId() ) {
133         sb.append(prefix+"sourceDataFileId: ");
134         sb.append(getSourceDataFileId());
135         sb.append("\n");
136      }
137      if(  hasRewriteType() ) {
138         sb.append(prefix+"rewriteType: ");
139         sb.append(getRewriteType());
140         sb.append("\n");
141      }
142      if(  hasSkipIfSourceExists() ) {
143         sb.append(prefix+"skipIfSourceExists: ");
144         sb.append(getSkipIfSourceExists());
145         sb.append("\n");
146      }
147      return sb;
148   }
149
150   public void visit(org.apache.activemq.store.kahadb.Visitor visitor) throws java.io.IOException {
151      visitor.visit(this);
152   }
153
154   public KahaEntryType type() {
155      return KahaEntryType.KAHA_REWRITTEN_DATA_FILE_COMMAND;
156   }
157
158   public boolean equals(Object obj) {
159      if( obj==this )
160         return true;
161      
162      if( obj==null || obj.getClass()!=KahaRewrittenDataFileCommand.class )
163         return false;
164      
165      return equals((KahaRewrittenDataFileCommand)obj);
166   }
167   
168   public boolean equals(KahaRewrittenDataFileCommand obj) {
169      if (hasSourceDataFileId() ^ obj.hasSourceDataFileId() ) 
170         return false;
171      if (hasSourceDataFileId() && ( getSourceDataFileId()!=obj.getSourceDataFileId() ))
172         return false;
173      if (hasRewriteType() ^ obj.hasRewriteType() ) 
174         return false;
175      if (hasRewriteType() && ( getRewriteType()!=obj.getRewriteType() ))
176         return false;
177      if (hasSkipIfSourceExists() ^ obj.hasSkipIfSourceExists() ) 
178         return false;
179      if (hasSkipIfSourceExists() && ( getSkipIfSourceExists()!=obj.getSkipIfSourceExists() ))
180         return false;
181      return true;
182   }
183   
184   public int hashCode() {
185      int rc=-1065231344;
186      if (hasSourceDataFileId()) {
187         rc ^= ( -315365732^getSourceDataFileId() );
188      }
189      if (hasRewriteType()) {
190         rc ^= ( -1100466490^getRewriteType() );
191      }
192      if (hasSkipIfSourceExists()) {
193         rc ^= ( -120419949^ (getSkipIfSourceExists()? 3:-3) );
194      }
195      return rc;
196   }
197   
198}
199
200abstract class KahaRewrittenDataFileCommandBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> {
201
202   // required int32 sourceDataFileId = 1;
203   private int f_sourceDataFileId = 0;
204   private boolean b_sourceDataFileId;
205
206   public boolean hasSourceDataFileId() {
207      return this.b_sourceDataFileId;
208   }
209
210   public int getSourceDataFileId() {
211      return this.f_sourceDataFileId;
212   }
213
214   public T setSourceDataFileId(int sourceDataFileId) {
215      loadAndClear();
216      this.b_sourceDataFileId = true;
217      this.f_sourceDataFileId = sourceDataFileId;
218      return (T)this;
219   }
220
221   public void clearSourceDataFileId() {
222      loadAndClear();
223      this.b_sourceDataFileId = false;
224      this.f_sourceDataFileId = 0;
225   }
226
227   // optional int32 rewriteType = 2;
228   private int f_rewriteType = 0;
229   private boolean b_rewriteType;
230
231   public boolean hasRewriteType() {
232      return this.b_rewriteType;
233   }
234
235   public int getRewriteType() {
236      return this.f_rewriteType;
237   }
238
239   public T setRewriteType(int rewriteType) {
240      loadAndClear();
241      this.b_rewriteType = true;
242      this.f_rewriteType = rewriteType;
243      return (T)this;
244   }
245
246   public void clearRewriteType() {
247      loadAndClear();
248      this.b_rewriteType = false;
249      this.f_rewriteType = 0;
250   }
251
252   // optional bool skipIfSourceExists = 3;
253   private boolean f_skipIfSourceExists = true;
254   private boolean b_skipIfSourceExists;
255
256   public boolean hasSkipIfSourceExists() {
257      return this.b_skipIfSourceExists;
258   }
259
260   public boolean getSkipIfSourceExists() {
261      return this.f_skipIfSourceExists;
262   }
263
264   public T setSkipIfSourceExists(boolean skipIfSourceExists) {
265      loadAndClear();
266      this.b_skipIfSourceExists = true;
267      this.f_skipIfSourceExists = skipIfSourceExists;
268      return (T)this;
269   }
270
271   public void clearSkipIfSourceExists() {
272      loadAndClear();
273      this.b_skipIfSourceExists = false;
274      this.f_skipIfSourceExists = true;
275   }
276
277}
278