public List<String> _getParentsNames(final String conceptFqName) { synchronized (myParentsNamesLock) { List<String> result = myParentsNamesMap.get(conceptFqName); if (result == null) { result = NodeReadAccessCasterInEditor.runReadTransparentAction( new Computable<List<String>>() { @Override public List<String> compute() { SNode declaration = SModelUtil.findConceptDeclaration(conceptFqName, GlobalScope.getInstance()); if (declaration == null) { return Collections.emptyList(); } List<String> result = new ArrayList<String>(); Set<String> parentsSet = new HashSet<String>(); if (SNodeUtil.isInstanceOfConceptDeclaration(declaration)) { SNode superConcept = SNodeUtil.getConceptDeclaration_Extends(declaration); if (superConcept != null) { String name = NameUtil.nodeFQName(superConcept); if (parentsSet.add(name)) { result.add(name); } } else if (!SNodeUtil.concept_BaseConcept.equals( NameUtil.nodeFQName(declaration))) { if (parentsSet.add(SNodeUtil.concept_BaseConcept)) { result.add(SNodeUtil.concept_BaseConcept); } } for (SNode interfaceConcept : SNodeUtil.getConceptDeclaration_Implements(declaration)) { String name = NameUtil.nodeFQName(interfaceConcept); if (parentsSet.add(name)) { result.add(name); } } } else if (SNodeUtil.isInstanceOfInterfaceConceptDeclaration(declaration)) { for (SNode interfaceConcept : SNodeUtil.getInterfaceConceptDeclaration_Extends(declaration)) { String name = NameUtil.nodeFQName(interfaceConcept); if (parentsSet.add(name)) { result.add(name); } } } return result; } }); myParentsNamesMap.put( InternUtil.intern(conceptFqName), Collections.unmodifiableList(result)); } return result; } }
private Set<String> getAncestorsNames_internal(final String conceptFqName) { InternAwareStringSet result = myAncestorsNamesMap.get(conceptFqName); if (result != null) return result; InternAwareStringSet set = NodeReadAccessCasterInEditor.runReadTransparentAction( new Computable<InternAwareStringSet>() { @Override public InternAwareStringSet compute() { InternAwareStringSet res = new InternAwareStringSet(); collectAncestorNames(conceptFqName, res); return res; } }); result = myAncestorsNamesMap.putIfAbsent(InternUtil.intern(conceptFqName), set); return result != null ? result : set; }
@NotNull protected Class<?> getClass(String classFqName, boolean ownClassOnly) throws ClassNotFoundException, ModuleClassNotFoundException, ModuleIsNotLoadableException { ClassLoader classLoader = getClassLoader(); if (classLoader == null) { throw new ModuleClassLoaderIsNullException(this); } String internClassName = InternUtil.intern(classFqName); if (ownClassOnly && classLoader instanceof ModuleClassLoader) { return ((ModuleClassLoader) classLoader).loadOwnClass(internClassName); } Class<?> aClass = classLoader.loadClass(internClassName); if (aClass == null) { throw new LoadedClassIsNullException(classLoader, internClassName); } return aClass; }
@Override protected SNode createObject(Attributes attrs) { return new jetbrains.mps.smodel.SNode( InternUtil.intern(fieldhelper.readType(attrs.getValue("type")))); }