コード例 #1
0
  public void translate() {
    // TODO implement @castable

    // get classes implementing this interface
    List<ClassDef> instances = Lists.newArrayList(translator.getInterfaceInstances(interfaceDef));

    // sort instances by typeid
    Collections.sort(instances, new TypeIdComparator(translator));

    // create dispatch methods
    for (FuncDef f : interfaceDef.getMethods()) {
      translateInterfaceFuncDef(interfaceDef, instances, f);
    }
  }
コード例 #2
0
  public void translate() {
    translator.getImProg().getClasses().add(imClass);

    // set super-classes
    for (TypeExpr ext : interfaceDef.getExtendsList()) {
      if (ext.attrTypeDef() instanceof StructureDef) {
        StructureDef sup = (StructureDef) ext.attrTypeDef();
        imClass.getSuperClasses().add(translator.getClassFor(sup));
      }
    }

    // create dispatch methods
    for (FuncDef f : interfaceDef.getMethods()) {
      translateInterfaceFuncDef(f);
    }

    // add destroy method
    addDestroyMethod();
  }