001/**
002 * Copyright (c) 2012, The University of Southampton and the individual contributors.
003 * All rights reserved.
004 *
005 * Redistribution and use in source and binary forms, with or without modification,
006 * are permitted provided that the following conditions are met:
007 *
008 *   *  Redistributions of source code must retain the above copyright notice,
009 *      this list of conditions and the following disclaimer.
010 *
011 *   *  Redistributions in binary form must reproduce the above copyright notice,
012 *      this list of conditions and the following disclaimer in the documentation
013 *      and/or other materials provided with the distribution.
014 *
015 *   *  Neither the name of the University of Southampton nor the names of its
016 *      contributors may be used to endorse or promote products derived from this
017 *      software without specific prior written permission.
018 *
019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
020 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
021 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
022 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
023 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
026 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
029 */
030/**
031 * Autogenerated by Thrift Compiler (0.7.0)
032 *
033 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
034 */
035package net.lag.kestrel.thrift;
036
037import java.nio.ByteBuffer;
038import java.util.BitSet;
039import java.util.Collections;
040import java.util.EnumMap;
041import java.util.EnumSet;
042import java.util.HashMap;
043import java.util.Map;
044
045import org.apache.commons.lang.builder.HashCodeBuilder;
046
047@SuppressWarnings({ "javadoc", "unused", "serial" })
048public class QueueInfo implements org.apache.thrift7.TBase<QueueInfo, QueueInfo._Fields>, java.io.Serializable, Cloneable
049{
050        private static final org.apache.thrift7.protocol.TStruct STRUCT_DESC = new org.apache.thrift7.protocol.TStruct(
051                        "QueueInfo");
052
053        private static final org.apache.thrift7.protocol.TField HEAD_ITEM_FIELD_DESC = new org.apache.thrift7.protocol.TField(
054                        "head_item", org.apache.thrift7.protocol.TType.STRING, (short) 1);
055        private static final org.apache.thrift7.protocol.TField ITEMS_FIELD_DESC = new org.apache.thrift7.protocol.TField(
056                        "items", org.apache.thrift7.protocol.TType.I64, (short) 2);
057        private static final org.apache.thrift7.protocol.TField BYTES_FIELD_DESC = new org.apache.thrift7.protocol.TField(
058                        "bytes", org.apache.thrift7.protocol.TType.I64, (short) 3);
059        private static final org.apache.thrift7.protocol.TField JOURNAL_BYTES_FIELD_DESC = new org.apache.thrift7.protocol.TField(
060                        "journal_bytes", org.apache.thrift7.protocol.TType.I64, (short) 4);
061        private static final org.apache.thrift7.protocol.TField AGE_FIELD_DESC = new org.apache.thrift7.protocol.TField(
062                        "age", org.apache.thrift7.protocol.TType.I64, (short) 5);
063        private static final org.apache.thrift7.protocol.TField WAITERS_FIELD_DESC = new org.apache.thrift7.protocol.TField(
064                        "waiters", org.apache.thrift7.protocol.TType.I32, (short) 6);
065        private static final org.apache.thrift7.protocol.TField OPEN_TRANSACTIONS_FIELD_DESC = new org.apache.thrift7.protocol.TField(
066                        "open_transactions", org.apache.thrift7.protocol.TType.I32, (short) 7);
067
068        private ByteBuffer head_item; // required
069        private long items; // required
070        private long bytes; // required
071        private long journal_bytes; // required
072        private long age; // required
073        private int waiters; // required
074        private int open_transactions; // required
075
076        /**
077         * The set of fields this struct contains, along with convenience methods
078         * for finding and manipulating them.
079         */
080        public enum _Fields implements org.apache.thrift7.TFieldIdEnum {
081                HEAD_ITEM((short) 1, "head_item"),
082                ITEMS((short) 2, "items"),
083                BYTES((short) 3, "bytes"),
084                JOURNAL_BYTES((short) 4, "journal_bytes"),
085                AGE((short) 5, "age"),
086                WAITERS((short) 6, "waiters"),
087                OPEN_TRANSACTIONS((short) 7, "open_transactions");
088
089                private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
090
091                static {
092                        for (final _Fields field : EnumSet.allOf(_Fields.class)) {
093                                byName.put(field.getFieldName(), field);
094                        }
095                }
096
097                /**
098                 * Find the _Fields constant that matches fieldId, or null if its not
099                 * found.
100                 */
101                public static _Fields findByThriftId(int fieldId) {
102                        switch (fieldId) {
103                        case 1: // HEAD_ITEM
104                                return HEAD_ITEM;
105                        case 2: // ITEMS
106                                return ITEMS;
107                        case 3: // BYTES
108                                return BYTES;
109                        case 4: // JOURNAL_BYTES
110                                return JOURNAL_BYTES;
111                        case 5: // AGE
112                                return AGE;
113                        case 6: // WAITERS
114                                return WAITERS;
115                        case 7: // OPEN_TRANSACTIONS
116                                return OPEN_TRANSACTIONS;
117                        default:
118                                return null;
119                        }
120                }
121
122                /**
123                 * Find the _Fields constant that matches fieldId, throwing an exception
124                 * if it is not found.
125                 */
126                public static _Fields findByThriftIdOrThrow(int fieldId) {
127                        final _Fields fields = findByThriftId(fieldId);
128                        if (fields == null)
129                                throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
130                        return fields;
131                }
132
133                /**
134                 * Find the _Fields constant that matches name, or null if its not
135                 * found.
136                 */
137                public static _Fields findByName(String name) {
138                        return byName.get(name);
139                }
140
141                private final short _thriftId;
142                private final String _fieldName;
143
144                _Fields(short thriftId, String fieldName) {
145                        _thriftId = thriftId;
146                        _fieldName = fieldName;
147                }
148
149                @Override
150                public short getThriftFieldId() {
151                        return _thriftId;
152                }
153
154                @Override
155                public String getFieldName() {
156                        return _fieldName;
157                }
158        }
159
160        // isset id assignments
161        private static final int __ITEMS_ISSET_ID = 0;
162        private static final int __BYTES_ISSET_ID = 1;
163        private static final int __JOURNAL_BYTES_ISSET_ID = 2;
164        private static final int __AGE_ISSET_ID = 3;
165        private static final int __WAITERS_ISSET_ID = 4;
166        private static final int __OPEN_TRANSACTIONS_ISSET_ID = 5;
167        private BitSet __isset_bit_vector = new BitSet(6);
168
169        public static final Map<_Fields, org.apache.thrift7.meta_data.FieldMetaData> metaDataMap;
170        static {
171                final Map<_Fields, org.apache.thrift7.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift7.meta_data.FieldMetaData>(
172                                _Fields.class);
173                tmpMap.put(_Fields.HEAD_ITEM, new org.apache.thrift7.meta_data.FieldMetaData("head_item",
174                                org.apache.thrift7.TFieldRequirementType.OPTIONAL,
175                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.STRING, true)));
176                tmpMap.put(_Fields.ITEMS, new org.apache.thrift7.meta_data.FieldMetaData("items",
177                                org.apache.thrift7.TFieldRequirementType.DEFAULT,
178                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.I64)));
179                tmpMap.put(_Fields.BYTES, new org.apache.thrift7.meta_data.FieldMetaData("bytes",
180                                org.apache.thrift7.TFieldRequirementType.DEFAULT,
181                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.I64)));
182                tmpMap.put(_Fields.JOURNAL_BYTES, new org.apache.thrift7.meta_data.FieldMetaData("journal_bytes",
183                                org.apache.thrift7.TFieldRequirementType.DEFAULT,
184                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.I64)));
185                tmpMap.put(_Fields.AGE, new org.apache.thrift7.meta_data.FieldMetaData("age",
186                                org.apache.thrift7.TFieldRequirementType.DEFAULT,
187                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.I64)));
188                tmpMap.put(_Fields.WAITERS, new org.apache.thrift7.meta_data.FieldMetaData("waiters",
189                                org.apache.thrift7.TFieldRequirementType.DEFAULT,
190                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.I32)));
191                tmpMap.put(_Fields.OPEN_TRANSACTIONS, new org.apache.thrift7.meta_data.FieldMetaData("open_transactions",
192                                org.apache.thrift7.TFieldRequirementType.DEFAULT,
193                                new org.apache.thrift7.meta_data.FieldValueMetaData(org.apache.thrift7.protocol.TType.I32)));
194                metaDataMap = Collections.unmodifiableMap(tmpMap);
195                org.apache.thrift7.meta_data.FieldMetaData.addStructMetaDataMap(QueueInfo.class, metaDataMap);
196        }
197
198        public QueueInfo() {
199        }
200
201        public QueueInfo(
202                        long items,
203                        long bytes,
204                        long journal_bytes,
205                        long age,
206                        int waiters,
207                        int open_transactions)
208        {
209                this();
210                this.items = items;
211                set_items_isSet(true);
212                this.bytes = bytes;
213                set_bytes_isSet(true);
214                this.journal_bytes = journal_bytes;
215                set_journal_bytes_isSet(true);
216                this.age = age;
217                set_age_isSet(true);
218                this.waiters = waiters;
219                set_waiters_isSet(true);
220                this.open_transactions = open_transactions;
221                set_open_transactions_isSet(true);
222        }
223
224        /**
225         * Performs a deep copy on <i>other</i>.
226         */
227        public QueueInfo(QueueInfo other) {
228                __isset_bit_vector.clear();
229                __isset_bit_vector.or(other.__isset_bit_vector);
230                if (other.is_set_head_item()) {
231                        this.head_item = org.apache.thrift7.TBaseHelper.copyBinary(other.head_item);
232                        ;
233                }
234                this.items = other.items;
235                this.bytes = other.bytes;
236                this.journal_bytes = other.journal_bytes;
237                this.age = other.age;
238                this.waiters = other.waiters;
239                this.open_transactions = other.open_transactions;
240        }
241
242        @Override
243        public QueueInfo deepCopy() {
244                return new QueueInfo(this);
245        }
246
247        @Override
248        public void clear() {
249                this.head_item = null;
250                set_items_isSet(false);
251                this.items = 0;
252                set_bytes_isSet(false);
253                this.bytes = 0;
254                set_journal_bytes_isSet(false);
255                this.journal_bytes = 0;
256                set_age_isSet(false);
257                this.age = 0;
258                set_waiters_isSet(false);
259                this.waiters = 0;
260                set_open_transactions_isSet(false);
261                this.open_transactions = 0;
262        }
263
264        public byte[] get_head_item() {
265                set_head_item(org.apache.thrift7.TBaseHelper.rightSize(head_item));
266                return head_item == null ? null : head_item.array();
267        }
268
269        public ByteBuffer buffer_for_head_item() {
270                return head_item;
271        }
272
273        public void set_head_item(byte[] head_item) {
274                set_head_item(head_item == null ? (ByteBuffer) null : ByteBuffer.wrap(head_item));
275        }
276
277        public void set_head_item(ByteBuffer head_item) {
278                this.head_item = head_item;
279        }
280
281        public void unset_head_item() {
282                this.head_item = null;
283        }
284
285        /**
286         * Returns true if field head_item is set (has been assigned a value) and
287         * false otherwise
288         */
289        public boolean is_set_head_item() {
290                return this.head_item != null;
291        }
292
293        public void set_head_item_isSet(boolean value) {
294                if (!value) {
295                        this.head_item = null;
296                }
297        }
298
299        public long get_items() {
300                return this.items;
301        }
302
303        public void set_items(long items) {
304                this.items = items;
305                set_items_isSet(true);
306        }
307
308        public void unset_items() {
309                __isset_bit_vector.clear(__ITEMS_ISSET_ID);
310        }
311
312        /**
313         * Returns true if field items is set (has been assigned a value) and false
314         * otherwise
315         */
316        public boolean is_set_items() {
317                return __isset_bit_vector.get(__ITEMS_ISSET_ID);
318        }
319
320        public void set_items_isSet(boolean value) {
321                __isset_bit_vector.set(__ITEMS_ISSET_ID, value);
322        }
323
324        public long get_bytes() {
325                return this.bytes;
326        }
327
328        public void set_bytes(long bytes) {
329                this.bytes = bytes;
330                set_bytes_isSet(true);
331        }
332
333        public void unset_bytes() {
334                __isset_bit_vector.clear(__BYTES_ISSET_ID);
335        }
336
337        /**
338         * Returns true if field bytes is set (has been assigned a value) and false
339         * otherwise
340         */
341        public boolean is_set_bytes() {
342                return __isset_bit_vector.get(__BYTES_ISSET_ID);
343        }
344
345        public void set_bytes_isSet(boolean value) {
346                __isset_bit_vector.set(__BYTES_ISSET_ID, value);
347        }
348
349        public long get_journal_bytes() {
350                return this.journal_bytes;
351        }
352
353        public void set_journal_bytes(long journal_bytes) {
354                this.journal_bytes = journal_bytes;
355                set_journal_bytes_isSet(true);
356        }
357
358        public void unset_journal_bytes() {
359                __isset_bit_vector.clear(__JOURNAL_BYTES_ISSET_ID);
360        }
361
362        /**
363         * Returns true if field journal_bytes is set (has been assigned a value)
364         * and false otherwise
365         */
366        public boolean is_set_journal_bytes() {
367                return __isset_bit_vector.get(__JOURNAL_BYTES_ISSET_ID);
368        }
369
370        public void set_journal_bytes_isSet(boolean value) {
371                __isset_bit_vector.set(__JOURNAL_BYTES_ISSET_ID, value);
372        }
373
374        public long get_age() {
375                return this.age;
376        }
377
378        public void set_age(long age) {
379                this.age = age;
380                set_age_isSet(true);
381        }
382
383        public void unset_age() {
384                __isset_bit_vector.clear(__AGE_ISSET_ID);
385        }
386
387        /**
388         * Returns true if field age is set (has been assigned a value) and false
389         * otherwise
390         */
391        public boolean is_set_age() {
392                return __isset_bit_vector.get(__AGE_ISSET_ID);
393        }
394
395        public void set_age_isSet(boolean value) {
396                __isset_bit_vector.set(__AGE_ISSET_ID, value);
397        }
398
399        public int get_waiters() {
400                return this.waiters;
401        }
402
403        public void set_waiters(int waiters) {
404                this.waiters = waiters;
405                set_waiters_isSet(true);
406        }
407
408        public void unset_waiters() {
409                __isset_bit_vector.clear(__WAITERS_ISSET_ID);
410        }
411
412        /**
413         * Returns true if field waiters is set (has been assigned a value) and
414         * false otherwise
415         */
416        public boolean is_set_waiters() {
417                return __isset_bit_vector.get(__WAITERS_ISSET_ID);
418        }
419
420        public void set_waiters_isSet(boolean value) {
421                __isset_bit_vector.set(__WAITERS_ISSET_ID, value);
422        }
423
424        public int get_open_transactions() {
425                return this.open_transactions;
426        }
427
428        public void set_open_transactions(int open_transactions) {
429                this.open_transactions = open_transactions;
430                set_open_transactions_isSet(true);
431        }
432
433        public void unset_open_transactions() {
434                __isset_bit_vector.clear(__OPEN_TRANSACTIONS_ISSET_ID);
435        }
436
437        /**
438         * Returns true if field open_transactions is set (has been assigned a
439         * value) and false otherwise
440         */
441        public boolean is_set_open_transactions() {
442                return __isset_bit_vector.get(__OPEN_TRANSACTIONS_ISSET_ID);
443        }
444
445        public void set_open_transactions_isSet(boolean value) {
446                __isset_bit_vector.set(__OPEN_TRANSACTIONS_ISSET_ID, value);
447        }
448
449        @Override
450        public void setFieldValue(_Fields field, Object value) {
451                switch (field) {
452                case HEAD_ITEM:
453                        if (value == null) {
454                                unset_head_item();
455                        } else {
456                                set_head_item((ByteBuffer) value);
457                        }
458                        break;
459
460                case ITEMS:
461                        if (value == null) {
462                                unset_items();
463                        } else {
464                                set_items((Long) value);
465                        }
466                        break;
467
468                case BYTES:
469                        if (value == null) {
470                                unset_bytes();
471                        } else {
472                                set_bytes((Long) value);
473                        }
474                        break;
475
476                case JOURNAL_BYTES:
477                        if (value == null) {
478                                unset_journal_bytes();
479                        } else {
480                                set_journal_bytes((Long) value);
481                        }
482                        break;
483
484                case AGE:
485                        if (value == null) {
486                                unset_age();
487                        } else {
488                                set_age((Long) value);
489                        }
490                        break;
491
492                case WAITERS:
493                        if (value == null) {
494                                unset_waiters();
495                        } else {
496                                set_waiters((Integer) value);
497                        }
498                        break;
499
500                case OPEN_TRANSACTIONS:
501                        if (value == null) {
502                                unset_open_transactions();
503                        } else {
504                                set_open_transactions((Integer) value);
505                        }
506                        break;
507
508                }
509        }
510
511        @Override
512        public Object getFieldValue(_Fields field) {
513                switch (field) {
514                case HEAD_ITEM:
515                        return get_head_item();
516
517                case ITEMS:
518                        return Long.valueOf(get_items());
519
520                case BYTES:
521                        return Long.valueOf(get_bytes());
522
523                case JOURNAL_BYTES:
524                        return Long.valueOf(get_journal_bytes());
525
526                case AGE:
527                        return Long.valueOf(get_age());
528
529                case WAITERS:
530                        return Integer.valueOf(get_waiters());
531
532                case OPEN_TRANSACTIONS:
533                        return Integer.valueOf(get_open_transactions());
534
535                }
536                throw new IllegalStateException();
537        }
538
539        /**
540         * Returns true if field corresponding to fieldID is set (has been assigned
541         * a value) and false otherwise
542         */
543        @Override
544        public boolean isSet(_Fields field) {
545                if (field == null) {
546                        throw new IllegalArgumentException();
547                }
548
549                switch (field) {
550                case HEAD_ITEM:
551                        return is_set_head_item();
552                case ITEMS:
553                        return is_set_items();
554                case BYTES:
555                        return is_set_bytes();
556                case JOURNAL_BYTES:
557                        return is_set_journal_bytes();
558                case AGE:
559                        return is_set_age();
560                case WAITERS:
561                        return is_set_waiters();
562                case OPEN_TRANSACTIONS:
563                        return is_set_open_transactions();
564                }
565                throw new IllegalStateException();
566        }
567
568        @Override
569        public boolean equals(Object that) {
570                if (that == null)
571                        return false;
572                if (that instanceof QueueInfo)
573                        return this.equals((QueueInfo) that);
574                return false;
575        }
576
577        public boolean equals(QueueInfo that) {
578                if (that == null)
579                        return false;
580
581                final boolean this_present_head_item = true && this.is_set_head_item();
582                final boolean that_present_head_item = true && that.is_set_head_item();
583                if (this_present_head_item || that_present_head_item) {
584                        if (!(this_present_head_item && that_present_head_item))
585                                return false;
586                        if (!this.head_item.equals(that.head_item))
587                                return false;
588                }
589
590                final boolean this_present_items = true;
591                final boolean that_present_items = true;
592                if (this_present_items || that_present_items) {
593                        if (!(this_present_items && that_present_items))
594                                return false;
595                        if (this.items != that.items)
596                                return false;
597                }
598
599                final boolean this_present_bytes = true;
600                final boolean that_present_bytes = true;
601                if (this_present_bytes || that_present_bytes) {
602                        if (!(this_present_bytes && that_present_bytes))
603                                return false;
604                        if (this.bytes != that.bytes)
605                                return false;
606                }
607
608                final boolean this_present_journal_bytes = true;
609                final boolean that_present_journal_bytes = true;
610                if (this_present_journal_bytes || that_present_journal_bytes) {
611                        if (!(this_present_journal_bytes && that_present_journal_bytes))
612                                return false;
613                        if (this.journal_bytes != that.journal_bytes)
614                                return false;
615                }
616
617                final boolean this_present_age = true;
618                final boolean that_present_age = true;
619                if (this_present_age || that_present_age) {
620                        if (!(this_present_age && that_present_age))
621                                return false;
622                        if (this.age != that.age)
623                                return false;
624                }
625
626                final boolean this_present_waiters = true;
627                final boolean that_present_waiters = true;
628                if (this_present_waiters || that_present_waiters) {
629                        if (!(this_present_waiters && that_present_waiters))
630                                return false;
631                        if (this.waiters != that.waiters)
632                                return false;
633                }
634
635                final boolean this_present_open_transactions = true;
636                final boolean that_present_open_transactions = true;
637                if (this_present_open_transactions || that_present_open_transactions) {
638                        if (!(this_present_open_transactions && that_present_open_transactions))
639                                return false;
640                        if (this.open_transactions != that.open_transactions)
641                                return false;
642                }
643
644                return true;
645        }
646
647        @Override
648        public int hashCode() {
649                final HashCodeBuilder builder = new HashCodeBuilder();
650
651                final boolean present_head_item = true && (is_set_head_item());
652                builder.append(present_head_item);
653                if (present_head_item)
654                        builder.append(head_item);
655
656                final boolean present_items = true;
657                builder.append(present_items);
658                if (present_items)
659                        builder.append(items);
660
661                final boolean present_bytes = true;
662                builder.append(present_bytes);
663                if (present_bytes)
664                        builder.append(bytes);
665
666                final boolean present_journal_bytes = true;
667                builder.append(present_journal_bytes);
668                if (present_journal_bytes)
669                        builder.append(journal_bytes);
670
671                final boolean present_age = true;
672                builder.append(present_age);
673                if (present_age)
674                        builder.append(age);
675
676                final boolean present_waiters = true;
677                builder.append(present_waiters);
678                if (present_waiters)
679                        builder.append(waiters);
680
681                final boolean present_open_transactions = true;
682                builder.append(present_open_transactions);
683                if (present_open_transactions)
684                        builder.append(open_transactions);
685
686                return builder.toHashCode();
687        }
688
689        @Override
690        public int compareTo(QueueInfo other) {
691                if (!getClass().equals(other.getClass())) {
692                        return getClass().getName().compareTo(other.getClass().getName());
693                }
694
695                int lastComparison = 0;
696                final QueueInfo typedOther = other;
697
698                lastComparison = Boolean.valueOf(is_set_head_item()).compareTo(typedOther.is_set_head_item());
699                if (lastComparison != 0) {
700                        return lastComparison;
701                }
702                if (is_set_head_item()) {
703                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.head_item, typedOther.head_item);
704                        if (lastComparison != 0) {
705                                return lastComparison;
706                        }
707                }
708                lastComparison = Boolean.valueOf(is_set_items()).compareTo(typedOther.is_set_items());
709                if (lastComparison != 0) {
710                        return lastComparison;
711                }
712                if (is_set_items()) {
713                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.items, typedOther.items);
714                        if (lastComparison != 0) {
715                                return lastComparison;
716                        }
717                }
718                lastComparison = Boolean.valueOf(is_set_bytes()).compareTo(typedOther.is_set_bytes());
719                if (lastComparison != 0) {
720                        return lastComparison;
721                }
722                if (is_set_bytes()) {
723                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.bytes, typedOther.bytes);
724                        if (lastComparison != 0) {
725                                return lastComparison;
726                        }
727                }
728                lastComparison = Boolean.valueOf(is_set_journal_bytes()).compareTo(typedOther.is_set_journal_bytes());
729                if (lastComparison != 0) {
730                        return lastComparison;
731                }
732                if (is_set_journal_bytes()) {
733                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.journal_bytes, typedOther.journal_bytes);
734                        if (lastComparison != 0) {
735                                return lastComparison;
736                        }
737                }
738                lastComparison = Boolean.valueOf(is_set_age()).compareTo(typedOther.is_set_age());
739                if (lastComparison != 0) {
740                        return lastComparison;
741                }
742                if (is_set_age()) {
743                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.age, typedOther.age);
744                        if (lastComparison != 0) {
745                                return lastComparison;
746                        }
747                }
748                lastComparison = Boolean.valueOf(is_set_waiters()).compareTo(typedOther.is_set_waiters());
749                if (lastComparison != 0) {
750                        return lastComparison;
751                }
752                if (is_set_waiters()) {
753                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.waiters, typedOther.waiters);
754                        if (lastComparison != 0) {
755                                return lastComparison;
756                        }
757                }
758                lastComparison = Boolean.valueOf(is_set_open_transactions()).compareTo(typedOther.is_set_open_transactions());
759                if (lastComparison != 0) {
760                        return lastComparison;
761                }
762                if (is_set_open_transactions()) {
763                        lastComparison = org.apache.thrift7.TBaseHelper.compareTo(this.open_transactions,
764                                        typedOther.open_transactions);
765                        if (lastComparison != 0) {
766                                return lastComparison;
767                        }
768                }
769                return 0;
770        }
771
772        @Override
773        public _Fields fieldForId(int fieldId) {
774                return _Fields.findByThriftId(fieldId);
775        }
776
777        @Override
778        public void read(org.apache.thrift7.protocol.TProtocol iprot) throws org.apache.thrift7.TException {
779                org.apache.thrift7.protocol.TField field;
780                iprot.readStructBegin();
781                while (true)
782                {
783                        field = iprot.readFieldBegin();
784                        if (field.type == org.apache.thrift7.protocol.TType.STOP) {
785                                break;
786                        }
787                        switch (field.id) {
788                        case 1: // HEAD_ITEM
789                                if (field.type == org.apache.thrift7.protocol.TType.STRING) {
790                                        this.head_item = iprot.readBinary();
791                                } else {
792                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
793                                }
794                                break;
795                        case 2: // ITEMS
796                                if (field.type == org.apache.thrift7.protocol.TType.I64) {
797                                        this.items = iprot.readI64();
798                                        set_items_isSet(true);
799                                } else {
800                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
801                                }
802                                break;
803                        case 3: // BYTES
804                                if (field.type == org.apache.thrift7.protocol.TType.I64) {
805                                        this.bytes = iprot.readI64();
806                                        set_bytes_isSet(true);
807                                } else {
808                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
809                                }
810                                break;
811                        case 4: // JOURNAL_BYTES
812                                if (field.type == org.apache.thrift7.protocol.TType.I64) {
813                                        this.journal_bytes = iprot.readI64();
814                                        set_journal_bytes_isSet(true);
815                                } else {
816                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
817                                }
818                                break;
819                        case 5: // AGE
820                                if (field.type == org.apache.thrift7.protocol.TType.I64) {
821                                        this.age = iprot.readI64();
822                                        set_age_isSet(true);
823                                } else {
824                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
825                                }
826                                break;
827                        case 6: // WAITERS
828                                if (field.type == org.apache.thrift7.protocol.TType.I32) {
829                                        this.waiters = iprot.readI32();
830                                        set_waiters_isSet(true);
831                                } else {
832                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
833                                }
834                                break;
835                        case 7: // OPEN_TRANSACTIONS
836                                if (field.type == org.apache.thrift7.protocol.TType.I32) {
837                                        this.open_transactions = iprot.readI32();
838                                        set_open_transactions_isSet(true);
839                                } else {
840                                        org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
841                                }
842                                break;
843                        default:
844                                org.apache.thrift7.protocol.TProtocolUtil.skip(iprot, field.type);
845                        }
846                        iprot.readFieldEnd();
847                }
848                iprot.readStructEnd();
849                validate();
850        }
851
852        @Override
853        public void write(org.apache.thrift7.protocol.TProtocol oprot) throws org.apache.thrift7.TException {
854                validate();
855
856                oprot.writeStructBegin(STRUCT_DESC);
857                if (this.head_item != null) {
858                        if (is_set_head_item()) {
859                                oprot.writeFieldBegin(HEAD_ITEM_FIELD_DESC);
860                                oprot.writeBinary(this.head_item);
861                                oprot.writeFieldEnd();
862                        }
863                }
864                oprot.writeFieldBegin(ITEMS_FIELD_DESC);
865                oprot.writeI64(this.items);
866                oprot.writeFieldEnd();
867                oprot.writeFieldBegin(BYTES_FIELD_DESC);
868                oprot.writeI64(this.bytes);
869                oprot.writeFieldEnd();
870                oprot.writeFieldBegin(JOURNAL_BYTES_FIELD_DESC);
871                oprot.writeI64(this.journal_bytes);
872                oprot.writeFieldEnd();
873                oprot.writeFieldBegin(AGE_FIELD_DESC);
874                oprot.writeI64(this.age);
875                oprot.writeFieldEnd();
876                oprot.writeFieldBegin(WAITERS_FIELD_DESC);
877                oprot.writeI32(this.waiters);
878                oprot.writeFieldEnd();
879                oprot.writeFieldBegin(OPEN_TRANSACTIONS_FIELD_DESC);
880                oprot.writeI32(this.open_transactions);
881                oprot.writeFieldEnd();
882                oprot.writeFieldStop();
883                oprot.writeStructEnd();
884        }
885
886        @Override
887        public String toString() {
888                final StringBuilder sb = new StringBuilder("QueueInfo(");
889                boolean first = true;
890
891                if (is_set_head_item()) {
892                        sb.append("head_item:");
893                        if (this.head_item == null) {
894                                sb.append("null");
895                        } else {
896                                org.apache.thrift7.TBaseHelper.toString(this.head_item, sb);
897                        }
898                        first = false;
899                }
900                if (!first)
901                        sb.append(", ");
902                sb.append("items:");
903                sb.append(this.items);
904                first = false;
905                if (!first)
906                        sb.append(", ");
907                sb.append("bytes:");
908                sb.append(this.bytes);
909                first = false;
910                if (!first)
911                        sb.append(", ");
912                sb.append("journal_bytes:");
913                sb.append(this.journal_bytes);
914                first = false;
915                if (!first)
916                        sb.append(", ");
917                sb.append("age:");
918                sb.append(this.age);
919                first = false;
920                if (!first)
921                        sb.append(", ");
922                sb.append("waiters:");
923                sb.append(this.waiters);
924                first = false;
925                if (!first)
926                        sb.append(", ");
927                sb.append("open_transactions:");
928                sb.append(this.open_transactions);
929                first = false;
930                sb.append(")");
931                return sb.toString();
932        }
933
934        public void validate() throws org.apache.thrift7.TException {
935                // check for required fields
936        }
937
938        private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
939                try {
940                        write(new org.apache.thrift7.protocol.TCompactProtocol(new org.apache.thrift7.transport.TIOStreamTransport(
941                                        out)));
942                } catch (final org.apache.thrift7.TException te) {
943                        throw new java.io.IOException(te);
944                }
945        }
946
947        private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
948                try {
949                        // it doesn't seem like you should have to do this, but java
950                        // serialization is wacky, and doesn't call the default constructor.
951                        __isset_bit_vector = new BitSet(1);
952                        read(new org.apache.thrift7.protocol.TCompactProtocol(new org.apache.thrift7.transport.TIOStreamTransport(in)));
953                } catch (final org.apache.thrift7.TException te) {
954                        throw new java.io.IOException(te);
955                }
956        }
957
958}