Skip to content

Commit 3617bc1

Browse files
committed
Better internal names
1 parent cebde03 commit 3617bc1

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

src/main/java/org/apache/commons/lang3/builder/HashCodeBuilder.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -493,19 +493,19 @@ private static void unregister(final Object value) {
493493
/**
494494
* Constant to use in building the hashCode.
495495
*/
496-
private final int iConstant;
496+
private final int constant;
497497

498498
/**
499499
* Running total of the hashCode.
500500
*/
501-
private int iTotal;
501+
private int total;
502502

503503
/**
504504
* Uses two hard coded choices for the constants needed to build a {@code hashCode}.
505505
*/
506506
public HashCodeBuilder() {
507-
iConstant = 37;
508-
iTotal = 17;
507+
constant = 37;
508+
total = 17;
509509
}
510510

511511
/**
@@ -526,8 +526,8 @@ public HashCodeBuilder() {
526526
public HashCodeBuilder(final int initialOddNumber, final int multiplierOddNumber) {
527527
Validate.isTrue(initialOddNumber % 2 != 0, "HashCodeBuilder requires an odd initial value");
528528
Validate.isTrue(multiplierOddNumber % 2 != 0, "HashCodeBuilder requires an odd multiplier");
529-
iConstant = multiplierOddNumber;
530-
iTotal = initialOddNumber;
529+
constant = multiplierOddNumber;
530+
total = initialOddNumber;
531531
}
532532

533533
/**
@@ -551,7 +551,7 @@ public HashCodeBuilder(final int initialOddNumber, final int multiplierOddNumber
551551
* @return {@code this} instance.
552552
*/
553553
public HashCodeBuilder append(final boolean value) {
554-
iTotal = iTotal * iConstant + (value ? 0 : 1);
554+
total = total * constant + (value ? 0 : 1);
555555
return this;
556556
}
557557

@@ -564,7 +564,7 @@ public HashCodeBuilder append(final boolean value) {
564564
*/
565565
public HashCodeBuilder append(final boolean[] array) {
566566
if (array == null) {
567-
iTotal = iTotal * iConstant;
567+
total = total * constant;
568568
} else {
569569
for (final boolean element : array) {
570570
append(element);
@@ -581,7 +581,7 @@ public HashCodeBuilder append(final boolean[] array) {
581581
* @return {@code this} instance.
582582
*/
583583
public HashCodeBuilder append(final byte value) {
584-
iTotal = iTotal * iConstant + value;
584+
total = total * constant + value;
585585
return this;
586586
}
587587

@@ -594,7 +594,7 @@ public HashCodeBuilder append(final byte value) {
594594
*/
595595
public HashCodeBuilder append(final byte[] array) {
596596
if (array == null) {
597-
iTotal = iTotal * iConstant;
597+
total = total * constant;
598598
} else {
599599
for (final byte element : array) {
600600
append(element);
@@ -611,7 +611,7 @@ public HashCodeBuilder append(final byte[] array) {
611611
* @return {@code this} instance.
612612
*/
613613
public HashCodeBuilder append(final char value) {
614-
iTotal = iTotal * iConstant + value;
614+
total = total * constant + value;
615615
return this;
616616
}
617617

@@ -624,7 +624,7 @@ public HashCodeBuilder append(final char value) {
624624
*/
625625
public HashCodeBuilder append(final char[] array) {
626626
if (array == null) {
627-
iTotal = iTotal * iConstant;
627+
total = total * constant;
628628
} else {
629629
for (final char element : array) {
630630
append(element);
@@ -653,7 +653,7 @@ public HashCodeBuilder append(final double value) {
653653
*/
654654
public HashCodeBuilder append(final double[] array) {
655655
if (array == null) {
656-
iTotal = iTotal * iConstant;
656+
total = total * constant;
657657
} else {
658658
for (final double element : array) {
659659
append(element);
@@ -670,7 +670,7 @@ public HashCodeBuilder append(final double[] array) {
670670
* @return {@code this} instance.
671671
*/
672672
public HashCodeBuilder append(final float value) {
673-
iTotal = iTotal * iConstant + Float.floatToIntBits(value);
673+
total = total * constant + Float.floatToIntBits(value);
674674
return this;
675675
}
676676

@@ -683,7 +683,7 @@ public HashCodeBuilder append(final float value) {
683683
*/
684684
public HashCodeBuilder append(final float[] array) {
685685
if (array == null) {
686-
iTotal = iTotal * iConstant;
686+
total = total * constant;
687687
} else {
688688
for (final float element : array) {
689689
append(element);
@@ -700,7 +700,7 @@ public HashCodeBuilder append(final float[] array) {
700700
* @return {@code this} instance.
701701
*/
702702
public HashCodeBuilder append(final int value) {
703-
iTotal = iTotal * iConstant + value;
703+
total = total * constant + value;
704704
return this;
705705
}
706706

@@ -713,7 +713,7 @@ public HashCodeBuilder append(final int value) {
713713
*/
714714
public HashCodeBuilder append(final int[] array) {
715715
if (array == null) {
716-
iTotal = iTotal * iConstant;
716+
total = total * constant;
717717
} else {
718718
for (final int element : array) {
719719
append(element);
@@ -734,7 +734,7 @@ public HashCodeBuilder append(final int[] array) {
734734
// some stage. There are backwards compat issues, so
735735
// that will have to wait for the time being. See LANG-342.
736736
public HashCodeBuilder append(final long value) {
737-
iTotal = iTotal * iConstant + (int) (value ^ value >> 32);
737+
total = total * constant + (int) (value ^ value >> 32);
738738
return this;
739739
}
740740

@@ -747,7 +747,7 @@ public HashCodeBuilder append(final long value) {
747747
*/
748748
public HashCodeBuilder append(final long[] array) {
749749
if (array == null) {
750-
iTotal = iTotal * iConstant;
750+
total = total * constant;
751751
} else {
752752
for (final long element : array) {
753753
append(element);
@@ -765,13 +765,13 @@ public HashCodeBuilder append(final long[] array) {
765765
*/
766766
public HashCodeBuilder append(final Object object) {
767767
if (object == null) {
768-
iTotal = iTotal * iConstant;
768+
total = total * constant;
769769
} else if (ObjectUtils.isArray(object)) {
770770
// factor out array case in order to keep method small enough
771771
// to be inlined
772772
appendArray(object);
773773
} else {
774-
iTotal = iTotal * iConstant + object.hashCode();
774+
total = total * constant + object.hashCode();
775775
}
776776
return this;
777777
}
@@ -785,7 +785,7 @@ public HashCodeBuilder append(final Object object) {
785785
*/
786786
public HashCodeBuilder append(final Object[] array) {
787787
if (array == null) {
788-
iTotal = iTotal * iConstant;
788+
total = total * constant;
789789
} else {
790790
for (final Object element : array) {
791791
append(element);
@@ -802,7 +802,7 @@ public HashCodeBuilder append(final Object[] array) {
802802
* @return {@code this} instance.
803803
*/
804804
public HashCodeBuilder append(final short value) {
805-
iTotal = iTotal * iConstant + value;
805+
total = total * constant + value;
806806
return this;
807807
}
808808

@@ -815,7 +815,7 @@ public HashCodeBuilder append(final short value) {
815815
*/
816816
public HashCodeBuilder append(final short[] array) {
817817
if (array == null) {
818-
iTotal = iTotal * iConstant;
818+
total = total * constant;
819819
} else {
820820
for (final short element : array) {
821821
append(element);
@@ -864,7 +864,7 @@ private void appendArray(final Object object) {
864864
* @since 2.0
865865
*/
866866
public HashCodeBuilder appendSuper(final int superHashCode) {
867-
iTotal = iTotal * iConstant + superHashCode;
867+
total = total * constant + superHashCode;
868868
return this;
869869
}
870870

@@ -893,7 +893,7 @@ public boolean equals(final Object obj) {
893893
return false;
894894
}
895895
final HashCodeBuilder other = (HashCodeBuilder) obj;
896-
return iTotal == other.iTotal;
896+
return total == other.total;
897897
}
898898

899899
/**
@@ -915,7 +915,7 @@ public int hashCode() {
915915
* @return {@code hashCode} based on the fields appended
916916
*/
917917
public int toHashCode() {
918-
return iTotal;
918+
return total;
919919
}
920920

921921
}

0 commit comments

Comments
 (0)