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(createDiff(diff));
SimpleName o1 = factory.newSimpleName("o1");
SimpleName o2 = factory.newSimpleName("o2");
SimpleName lim1 = factory.newSimpleName("lim1");
SimpleName lim2 = factory.newSimpleName("lim2");
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)).toLocalVariableDeclaration(t(int.class), lim1));
statements.add(new ExpressionBuilder(factory, v(-1)).toLocalVariableDeclaration(t(int.class), lim2));