@Override public boolean isInline() { return wrapped.isInline(); }
@Override public Collection<CsmNamespace> getInlinedNamespaces() { if (hasInlined()) { List<CsmNamespace> result = new ArrayList<>(inlineNamespacesCounter.get()); for (CsmNamespace nested : getNestedNamespaces()) { if (nested.isInline()) { result.add(nested); } } return Collections.unmodifiableCollection(result); } return Collections.emptyList(); }
/** * Finds all namespaces visible in given namespace (unnamed, inlined or through "using" directives). * * @param namespace namespace of interest * @return unmodifiable collection of namespaces visible in given namespace though "using" directives */ @Override public Collection<CsmNamespace> findVisibleNamespaces(CsmNamespace namespace, CsmProject startPrj) { List<CsmNamespace> res = new ArrayList<>(); if (!namespace.isGlobal()) { for (CsmNamespace ns : namespace.getNestedNamespaces()) { if (ns.getName().length() == 0 || ns.isInline()) { res.add(ns); } } } res.addAll(extractNamespaces(findUsingDirectives(namespace), startPrj)); return res; }
private Map<CharSequence, CsmNamespace> getNestedNamespaces(CsmNamespace ns, String strPrefix, boolean match, Set<CsmNamespace> handledNS) { Map<CharSequence, CsmNamespace> res = new LinkedHashMap<CharSequence, CsmNamespace>(); // order is important if(ns != null) { handledNS.add(ns); CsmProject nsProject = ns.getProject(); if(nsProject != null) { // handle all nested namespaces for (CsmProject lib : nsProject.getLibraries()) { CsmNamespace n = lib.findNamespace(ns.getQualifiedName()); if (n != null && !handledNS.contains(n)) { res.putAll(getNestedNamespaces(n, strPrefix, match, handledNS)); } } for (Iterator it = ns.getNestedNamespaces().iterator(); it.hasNext();) { CsmNamespace nestedNs = (CsmNamespace) it.next(); // TODO: consider when we add nested namespaces if ((nestedNs.getName().length() != 0) && matchName(nestedNs.getName(), strPrefix, match)) { res.put(nestedNs.getQualifiedName(), nestedNs); // TODO: Think if we really need nested namespaces here if (nestedNs.isInline()) { res.putAll(getNestedNamespaces(nestedNs, strPrefix, match, handledNS)); } } } } } return res; }
CsmNamespace nestedNs = (CsmNamespace) it.next(); boolean goDeeper = (searchNestedUnnamedNamespaces && nestedNs.getName().length() == 0) || nestedNs.isInline();
CsmNamespaceDefinition nsd = (CsmNamespaceDefinition) decl; boolean fillFromNamespace = (needDeclFromUnnamedNS && (nsd.getName().length() == 0)) || nsd.getNamespace().isInline(); if (fillFromNamespace) {
CsmNamespaceDefinition nsd = (CsmNamespaceDefinition) decl; boolean fillFromNamespace = (needDeclFromUnnamedNS && (nsd.getName().length() == 0)) || nsd.getNamespace().isInline(); if (fillFromNamespace) {
CsmNamespaceDefinition nsd = (CsmNamespaceDefinition) decl; boolean fillFromNamespace = (needDeclFromUnnamedNS && (nsd.getName().length() == 0)) || nsd.getNamespace().isInline(); if (fillFromNamespace) {