001 // 002 // Generated by protoc, do not edit by hand. 003 // 004 package org.apache.activemq.store.kahadb.data; 005 006 007 public final class KahaLocation extends KahaLocationBase<KahaLocation> { 008 009 public java.util.ArrayList<String> missingFields() { 010 java.util.ArrayList<String> missingFields = super.missingFields(); 011 if( !hasLogId() ) { 012 missingFields.add("log_id"); 013 } 014 if( !hasOffset() ) { 015 missingFields.add("offset"); 016 } 017 return missingFields; 018 } 019 020 public void clear() { 021 super.clear(); 022 clearLogId(); 023 clearOffset(); 024 } 025 026 public KahaLocation clone() { 027 return new KahaLocation().mergeFrom(this); 028 } 029 030 public KahaLocation mergeFrom(KahaLocation other) { 031 if (other.hasLogId()) { 032 setLogId(other.getLogId()); 033 } 034 if (other.hasOffset()) { 035 setOffset(other.getOffset()); 036 } 037 return this; 038 } 039 040 public int serializedSizeUnframed() { 041 if (memoizedSerializedSize != -1) 042 return memoizedSerializedSize; 043 044 int size = 0; 045 if (hasLogId()) { 046 size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(1, getLogId()); 047 } 048 if (hasOffset()) { 049 size += org.apache.activemq.protobuf.CodedOutputStream.computeInt32Size(2, getOffset()); 050 } 051 memoizedSerializedSize = size; 052 return size; 053 } 054 055 public KahaLocation mergeUnframed(org.apache.activemq.protobuf.CodedInputStream input) throws java.io.IOException { 056 while (true) { 057 int tag = input.readTag(); 058 if ((tag & 0x07) == 4) { 059 return this; 060 } 061 switch (tag) { 062 case 0: 063 return this; 064 default: { 065 break; 066 } 067 case 8: 068 setLogId(input.readInt32()); 069 break; 070 case 16: 071 setOffset(input.readInt32()); 072 break; 073 } 074 } 075 } 076 public void writeUnframed(org.apache.activemq.protobuf.CodedOutputStream output) throws java.io.IOException { 077 if (hasLogId()) { 078 output.writeInt32(1, getLogId()); 079 } 080 if (hasOffset()) { 081 output.writeInt32(2, getOffset()); 082 } 083 } 084 085 public static KahaLocation parseUnframed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 086 return new KahaLocation().mergeUnframed(data).checktInitialized(); 087 } 088 089 public static KahaLocation parseUnframed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 090 return new KahaLocation().mergeUnframed(data).checktInitialized(); 091 } 092 093 public static KahaLocation parseUnframed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 094 return new KahaLocation().mergeUnframed(data).checktInitialized(); 095 } 096 097 public static KahaLocation parseUnframed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 098 return new KahaLocation().mergeUnframed(data).checktInitialized(); 099 } 100 101 public static KahaLocation parseFramed(org.apache.activemq.protobuf.CodedInputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 102 return new KahaLocation().mergeFramed(data).checktInitialized(); 103 } 104 105 public static KahaLocation parseFramed(org.apache.activemq.protobuf.Buffer data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 106 return new KahaLocation().mergeFramed(data).checktInitialized(); 107 } 108 109 public static KahaLocation parseFramed(byte[] data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException { 110 return new KahaLocation().mergeFramed(data).checktInitialized(); 111 } 112 113 public static KahaLocation parseFramed(java.io.InputStream data) throws org.apache.activemq.protobuf.InvalidProtocolBufferException, java.io.IOException { 114 return new KahaLocation().mergeFramed(data).checktInitialized(); 115 } 116 117 public String toString() { 118 return toString(new java.lang.StringBuilder(), "").toString(); 119 } 120 121 public java.lang.StringBuilder toString(java.lang.StringBuilder sb, String prefix) { 122 if( hasLogId() ) { 123 sb.append(prefix+"log_id: "); 124 sb.append(getLogId()); 125 sb.append("\n"); 126 } 127 if( hasOffset() ) { 128 sb.append(prefix+"offset: "); 129 sb.append(getOffset()); 130 sb.append("\n"); 131 } 132 return sb; 133 } 134 135 public boolean equals(Object obj) { 136 if( obj==this ) 137 return true; 138 139 if( obj==null || obj.getClass()!=KahaLocation.class ) 140 return false; 141 142 return equals((KahaLocation)obj); 143 } 144 145 public boolean equals(KahaLocation obj) { 146 if (hasLogId() ^ obj.hasLogId() ) 147 return false; 148 if (hasLogId() && ( getLogId()!=obj.getLogId() )) 149 return false; 150 if (hasOffset() ^ obj.hasOffset() ) 151 return false; 152 if (hasOffset() && ( getOffset()!=obj.getOffset() )) 153 return false; 154 return true; 155 } 156 157 public int hashCode() { 158 int rc=-1935591996; 159 if (hasLogId()) { 160 rc ^= ( 73595743^getLogId() ); 161 } 162 if (hasOffset()) { 163 rc ^= ( -1935912781^getOffset() ); 164 } 165 return rc; 166 } 167 168 } 169 170 abstract class KahaLocationBase<T> extends org.apache.activemq.protobuf.BaseMessage<T> { 171 172 // required int32 log_id = 1; 173 private int f_logId = 0; 174 private boolean b_logId; 175 176 public boolean hasLogId() { 177 return this.b_logId; 178 } 179 180 public int getLogId() { 181 return this.f_logId; 182 } 183 184 public T setLogId(int logId) { 185 loadAndClear(); 186 this.b_logId = true; 187 this.f_logId = logId; 188 return (T)this; 189 } 190 191 public void clearLogId() { 192 loadAndClear(); 193 this.b_logId = false; 194 this.f_logId = 0; 195 } 196 197 // required int32 offset = 2; 198 private int f_offset = 0; 199 private boolean b_offset; 200 201 public boolean hasOffset() { 202 return this.b_offset; 203 } 204 205 public int getOffset() { 206 return this.f_offset; 207 } 208 209 public T setOffset(int offset) { 210 loadAndClear(); 211 this.b_offset = true; 212 this.f_offset = offset; 213 return (T)this; 214 } 215 216 public void clearOffset() { 217 loadAndClear(); 218 this.b_offset = false; 219 this.f_offset = 0; 220 } 221 222 } 223