Exemplo n.º 1
0
  public List<Function> getFunctionByName(String funName) {
    List<Function> funList = new ArrayList<Function>();

    for (RPackage aPackage : getInstance().getPackages()) {
      Function function = aPackage.getFunction(funName);

      if (function != null) {
        funList.add(function);
      }
    }

    return funList;
  }
Exemplo n.º 2
0
  public static List<Function> getFunctionByName(
      String funName, @Nullable Collection<RPackage> importedPackages) {

    RPackageService packageService = RPackageService.getInstance();

    if (packageService == null) return Collections.emptyList();

    // if the user didn't import anything do a global search todo: does this make sense???
    if (importedPackages == null) {
      importedPackages = packageService.getPackages();
    } else {
      importedPackages = addImportDependencies(importedPackages);
    }

    List<Function> funs = new ArrayList<Function>();
    for (RPackage importedPackage : importedPackages) {
      if (importedPackage.hasFunction(funName)) funs.add(importedPackage.getFunction(funName));
    }

    return funs;
  }