Collections.singletonList(keyType)))),
members);
}
private MethodDeclaration createCompareBytes() {
SimpleName b1 = factory.newSimpleName("b1");
SimpleName s1 = factory.newSimpleName("s1");
SimpleName l1 = factory.newSimpleName("l1");
SimpleName b2 = factory.newSimpleName("b2");
SimpleName s2 = factory.newSimpleName("s2");
SimpleName l2 = factory.newSimpleName("l2");
List<Statement> statements = Lists.create();
SimpleName segmentId1 = factory.newSimpleName("segmentId1");
SimpleName segmentId2 = factory.newSimpleName("segmentId2");
statements.add(new TypeBuilder(factory, t(WritableComparator.class))
.method("readInt", b1, s1)
.toLocalVariableDeclaration(t(int.class), segmentId1));
statements.add(new TypeBuilder(factory, t(WritableComparator.class))
.method("readInt", b2, s2)
.toLocalVariableDeclaration(t(int.class), segmentId2));
SimpleName diff = factory.newSimpleName("diff");
statements.add(new ExpressionBuilder(factory, factory.newThis())
.method(ShuffleEmiterUtil.COMPARE_INT,
new ExpressionBuilder(factory, factory.newThis())
.method(ShuffleEmiterUtil.PORT_TO_ELEMENT, segmentId1)
.toExpression(),
new ExpressionBuilder(factory, factory.newThis())
.method(ShuffleEmiterUtil.PORT_TO_ELEMENT, segmentId2)
.toExpression())
.toLocalVariableDeclaration(t(int.class), diff));
statements.add(createDiffBranch(diff));
SimpleName o1 = factory.newSimpleName("o1");
SimpleName o2 = factory.newSimpleName("o2");
SimpleName size1 = factory.newSimpleName("size1");
SimpleName size2 = factory.newSimpleName("size2");
statements.add(new ExpressionBuilder(factory, v(4))
.toLocalVariableDeclaration(t(int.class), o1));
statements.add(new ExpressionBuilder(factory, v(4))
.toLocalVariableDeclaration(t(int.class), o2));
statements.add(new ExpressionBuilder(factory, v(-1))