system/src/sc/layer/LayeredSystem.java
public void addAutoImport(Layer srcLayer, String typeName, ImportDeclaration importDecl) {
      TypeDeclarationCacheEntry decls = typesByName.get(typeName);

      if (decls == null) {
         decls = new TypeDeclarationCacheEntry(1);
         typesByName.put(typeName, decls);
      }

      String baseTypeName = CTypeUtil.getClassName(importDecl.identifier);
      if (baseTypeName == null) {
         System.err.println("*** Invalid import name: " + typeName);
         return;
      }

      AutoImportEntry aie = decls.autoImportsIndex == null ? null : decls.autoImportsIndex.get(baseTypeName);
      if (aie == null || srcLayer == null || srcLayer.getLayerPosition() > aie.layerPosition) {
         if (aie != null) {
            decls.autoImports.remove(aie.importDecl);
         }
         else {
            aie = new AutoImportEntry();
            if (decls.autoImportsIndex == null)
               decls.autoImportsIndex = new TreeMap<String,AutoImportEntry>();
            decls.autoImportsIndex.put(baseTypeName, aie);
         }
         aie.importDecl = importDecl;
         aie.layerPosition = srcLayer == null ? layers.size()-1 : srcLayer.layerPosition;
         if (decls.autoImports == null)
            decls.autoImports = new SemanticNodeList<ImportDeclaration>();
         decls.autoImports.add(importDecl);
      }
   }
/**
    * The autoImports are created each time we reference a type that is not explicitly imported during the
    * start process on the original model.  Because of the lazy way in which models get loaded and resolved
    * I don't think we can rely on imports being added in the right order.  And yet, it will be important that
    * a later layer be able to override the import in a previous layer.
    */
The autoImports are created each time we reference a type that is not explicitly imported during the
start process on the original model.  Because of the lazy way in which models get loaded and resolved
I don't think we can rely on imports being added in the right order.  And yet, it will be important that
a later layer be able to override the import in a previous layer.
The autoImports are created each time we reference a type that is not explicitly imported during the start process on the original model . Because of the lazy way in which models get loaded and resolved I don ' t think we can rely on imports being added in the right order . And yet it will be important that a later layer be able to override the import in a previous layer .
public void addAutoImport(Layer srcLayer, String typeName, ImportDeclaration importDecl) {
      TypeDeclarationCacheEntry decls = typesByName.get(typeName);
      if (decls == null) {
         decls = new TypeDeclarationCacheEntry(1);
         typesByName.put(typeName, decls);
      }
      String baseTypeName = CTypeUtil.getClassName(importDecl.identifier);
      if (baseTypeName == null) {
         System.err.println("*** Invalid import name: " + typeName);
         return;
      }
      AutoImportEntry aie = decls.autoImportsIndex == null ? null : decls.autoImportsIndex.get(baseTypeName);
      if (aie == null || srcLayer == null || srcLayer.getLayerPosition() > aie.layerPosition) {
         if (aie != null) {
            decls.autoImports.remove(aie.importDecl);
         }
         else {
            aie = new AutoImportEntry();
            if (decls.autoImportsIndex == null)
               decls.autoImportsIndex = new TreeMap<String,AutoImportEntry>();
            decls.autoImportsIndex.put(baseTypeName, aie);
         }
         aie.importDecl = importDecl;
         aie.layerPosition = srcLayer == null ? layers.size()-1 : srcLayer.layerPosition;
         if (decls.autoImports == null)
            decls.autoImports = new SemanticNodeList<ImportDeclaration>();
         decls.autoImports.add(importDecl);
      }
   }
public void addAutoImport ( Layer srcLayer , String typeName , ImportDeclaration importDecl ) { TypeDeclarationCacheEntry decls = typesByName . get ( typeName ) ; if ( decls == null ) { decls = new TypeDeclarationCacheEntry ( 1 ) ; typesByName . put ( typeName , decls ) ; } String baseTypeName = CTypeUtil . getClassName ( importDecl . identifier ) ; if ( baseTypeName == null ) { System . err . println ( "*** Invalid import name: " + typeName ) ; return ; } AutoImportEntry aie = decls . autoImportsIndex == null ? null : decls . autoImportsIndex . get ( baseTypeName ) ; if ( aie == null || srcLayer == null || srcLayer . getLayerPosition ( ) > aie . layerPosition ) { if ( aie != null ) { decls . autoImports . remove ( aie . importDecl ) ; } else { aie = new AutoImportEntry ( ) ; if ( decls . autoImportsIndex == null ) decls . autoImportsIndex = new TreeMap < String , AutoImportEntry > ( ) ; decls . autoImportsIndex . put ( baseTypeName , aie ) ; } aie . importDecl = importDecl ; aie . layerPosition = srcLayer == null ? layers . size ( ) - 1 : srcLayer . layerPosition ; if ( decls . autoImports == null ) decls . autoImports = new SemanticNodeList < ImportDeclaration > ( ) ; decls . autoImports . add ( importDecl ) ; } }
The autoImports are created each time we reference a type that is not explicitly imported during the
 start process on the original model.
The autoImports are created each time we reference a type that is not explicitly imported during the start process on the original model .