private static List<SNode> getImplementedAndExtended(
     SNode classifier, Map<SNode, SNode> typeByTypeVar) {
   Set<SNode> set = SetSequence.fromSet(new LinkedHashSet<SNode>());
   ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
       classifier, set, null, typeByTypeVar);
   List<SNode> result = new ArrayList<SNode>();
   ListSequence.fromList(result).addSequence(SetSequence.fromSet(set));
   SNode objectClass =
       SNodeOperations.getNode(
           "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Object");
   if (objectClass != null && !(SetSequence.fromSet(set).contains(objectClass))) {
     int indexOfFirstInterface = 0;
     for (SNode classifierInResult : set) {
       if (SNodeOperations.isInstanceOf(
           classifierInResult,
           MetaAdapterFactory.getConcept(
               0xf3061a5392264cc5L,
               0xa443f952ceaf5816L,
               0x101edd46144L,
               "jetbrains.mps.baseLanguage.structure.Interface"))) {
         break;
       }
       indexOfFirstInterface++;
     }
     if (indexOfFirstInterface == 0) {
       result.add(objectClass);
     } else {
       result.add(indexOfFirstInterface, objectClass);
     }
   }
   return result;
 }
 private static void collectImplementedAndExtended(
     SNode classifier,
     Set<SNode> result,
     List<SNode> typeParms,
     Map<SNode, SNode> typeByTypeVar) {
   if ((classifier == null)) {
     return;
   }
   if (SetSequence.fromSet(result).contains(classifier)) {
     return;
   }
   SetSequence.fromSet(result).addElement(classifier);
   if (typeParms != null && ListSequence.fromList(typeParms).isNotEmpty()) {
     Iterator<SNode> typeVars =
         ListSequence.fromList(
                 SLinkOperations.getChildren(
                     classifier,
                     MetaAdapterFactory.getContainmentLink(
                         0xf3061a5392264cc5L,
                         0xa443f952ceaf5816L,
                         0x102463b447aL,
                         0x102463bb98eL,
                         "typeVariableDeclaration")))
             .iterator();
     for (SNode typeParm : typeParms) {
       if (!(typeVars.hasNext())) {
         break;
       }
       SNode typeVar = typeVars.next();
       MapSequence.fromMap(typeByTypeVar).put(typeVar, typeParm);
     }
   }
   if (SNodeOperations.isInstanceOf(
       classifier,
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x1107e0cb103L,
           "jetbrains.mps.baseLanguage.structure.AnonymousClass"))) {
     SNode cls =
         SNodeOperations.cast(
             classifier,
             MetaAdapterFactory.getConcept(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x1107e0cb103L,
                 "jetbrains.mps.baseLanguage.structure.AnonymousClass"));
     ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
         SLinkOperations.getTarget(
             cls,
             MetaAdapterFactory.getReferenceLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x1107e0cb103L,
                 0x1107e0fd2a0L,
                 "classifier")),
         result,
         SLinkOperations.getChildren(
             cls,
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x1107e0cb103L,
                 0x117ac45a693L,
                 "typeParameter")),
         typeByTypeVar);
   } else if (SNodeOperations.isInstanceOf(
       classifier,
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0xf8c108ca66L,
           "jetbrains.mps.baseLanguage.structure.ClassConcept"))) {
     SNode classifierType0 =
         SLinkOperations.getTarget(
             (SNodeOperations.cast(
                 classifier,
                 MetaAdapterFactory.getConcept(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0xf8c108ca66L,
                     "jetbrains.mps.baseLanguage.structure.ClassConcept"))),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0xf8c108ca66L,
                 0x10f6353296dL,
                 "superclass"));
     if (classifierType0 != null) {
       ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
           SLinkOperations.getTarget(
               classifierType0,
               MetaAdapterFactory.getReferenceLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x101de490babL,
                   "classifier")),
           result,
           SLinkOperations.getChildren(
               classifierType0,
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x102419671abL,
                   "parameter")),
           typeByTypeVar);
     }
     for (SNode classifierType1 :
         SLinkOperations.getChildren(
             (SNodeOperations.cast(
                 classifier,
                 MetaAdapterFactory.getConcept(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0xf8c108ca66L,
                     "jetbrains.mps.baseLanguage.structure.ClassConcept"))),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0xf8c108ca66L,
                 0xff2ac0b419L,
                 "implementedInterface"))) {
       ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
           SLinkOperations.getTarget(
               classifierType1,
               MetaAdapterFactory.getReferenceLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x101de490babL,
                   "classifier")),
           result,
           SLinkOperations.getChildren(
               classifierType1,
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x102419671abL,
                   "parameter")),
           typeByTypeVar);
     }
     if (SNodeOperations.isInstanceOf(
         classifier,
         MetaAdapterFactory.getConcept(
             0xf3061a5392264cc5L,
             0xa443f952ceaf5816L,
             0xfc367070a5L,
             "jetbrains.mps.baseLanguage.structure.EnumClass"))) {
       ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
           SNodeOperations.getNode(
               "6354ebe7-c22a-4a0f-ac54-50b52ab9b065/java:java.lang(JDK/)", "~Enum"),
           result,
           null,
           typeByTypeVar);
     }
   } else if (SNodeOperations.isInstanceOf(
       classifier,
       MetaAdapterFactory.getConcept(
           0xf3061a5392264cc5L,
           0xa443f952ceaf5816L,
           0x101edd46144L,
           "jetbrains.mps.baseLanguage.structure.Interface"))) {
     for (SNode classifierType :
         SLinkOperations.getChildren(
             (SNodeOperations.cast(
                 classifier,
                 MetaAdapterFactory.getConcept(
                     0xf3061a5392264cc5L,
                     0xa443f952ceaf5816L,
                     0x101edd46144L,
                     "jetbrains.mps.baseLanguage.structure.Interface"))),
             MetaAdapterFactory.getContainmentLink(
                 0xf3061a5392264cc5L,
                 0xa443f952ceaf5816L,
                 0x101edd46144L,
                 0x101eddadad7L,
                 "extendedInterface"))) {
       ClassifierAndSuperClassifiersCache.ClassifiersDataSet.collectImplementedAndExtended(
           SLinkOperations.getTarget(
               classifierType,
               MetaAdapterFactory.getReferenceLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x101de490babL,
                   "classifier")),
           result,
           SLinkOperations.getChildren(
               classifierType,
               MetaAdapterFactory.getContainmentLink(
                   0xf3061a5392264cc5L,
                   0xa443f952ceaf5816L,
                   0x101de48bf9eL,
                   0x102419671abL,
                   "parameter")),
           typeByTypeVar);
     }
   }
 }