/** * Get list of all imports from all grammars in the delegate subtree of g. The grammars are in * import tree preorder. Don't include ourselves in list as we're not a delegate of ourselves. */ public List<Grammar> getAllImportedGrammars() { if (importedGrammars == null) return null; List<Grammar> delegates = new ArrayList<Grammar>(); for (Grammar d : importedGrammars) { delegates.add(d); List<Grammar> ds = d.getAllImportedGrammars(); if (ds != null) delegates.addAll(ds); } return delegates; }
/** * Get list of all imports from all grammars in the delegate subtree of g. The grammars are in * import tree preorder. Don't include ourselves in list as we're not a delegate of ourselves. */ public List<Grammar> getAllImportedGrammars() { if (importedGrammars == null) return null; List<Grammar> delegates = new ArrayList<Grammar>(); for (int i = 0; i < importedGrammars.size(); i++) { Grammar d = importedGrammars.get(i); delegates.add(d); List<Grammar> ds = d.getAllImportedGrammars(); if (ds != null) delegates.addAll(ds); } return delegates; }
/** * Get list of all imports from all grammars in the delegate subtree of g. The grammars are in * import tree preorder. Don't include ourselves in list as we're not a delegate of ourselves. */ public List<Grammar> getAllImportedGrammars() { if (importedGrammars == null) { return null; } LinkedHashMap<String, Grammar> delegates = new LinkedHashMap<String, Grammar>(); for (Grammar d : importedGrammars) { delegates.put(d.fileName, d); List<Grammar> ds = d.getAllImportedGrammars(); if (ds != null) { for (Grammar imported : ds) { delegates.put(imported.fileName, imported); } } } return new ArrayList<Grammar>(delegates.values()); }