001// ______________________________________________________
002// Generated by sql2java - https://github.com/10km/sql2java-2-6-7 (custom branch) 
003// modified by guyadong from
004// sql2java original version https://sourceforge.net/projects/sql2java/ 
005// JDBC driver used at code generation time: com.mysql.jdbc.Driver
006// template: equalsbuilder.java.vm
007// ______________________________________________________
008package net.gdface.facelog.db;
009
010/*
011 * Copyright 2002-2005 The Apache Software Foundation.
012 * 
013 * Licensed under the Apache License, Version 2.0 (the "License");
014 * you may not use this file except in compliance with the License.
015 * You may obtain a copy of the License at
016 * 
017 *      http://www.apache.org/licenses/LICENSE-2.0
018 * 
019 * Unless required by applicable law or agreed to in writing, software
020 * distributed under the License is distributed on an "AS IS" BASIS,
021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
022 * See the License for the specific language governing permissions and
023 * limitations under the License.
024 */
025import java.lang.reflect.AccessibleObject;
026import java.lang.reflect.Field;
027import java.lang.reflect.Modifier;
028
029/**
030 * <p>Assists in implementing {@link Object#equals(Object)} methods.</p>
031 *
032 * <p> This class provides methods to build a good equals method for any
033 * class. It follows rules laid out in
034 * <a href="http://java.sun.com/docs/books/effective/index.html">Effective Java</a>
035 * , by Joshua Bloch. In particular the rule for comparing <code>doubles</code>,
036 * <code>floats</code>, and arrays can be tricky. Also, making sure that
037 * <code>equals()</code> and <code>hashCode()</code> are consistent can be
038 * difficult.</p>
039 *
040 * <p>Two Objects that compare as equals must generate the same hash code,
041 * but two Objects with the same hash code do not have to be equal.</p>
042 *
043 * <p>All relevant fields should be included in the calculation of equals.
044 * Derived fields may be ignored. In particular, any field used in
045 * generating a hash code must be used in the equals method, and vice
046 * versa.</p>
047 *
048 * <p>Typical use for the code is as follows:</p>
049 * <pre>
050 * public boolean equals(Object obj) {
051 *   if (obj instanceof MyClass == false) {
052 *     return false;
053 *   }
054 *   if (this == obj) {
055 *     return true;
056 *   }
057 *   MyClass rhs = (MyClass) obj;
058 *   return new EqualsBuilder()
059 *                 .appendSuper(super.equals(obj))
060 *                 .append(field1, rhs.field1)
061 *                 .append(field2, rhs.field2)
062 *                 .append(field3, rhs.field3)
063 *                 .isEquals();
064 *  }
065 * </pre>
066 *
067 * <p> Alternatively, there is a method that uses reflection to determine
068 * the fields to test. Because these fields are usually private, the method,
069 * <code>reflectionEquals</code>, uses <code>AccessibleObject.setAccessible</code> to
070 * change the visibility of the fields. This will fail under a security
071 * manager, unless the appropriate permissions are set up correctly. It is
072 * also slower than testing explicitly.</p>
073 *
074 * <p> A typical invocation for this method would look like:</p>
075 * <pre>
076 * public boolean equals(Object obj) {
077 *   return EqualsBuilder.reflectionEquals(this, obj);
078 * }
079 * </pre>
080 *
081 * @author <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>
082 * @author Stephen Colebourne
083 * @author Gary Gregory
084 * @author Pete Gieser
085 * @author Arun Mammen Thomas
086 * @since 1.0
087 * @version $Id: EqualsBuilder.java 161243 2005-04-14 04:30:28Z ggregory $
088 */
089public class EqualsBuilder {
090    
091    /**
092     * If the fields tested are equals.
093     * The default value is <code>true</code>.
094     */
095    private boolean isEquals = true;
096
097    /**
098     * <p>Constructor for EqualsBuilder.</p>
099     *
100     * <p>Starts off assuming that equals is <code>true</code>.</p>
101     * @see Object#equals(Object)
102     */
103    public EqualsBuilder() {
104        // do nothing for now.
105    }
106
107    //-------------------------------------------------------------------------
108
109    /**
110     * <p>This method uses reflection to determine if the two <code>Object</code>s
111     * are equal.</p>
112     *
113     * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
114     * fields. This means that it will throw a security exception if run under
115     * a security manager, if the permissions are not set up correctly. It is also
116     * not as efficient as testing explicitly.</p>
117     *
118     * <p>Transient members will be not be tested, as they are likely derived
119     * fields, and not part of the value of the Object.</p>
120     *
121     * <p>Static fields will not be tested. Superclass fields will be included.</p>
122     *
123     * @param lhs  <code>this</code> object
124     * @param rhs  the other object
125     * @return <code>true</code> if the two Objects have tested equals.
126     */
127    public static boolean reflectionEquals(Object lhs, Object rhs) {
128        return reflectionEquals(lhs, rhs, false, null);
129    }
130
131    /**
132     * <p>This method uses reflection to determine if the two <code>Object</code>s
133     * are equal.</p>
134     *
135     * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
136     * fields. This means that it will throw a security exception if run under
137     * a security manager, if the permissions are not set up correctly. It is also
138     * not as efficient as testing explicitly.</p>
139     *
140     * <p>If the TestTransients parameter is set to <code>true</code>, transient
141     * members will be tested, otherwise they are ignored, as they are likely
142     * derived fields, and not part of the value of the <code>Object</code>.</p>
143     *
144     * <p>Static fields will not be tested. Superclass fields will be included.</p>
145     *
146     * @param lhs  <code>this</code> object
147     * @param rhs  the other object
148     * @param testTransients  whether to include transient fields
149     * @return <code>true</code> if the two Objects have tested equals.
150     */
151    public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients) {
152        return reflectionEquals(lhs, rhs, testTransients, null);
153    }
154
155    /**
156     * <p>This method uses reflection to determine if the two <code>Object</code>s
157     * are equal.</p>
158     *
159     * <p>It uses <code>AccessibleObject.setAccessible</code> to gain access to private
160     * fields. This means that it will throw a security exception if run under
161     * a security manager, if the permissions are not set up correctly. It is also
162     * not as efficient as testing explicitly.</p>
163     *
164     * <p>If the testTransients parameter is set to <code>true</code>, transient
165     * members will be tested, otherwise they are ignored, as they are likely
166     * derived fields, and not part of the value of the <code>Object</code>.</p>
167     *
168     * <p>Static fields will not be included. Superclass fields will be appended
169     * up to and including the specified superclass. A null superclass is treated
170     * as java.lang.Object.</p>
171     *
172     * @param lhs  <code>this</code> object
173     * @param rhs  the other object
174     * @param testTransients  whether to include transient fields
175     * @param reflectUpToClass  the superclass to reflect up to (inclusive),
176     *  may be <code>null</code>
177     * @return <code>true</code> if the two Objects have tested equals.
178     * @since 2.0
179     */
180    public static boolean reflectionEquals(Object lhs, Object rhs, boolean testTransients, Class reflectUpToClass) {
181        if (lhs == rhs) {
182            return true;
183        }
184        if (lhs == null || rhs == null) {
185            return false;
186        }
187        // Find the leaf class since there may be transients in the leaf 
188        // class or in classes between the leaf and root.
189        // If we are not testing transients or a subclass has no ivars, 
190        // then a subclass can test equals to a superclass.
191        Class lhsClass = lhs.getClass();
192        Class rhsClass = rhs.getClass();
193        Class testClass;
194        if (lhsClass.isInstance(rhs)) {
195            testClass = lhsClass;
196            if (!rhsClass.isInstance(lhs)) {
197                // rhsClass is a subclass of lhsClass
198                testClass = rhsClass;
199            }
200        } else if (rhsClass.isInstance(lhs)) {
201            testClass = rhsClass;
202            if (!lhsClass.isInstance(rhs)) {
203                // lhsClass is a subclass of rhsClass
204                testClass = lhsClass;
205            }
206        } else {
207            // The two classes are not related.
208            return false;
209        }
210        EqualsBuilder equalsBuilder = new EqualsBuilder();
211        try {
212            reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients);
213            while (testClass.getSuperclass() != null && testClass != reflectUpToClass) {
214                testClass = testClass.getSuperclass();
215                reflectionAppend(lhs, rhs, testClass, equalsBuilder, testTransients);
216            }
217        } catch (IllegalArgumentException e) {
218            // In this case, we tried to test a subclass vs. a superclass and
219            // the subclass has ivars or the ivars are transient and 
220            // we are testing transients.
221            // If a subclass has ivars that we are trying to test them, we get an
222            // exception and we know that the objects are not equal.
223            return false;
224        }
225        return equalsBuilder.isEquals();
226    }
227
228    /**
229     * <p>Appends the fields and values defined by the given object of the
230     * given Class.</p>
231     * 
232     * @param lhs  the left hand object
233     * @param rhs  the right hand object
234     * @param clazz  the class to append details of
235     * @param builder  the builder to append to
236     * @param useTransients  whether to test transient fields
237     */
238    private static void reflectionAppend(
239        Object lhs,
240        Object rhs,
241        Class clazz,
242        EqualsBuilder builder,
243        boolean useTransients) {
244        Field[] fields = clazz.getDeclaredFields();
245        AccessibleObject.setAccessible(fields, true);
246        for (int i = 0; i < fields.length && builder.isEquals; i++) {
247            Field f = fields[i];
248            if ((f.getName().indexOf('$') == -1)
249                && (useTransients || !Modifier.isTransient(f.getModifiers()))
250                && (!Modifier.isStatic(f.getModifiers()))) {
251                try {
252                    builder.append(f.get(lhs), f.get(rhs));
253                } catch (IllegalAccessException e) {
254                    //this can't happen. Would get a Security exception instead
255                    //throw a runtime exception in case the impossible happens.
256                    throw new InternalError("Unexpected IllegalAccessException");
257                }
258            }
259        }
260    }
261
262    //-------------------------------------------------------------------------
263
264    /**
265     * <p>Adds the result of <code>super.equals()</code> to this builder.</p>
266     *
267     * @param superEquals  the result of calling <code>super.equals()</code>
268     * @return EqualsBuilder - used to chain calls.
269     * @since 2.0
270     */
271    public EqualsBuilder appendSuper(boolean superEquals) {
272        if (isEquals == false) {
273            return this;
274        }
275        isEquals = superEquals;
276        return this;
277    }
278
279    //-------------------------------------------------------------------------
280
281    /**
282     * <p>Test if two <code>Object</code>s are equal using their
283     * <code>equals</code> method.</p>
284     *
285     * @param lhs  the left hand object
286     * @param rhs  the right hand object
287     * @return EqualsBuilder - used to chain calls.
288     */
289    public EqualsBuilder append(Object lhs, Object rhs) {
290        if (isEquals == false) {
291            return this;
292        }
293        if (lhs == rhs) {
294            return this;
295        }
296        if (lhs == null || rhs == null) {
297            this.setEquals(false);
298            return this;
299        }
300        Class lhsClass = lhs.getClass();
301        if (!lhsClass.isArray()) {
302            // The simple case, not an array, just test the element
303            isEquals = lhs.equals(rhs);
304        } else if (lhs.getClass() != rhs.getClass()) {
305            // Here when we compare different dimensions, for example: a boolean[][] to a boolean[] 
306            this.setEquals(false);
307        }
308        // 'Switch' on type of array, to dispatch to the correct handler
309        // This handles multi dimensional arrays of the same depth
310        else if (lhs instanceof long[]) {
311            append((long[]) lhs, (long[]) rhs);
312        } else if (lhs instanceof int[]) {
313            append((int[]) lhs, (int[]) rhs);
314        } else if (lhs instanceof short[]) {
315            append((short[]) lhs, (short[]) rhs);
316        } else if (lhs instanceof char[]) {
317            append((char[]) lhs, (char[]) rhs);
318        } else if (lhs instanceof byte[]) {
319            append((byte[]) lhs, (byte[]) rhs);
320        } else if (lhs instanceof double[]) {
321            append((double[]) lhs, (double[]) rhs);
322        } else if (lhs instanceof float[]) {
323            append((float[]) lhs, (float[]) rhs);
324        } else if (lhs instanceof boolean[]) {
325            append((boolean[]) lhs, (boolean[]) rhs);
326        } else {
327            // Not an array of primitives
328            append((Object[]) lhs, (Object[]) rhs);
329        }
330        return this;
331    }
332
333    /**
334     * <p>
335     * Test if two <code>long</code> s are equal.
336     * </p>
337     * 
338     * @param lhs
339     *                  the left hand <code>long</code>
340     * @param rhs
341     *                  the right hand <code>long</code>
342     * @return EqualsBuilder - used to chain calls.
343     */
344    public EqualsBuilder append(long lhs, long rhs) {
345        if (isEquals == false) {
346            return this;
347        }
348        isEquals = (lhs == rhs);
349        return this;
350    }
351
352    /**
353     * <p>Test if two <code>int</code>s are equal.</p>
354     *
355     * @param lhs  the left hand <code>int</code>
356     * @param rhs  the right hand <code>int</code>
357     * @return EqualsBuilder - used to chain calls.
358     */
359    public EqualsBuilder append(int lhs, int rhs) {
360        if (isEquals == false) {
361            return this;
362        }
363        isEquals = (lhs == rhs);
364        return this;
365    }
366
367    /**
368     * <p>Test if two <code>short</code>s are equal.</p>
369     *
370     * @param lhs  the left hand <code>short</code>
371     * @param rhs  the right hand <code>short</code>
372     * @return EqualsBuilder - used to chain calls.
373     */
374    public EqualsBuilder append(short lhs, short rhs) {
375        if (isEquals == false) {
376            return this;
377        }
378        isEquals = (lhs == rhs);
379        return this;
380    }
381
382    /**
383     * <p>Test if two <code>char</code>s are equal.</p>
384     *
385     * @param lhs  the left hand <code>char</code>
386     * @param rhs  the right hand <code>char</code>
387     * @return EqualsBuilder - used to chain calls.
388     */
389    public EqualsBuilder append(char lhs, char rhs) {
390        if (isEquals == false) {
391            return this;
392        }
393        isEquals = (lhs == rhs);
394        return this;
395    }
396
397    /**
398     * <p>Test if two <code>byte</code>s are equal.</p>
399     *
400     * @param lhs  the left hand <code>byte</code>
401     * @param rhs  the right hand <code>byte</code>
402     * @return EqualsBuilder - used to chain calls.
403     */
404    public EqualsBuilder append(byte lhs, byte rhs) {
405        if (isEquals == false) {
406            return this;
407        }
408        isEquals = (lhs == rhs);
409        return this;
410    }
411
412    /**
413     * <p>Test if two <code>double</code>s are equal by testing that the
414     * pattern of bits returned by <code>doubleToLong</code> are equal.</p>
415     *
416     * <p>This handles NaNs, Infinities, and <code>-0.0</code>.</p>
417     *
418     * <p>It is compatible with the hash code generated by
419     * <code>HashCodeBuilder</code>.</p>
420     *
421     * @param lhs  the left hand <code>double</code>
422     * @param rhs  the right hand <code>double</code>
423     * @return EqualsBuilder - used to chain calls.
424     */
425    public EqualsBuilder append(double lhs, double rhs) {
426        if (isEquals == false) {
427            return this;
428        }
429        return append(Double.doubleToLongBits(lhs), Double.doubleToLongBits(rhs));
430    }
431
432    /**
433     * <p>Test if two <code>float</code>s are equal byt testing that the
434     * pattern of bits returned by doubleToLong are equal.</p>
435     *
436     * <p>This handles NaNs, Infinities, and <code>-0.0</code>.</p>
437     *
438     * <p>It is compatible with the hash code generated by
439     * <code>HashCodeBuilder</code>.</p>
440     *
441     * @param lhs  the left hand <code>float</code>
442     * @param rhs  the right hand <code>float</code>
443     * @return EqualsBuilder - used to chain calls.
444     */
445    public EqualsBuilder append(float lhs, float rhs) {
446        if (isEquals == false) {
447            return this;
448        }
449        return append(Float.floatToIntBits(lhs), Float.floatToIntBits(rhs));
450    }
451
452    /**
453     * <p>Test if two <code>booleans</code>s are equal.</p>
454     *
455     * @param lhs  the left hand <code>boolean</code>
456     * @param rhs  the right hand <code>boolean</code>
457     * @return EqualsBuilder - used to chain calls.
458      */
459    public EqualsBuilder append(boolean lhs, boolean rhs) {
460        if (isEquals == false) {
461            return this;
462        }
463        isEquals = (lhs == rhs);
464        return this;
465    }
466
467    /**
468     * <p>Performs a deep comparison of two <code>Object</code> arrays.</p>
469     *
470     * <p>This also will be called for the top level of
471     * multi-dimensional, ragged, and multi-typed arrays.</p>
472     *
473     * @param lhs  the left hand <code>Object[]</code>
474     * @param rhs  the right hand <code>Object[]</code>
475     * @return EqualsBuilder - used to chain calls.
476     */
477    public EqualsBuilder append(Object[] lhs, Object[] rhs) {
478        if (isEquals == false) {
479            return this;
480        }
481        if (lhs == rhs) {
482            return this;
483        }
484        if (lhs == null || rhs == null) {
485            this.setEquals(false);
486            return this;
487        }
488        if (lhs.length != rhs.length) {
489            this.setEquals(false);
490            return this;
491        }
492        for (int i = 0; i < lhs.length && isEquals; ++i) {
493            append(lhs[i], rhs[i]);
494        }
495        return this;
496    }
497
498    /**
499     * <p>Deep comparison of array of <code>long</code>. Length and all
500     * values are compared.</p>
501     *
502     * <p>The method {@link #append(long, long)} is used.</p>
503     *
504     * @param lhs  the left hand <code>long[]</code>
505     * @param rhs  the right hand <code>long[]</code>
506     * @return EqualsBuilder - used to chain calls.
507     */
508    public EqualsBuilder append(long[] lhs, long[] rhs) {
509        if (isEquals == false) {
510            return this;
511        }
512        if (lhs == rhs) {
513            return this;
514        }
515        if (lhs == null || rhs == null) {
516            this.setEquals(false);
517            return this;
518        }
519        if (lhs.length != rhs.length) {
520            this.setEquals(false);
521            return this;
522        }
523        for (int i = 0; i < lhs.length && isEquals; ++i) {
524            append(lhs[i], rhs[i]);
525        }
526        return this;
527    }
528
529    /**
530     * <p>Deep comparison of array of <code>int</code>. Length and all
531     * values are compared.</p>
532     *
533     * <p>The method {@link #append(int, int)} is used.</p>
534     *
535     * @param lhs  the left hand <code>int[]</code>
536     * @param rhs  the right hand <code>int[]</code>
537     * @return EqualsBuilder - used to chain calls.
538     */
539    public EqualsBuilder append(int[] lhs, int[] rhs) {
540        if (isEquals == false) {
541            return this;
542        }
543        if (lhs == rhs) {
544            return this;
545        }
546        if (lhs == null || rhs == null) {
547            this.setEquals(false);
548            return this;
549        }
550        if (lhs.length != rhs.length) {
551            this.setEquals(false);
552            return this;
553        }
554        for (int i = 0; i < lhs.length && isEquals; ++i) {
555            append(lhs[i], rhs[i]);
556        }
557        return this;
558    }
559
560    /**
561     * <p>Deep comparison of array of <code>short</code>. Length and all
562     * values are compared.</p>
563     *
564     * <p>The method {@link #append(short, short)} is used.</p>
565     *
566     * @param lhs  the left hand <code>short[]</code>
567     * @param rhs  the right hand <code>short[]</code>
568     * @return EqualsBuilder - used to chain calls.
569     */
570    public EqualsBuilder append(short[] lhs, short[] rhs) {
571        if (isEquals == false) {
572            return this;
573        }
574        if (lhs == rhs) {
575            return this;
576        }
577        if (lhs == null || rhs == null) {
578            this.setEquals(false);
579            return this;
580        }
581        if (lhs.length != rhs.length) {
582            this.setEquals(false);
583            return this;
584        }
585        for (int i = 0; i < lhs.length && isEquals; ++i) {
586            append(lhs[i], rhs[i]);
587        }
588        return this;
589    }
590
591    /**
592     * <p>Deep comparison of array of <code>char</code>. Length and all
593     * values are compared.</p>
594     *
595     * <p>The method {@link #append(char, char)} is used.</p>
596     *
597     * @param lhs  the left hand <code>char[]</code>
598     * @param rhs  the right hand <code>char[]</code>
599     * @return EqualsBuilder - used to chain calls.
600     */
601    public EqualsBuilder append(char[] lhs, char[] rhs) {
602        if (isEquals == false) {
603            return this;
604        }
605        if (lhs == rhs) {
606            return this;
607        }
608        if (lhs == null || rhs == null) {
609            this.setEquals(false);
610            return this;
611        }
612        if (lhs.length != rhs.length) {
613            this.setEquals(false);
614            return this;
615        }
616        for (int i = 0; i < lhs.length && isEquals; ++i) {
617            append(lhs[i], rhs[i]);
618        }
619        return this;
620    }
621
622    /**
623     * <p>Deep comparison of array of <code>byte</code>. Length and all
624     * values are compared.</p>
625     *
626     * <p>The method {@link #append(byte, byte)} is used.</p>
627     *
628     * @param lhs  the left hand <code>byte[]</code>
629     * @param rhs  the right hand <code>byte[]</code>
630     * @return EqualsBuilder - used to chain calls.
631     */
632    public EqualsBuilder append(byte[] lhs, byte[] rhs) {
633        if (isEquals == false) {
634            return this;
635        }
636        if (lhs == rhs) {
637            return this;
638        }
639        if (lhs == null || rhs == null) {
640            this.setEquals(false);
641            return this;
642        }
643        if (lhs.length != rhs.length) {
644            this.setEquals(false);
645            return this;
646        }
647        for (int i = 0; i < lhs.length && isEquals; ++i) {
648            append(lhs[i], rhs[i]);
649        }
650        return this;
651    }
652
653    /**
654     * <p>Deep comparison of array of <code>double</code>. Length and all
655     * values are compared.</p>
656     *
657     * <p>The method {@link #append(double, double)} is used.</p>
658     *
659     * @param lhs  the left hand <code>double[]</code>
660     * @param rhs  the right hand <code>double[]</code>
661     * @return EqualsBuilder - used to chain calls.
662     */
663    public EqualsBuilder append(double[] lhs, double[] rhs) {
664        if (isEquals == false) {
665            return this;
666        }
667        if (lhs == rhs) {
668            return this;
669        }
670        if (lhs == null || rhs == null) {
671            this.setEquals(false);
672            return this;
673        }
674        if (lhs.length != rhs.length) {
675            this.setEquals(false);
676            return this;
677        }
678        for (int i = 0; i < lhs.length && isEquals; ++i) {
679            append(lhs[i], rhs[i]);
680        }
681        return this;
682    }
683
684    /**
685     * <p>Deep comparison of array of <code>float</code>. Length and all
686     * values are compared.</p>
687     *
688     * <p>The method {@link #append(float, float)} is used.</p>
689     *
690     * @param lhs  the left hand <code>float[]</code>
691     * @param rhs  the right hand <code>float[]</code>
692     * @return EqualsBuilder - used to chain calls.
693     */
694    public EqualsBuilder append(float[] lhs, float[] rhs) {
695        if (isEquals == false) {
696            return this;
697        }
698        if (lhs == rhs) {
699            return this;
700        }
701        if (lhs == null || rhs == null) {
702            this.setEquals(false);
703            return this;
704        }
705        if (lhs.length != rhs.length) {
706            this.setEquals(false);
707            return this;
708        }
709        for (int i = 0; i < lhs.length && isEquals; ++i) {
710            append(lhs[i], rhs[i]);
711        }
712        return this;
713    }
714
715    /**
716     * <p>Deep comparison of array of <code>boolean</code>. Length and all
717     * values are compared.</p>
718     *
719     * <p>The method {@link #append(boolean, boolean)} is used.</p>
720     *
721     * @param lhs  the left hand <code>boolean[]</code>
722     * @param rhs  the right hand <code>boolean[]</code>
723     * @return EqualsBuilder - used to chain calls.
724     */
725    public EqualsBuilder append(boolean[] lhs, boolean[] rhs) {
726        if (isEquals == false) {
727            return this;
728        }
729        if (lhs == rhs) {
730            return this;
731        }
732        if (lhs == null || rhs == null) {
733            this.setEquals(false);
734            return this;
735        }
736        if (lhs.length != rhs.length) {
737            this.setEquals(false);
738            return this;
739        }
740        for (int i = 0; i < lhs.length && isEquals; ++i) {
741            append(lhs[i], rhs[i]);
742        }
743        return this;
744    }
745
746    /**
747     * <p>Returns <code>true</code> if the fields that have been checked
748     * are all equal.</p>
749     *
750     * @return boolean
751     */
752    public boolean isEquals() {
753        return this.isEquals;
754    }
755
756    /**
757     * Sets the <code>isEquals</code> value.
758     * 
759     * @param isEquals The value to set.
760     * @since 2.1
761     */
762    protected void setEquals(boolean isEquals) {
763        this.isEquals = isEquals;
764    }
765}