Example #1
0
 private TypeDeclaration createType() {
   SimpleName name = factory.newSimpleName(Naming.getCombineClass());
   importer.resolvePackageMember(name);
   List<TypeBodyDeclaration> members = new ArrayList<TypeBodyDeclaration>();
   members.addAll(prepareFields());
   members.add(createSetup());
   members.add(createCleanup());
   members.add(createGetRendezvous());
   return factory.newClassDeclaration(
       new JavadocBuilder(factory)
           .text("ステージ{0}の処理を担当するコンバイナープログラム。", shuffle.getStageBlock().getStageNumber())
           .toJavadoc(),
       new AttributeBuilder(factory)
           .annotation(t(SuppressWarnings.class), v("deprecation"))
           .Public()
           .Final()
           .toAttributes(),
       name,
       Collections.<TypeParameterDeclaration>emptyList(),
       importer.resolve(
           factory.newParameterizedType(
               Models.toType(factory, SegmentedCombiner.class),
               Arrays.asList(
                   importer.toType(shuffle.getCompiled().getKeyTypeName()),
                   importer.toType(shuffle.getCompiled().getValueTypeName())))),
       Collections.<Type>emptyList(),
       members);
 }
 private void emit() throws IOException {
   ClassDeclaration decl =
       f.newClassDeclaration(
           new JavadocBuilder(f)
               .text("TSVファイルなどのレコードを表すファイルを入力として<code>{0}</code>を読み出す", model.getName())
               .toJavadoc(),
           new AttributeBuilder(f).Public().Final().toAttributes(),
           context.getTypeName(),
           Collections.<TypeParameterDeclaration>emptyList(),
           null,
           Collections.singletonList(
               f.newParameterizedType(
                   context.resolve(ModelInput.class), context.resolve(model.getSymbol()))),
           createMembers());
   context.emit(decl);
 }
 private TypeDeclaration createType() {
   SimpleName name = factory.newSimpleName(Naming.getShuffleValueClass());
   importer.resolvePackageMember(name);
   List<TypeBodyDeclaration> members = new ArrayList<TypeBodyDeclaration>();
   members.addAll(createSegmentDistinction());
   members.addAll(createProperties());
   members.addAll(createAccessors());
   members.addAll(createWritables());
   return factory.newClassDeclaration(
       createJavadoc(),
       new AttributeBuilder(factory)
           .annotation(t(SuppressWarnings.class), v("deprecation"))
           .Public()
           .Final()
           .toAttributes(),
       name,
       Collections.<TypeParameterDeclaration>emptyList(),
       null,
       Collections.singletonList(t(SegmentedWritable.class)),
       members);
 }
 private TypeDeclaration createType() {
   SimpleName name = factory.newSimpleName(Naming.getShuffleGroupingComparatorClass());
   importer.resolvePackageMember(name);
   List<TypeBodyDeclaration> members = new ArrayList<TypeBodyDeclaration>();
   members.add(createCompareBytes());
   members.add(createCompareObjects());
   members.add(ShuffleEmiterUtil.createCompareInts(factory));
   members.add(ShuffleEmiterUtil.createPortToElement(factory, model));
   return factory.newClassDeclaration(
       createJavadoc(),
       new AttributeBuilder(factory)
           .annotation(t(SuppressWarnings.class), v("rawtypes"))
           .Public()
           .toAttributes(),
       name,
       Collections.<TypeParameterDeclaration>emptyList(),
       null,
       Collections.singletonList(
           importer.resolve(
               factory.newParameterizedType(
                   t(RawComparator.class), Collections.singletonList(keyType)))),
       members);
 }