Skip to content

Commit

Permalink
[Java] Tidy up after merge of PR #834.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Jan 12, 2021
1 parent 2076d25 commit b221cde
Showing 1 changed file with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,14 @@ private void generateGroupDecoderClassHeader(
.append(indent).append(" return this;\n")
.append(indent).append(" }\n");

final String numInGroupJavaTypeName = javaTypeName(numInGroupType);
final String numInGroupMinValue = generateLiteral(
numInGroupType, numInGroupToken.encoding().applicableMinValue().toString());
generatePrimitiveFieldMetaMethod(sb, indent, numInGroupJavaTypeName, "count", "Min", numInGroupMinValue);
final String numInGroupMaxValue = generateLiteral(
numInGroupType, numInGroupToken.encoding().applicableMaxValue().toString());
generatePrimitiveFieldMetaMethod(sb, indent, numInGroupJavaTypeName, "count", "Max", numInGroupMaxValue);

sb.append("\n")
.append(indent).append(" public static int sbeHeaderSize()\n")
.append(indent).append(" {\n")
Expand Down Expand Up @@ -484,20 +492,12 @@ private void generateGroupEncoderClassHeader(

final PrimitiveType numInGroupType = numInGroupToken.encoding().primitiveType();

final String javaTypeName = javaTypeName(numInGroupType);
final String minValue = generateLiteral(numInGroupType,
numInGroupToken.encoding().applicableMinValue().toString());
generatePrimitiveFieldMetaMethod(sb, ind, javaTypeName, "count", "Min", minValue);
final String maxValue = generateLiteral(numInGroupType,
numInGroupToken.encoding().applicableMaxValue().toString());
generatePrimitiveFieldMetaMethod(sb, ind, javaTypeName, "count", "Max", maxValue);

final PrimitiveType newInGroupTypeCast = PrimitiveType.UINT32 == numInGroupType ?
final PrimitiveType numInGroupTypeCast = PrimitiveType.UINT32 == numInGroupType ?
PrimitiveType.INT32 : numInGroupType;
final String numInGroupOffset = "limit + " + numInGroupToken.offset();
final String numInGroupValue = "count";
final String numInGroupPut = generatePut(
newInGroupTypeCast, numInGroupOffset, numInGroupValue, byteOrderString(numInGroupToken.encoding()));
numInGroupTypeCast, numInGroupOffset, numInGroupValue, byteOrderString(numInGroupToken.encoding()));

new Formatter(sb).format("\n" +
ind + " public void wrap(final %2$s buffer, final int count)\n" +
Expand Down Expand Up @@ -540,7 +540,7 @@ private void generateGroupEncoderClassHeader(

final String countOffset = "initialLimit + " + numInGroupToken.offset();
final String resetCountPut = generatePut(
newInGroupTypeCast, countOffset, numInGroupValue, byteOrderString(numInGroupToken.encoding()));
numInGroupTypeCast, countOffset, numInGroupValue, byteOrderString(numInGroupToken.encoding()));

sb.append("\n")
.append(ind).append(" public int resetCountToIndex()\n")
Expand All @@ -550,6 +550,14 @@ private void generateGroupEncoderClassHeader(
.append(ind).append(" return count;\n")
.append(ind).append(" }\n");

final String numInGroupJavaTypeName = javaTypeName(numInGroupType);
final String numInGroupMinValue = generateLiteral(
numInGroupType, numInGroupToken.encoding().applicableMinValue().toString());
generatePrimitiveFieldMetaMethod(sb, ind, numInGroupJavaTypeName, "count", "Min", numInGroupMinValue);
final String numInGroupMaxValue = generateLiteral(
numInGroupType, numInGroupToken.encoding().applicableMaxValue().toString());
generatePrimitiveFieldMetaMethod(sb, ind, numInGroupJavaTypeName, "count", "Max", numInGroupMaxValue);

sb.append("\n")
.append(ind).append(" public static int sbeHeaderSize()\n")
.append(ind).append(" {\n")
Expand Down

0 comments on commit b221cde

Please sign in to comment.