system/src/sc/lang/java/JavaModel.java
public boolean findMatchingGlobalNames(String prefix, String prefixPkgName, String prefixBaseName, Set<String> candidates, boolean annotTypes, int max) {
      initTypeInfo();

      if (layeredSystem != null) {
         if (!layeredSystem.addGlobalImports(isLayerModel, prefixPkgName, prefixBaseName, candidates, max))
            return false;
      }
      for (String ent:importsByName.keySet()) {
         if (ent.startsWith(prefix)) {
            candidates.add(ent);
            if (candidates.size() >= max)
               return false;
         }
      }
      if (staticImportMethods != null) {
         for (String ent:staticImportMethods.keySet()) {
            if (ent.startsWith(prefix)) {
               List<Object> methTypes = staticImportMethods.get(ent);
               if (methTypes != null) {
                  for (Object methType:methTypes) {
                     String methTypeName = ModelUtil.getTypeName(methType);
                     if (prefixPkgName == null || methTypeName.equals(prefixPkgName)) {
                        candidates.add(ent + "()"); // TODO: look up the methods here and use getParameterString so we describe them properly in the IDE
                        if (candidates.size() >= max)
                           return false;
                        break;
                     }
                  }
               }
            }
         }
      }
      if (staticImportProperties != null) {
         for (String ent:staticImportProperties.keySet()) {
            Object propObj = staticImportProperties.get(ent);
            if (ent.startsWith(prefixBaseName) && (prefixPkgName == null || StringUtil.equalStrings(prefixPkgName, ModelUtil.getTypeName(ModelUtil.getEnclosingType(propObj))))) {
               candidates.add(ent);
               if (candidates.size() >= max)
                  return false;
            }
         }
      }
      JavaModel modModel = getModifiedModel();
      if (modModel != null) {
         if (!modModel.findMatchingGlobalNames(prefix, prefixPkgName, prefixBaseName, candidates, annotTypes, max))
            return false;
      }
      if (layeredSystem != null && layer != null) {
         if (!layeredSystem.findMatchingGlobalNames(null, layer, prefix, prefixPkgName, prefixBaseName, candidates, false, false, annotTypes, max))
            return false;
      }
      return true;
   }
// TODO: should we use Pattern matching to make this more flexible?  Or an index to make it faster?
should we use Pattern matching to make this more flexible.
should we use Pattern matching to make this more flexible .
public boolean findMatchingGlobalNames(String prefix, String prefixPkgName, String prefixBaseName, Set<String> candidates, boolean annotTypes, int max) {
      initTypeInfo();
      if (layeredSystem != null) {
         if (!layeredSystem.addGlobalImports(isLayerModel, prefixPkgName, prefixBaseName, candidates, max))
            return false;
      }
      for (String ent:importsByName.keySet()) {
         if (ent.startsWith(prefix)) {
            candidates.add(ent);
            if (candidates.size() >= max)
               return false;
         }
      }
      if (staticImportMethods != null) {
         for (String ent:staticImportMethods.keySet()) {
            if (ent.startsWith(prefix)) {
               List<Object> methTypes = staticImportMethods.get(ent);
               if (methTypes != null) {
                  for (Object methType:methTypes) {
                     String methTypeName = ModelUtil.getTypeName(methType);
                     if (prefixPkgName == null || methTypeName.equals(prefixPkgName)) {
                        candidates.add(ent + "()"); 
                        if (candidates.size() >= max)
                           return false;
                        break;
                     }
                  }
               }
            }
         }
      }
      if (staticImportProperties != null) {
         for (String ent:staticImportProperties.keySet()) {
            Object propObj = staticImportProperties.get(ent);
            if (ent.startsWith(prefixBaseName) && (prefixPkgName == null || StringUtil.equalStrings(prefixPkgName, ModelUtil.getTypeName(ModelUtil.getEnclosingType(propObj))))) {
               candidates.add(ent);
               if (candidates.size() >= max)
                  return false;
            }
         }
      }
      JavaModel modModel = getModifiedModel();
      if (modModel != null) {
         if (!modModel.findMatchingGlobalNames(prefix, prefixPkgName, prefixBaseName, candidates, annotTypes, max))
            return false;
      }
      if (layeredSystem != null && layer != null) {
         if (!layeredSystem.findMatchingGlobalNames(null, layer, prefix, prefixPkgName, prefixBaseName, candidates, false, false, annotTypes, max))
            return false;
      }
      return true;
   }
public boolean findMatchingGlobalNames ( String prefix , String prefixPkgName , String prefixBaseName , Set < String > candidates , boolean annotTypes , int max ) { initTypeInfo ( ) ; if ( layeredSystem != null ) { if ( ! layeredSystem . addGlobalImports ( isLayerModel , prefixPkgName , prefixBaseName , candidates , max ) ) return false ; } for ( String ent : importsByName . keySet ( ) ) { if ( ent . startsWith ( prefix ) ) { candidates . add ( ent ) ; if ( candidates . size ( ) >= max ) return false ; } } if ( staticImportMethods != null ) { for ( String ent : staticImportMethods . keySet ( ) ) { if ( ent . startsWith ( prefix ) ) { List < Object > methTypes = staticImportMethods . get ( ent ) ; if ( methTypes != null ) { for ( Object methType : methTypes ) { String methTypeName = ModelUtil . getTypeName ( methType ) ; if ( prefixPkgName == null || methTypeName . equals ( prefixPkgName ) ) { candidates . add ( ent + "()" ) ; if ( candidates . size ( ) >= max ) return false ; break ; } } } } } } if ( staticImportProperties != null ) { for ( String ent : staticImportProperties . keySet ( ) ) { Object propObj = staticImportProperties . get ( ent ) ; if ( ent . startsWith ( prefixBaseName ) && ( prefixPkgName == null || StringUtil . equalStrings ( prefixPkgName , ModelUtil . getTypeName ( ModelUtil . getEnclosingType ( propObj ) ) ) ) ) { candidates . add ( ent ) ; if ( candidates . size ( ) >= max ) return false ; } } } JavaModel modModel = getModifiedModel ( ) ; if ( modModel != null ) { if ( ! modModel . findMatchingGlobalNames ( prefix , prefixPkgName , prefixBaseName , candidates , annotTypes , max ) ) return false ; } if ( layeredSystem != null && layer != null ) { if ( ! layeredSystem . findMatchingGlobalNames ( null , layer , prefix , prefixPkgName , prefixBaseName , candidates , false , false , annotTypes , max ) ) return false ; } return true ; }
TODO: should we use Pattern matching to make this more flexible?
TODO : should we use Pattern matching to make this more flexible?
// TODO: look up the methods here and use getParameterString so we describe them properly in the IDE