system/src/sc/layer/ReverseDependencies.java
public void cleanStaleEntries(HashSet<String> changedTypes) {
      HashMap<Integer,Boolean> tocull = new HashMap<Integer,Boolean>();
      for (String typeName:typeRegistry.keySet()) {
         if (changedState == null)
            changedState = new HashMap<String, Boolean>();
         if (changedTypes.contains(typeName) && changedState.get(typeName) == null)
            tocull.put(typeRegistry.get(typeName), Boolean.TRUE);
      }
      if (bindableDeps != null) {
         for (Iterator<Map.Entry<String,PropertyDep[]>> it = bindableDeps.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<String,PropertyDep[]> ent = it.next();
            PropertyDep[] pdeps = ent.getValue();
            int toRemove = 0;
            for (int k = 0; k < pdeps.length; k++) {
               if (tocull.get(pdeps[k].typeIndex) != null)
                  toRemove++;
            }
            if (toRemove > 0) {
               if (pdeps.length == toRemove)
                  it.remove();
               else {
                  PropertyDep[] newValues = new PropertyDep[pdeps.length - toRemove];
                  int j = 0;
                  for (int k = 0; k < pdeps.length; k++) {
                     if (tocull.get(pdeps[k].typeIndex) == null)
                        newValues[j++] = pdeps[k];
                  }
                  ent.setValue(newValues);
               }
            }
         }
      }
      if (dynMethods != null) {
         for (Iterator<Map.Entry<MethodKey,int[]>> it = dynMethods.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<MethodKey,int[]> ent = it.next();
            int[] values = ent.getValue();
            int toRemove = 0;
            for (int k = 0; k < values.length; k++) {
               if (tocull.get(values[k]) != null)
                  toRemove++;
            }
            if (toRemove > 0) {
               if (values.length == toRemove)
                  it.remove();
               else {
                  int[] newValues = new int[values.length - toRemove];
                  int j = 0;
                  for (int k = 0; k < values.length; k++) {
                     if (tocull.get(values[k]) == null)
                        newValues[j++] = values[k];
                  }
                  ent.setValue(newValues);
               }
            }
         }
      }
   }
/**
    * This removes any dependencies from types in our registry which were changed but did not add a new entry.
    * TODO: does this handle the case where we remove a file and do an incremental build?
    */
This removes any dependencies from types in our registry which were changed but did not add a new entry.
This removes any dependencies from types in our registry which were changed but did not add a new entry .
public void cleanStaleEntries(HashSet<String> changedTypes) {
      HashMap<Integer,Boolean> tocull = new HashMap<Integer,Boolean>();
      for (String typeName:typeRegistry.keySet()) {
         if (changedState == null)
            changedState = new HashMap<String, Boolean>();
         if (changedTypes.contains(typeName) && changedState.get(typeName) == null)
            tocull.put(typeRegistry.get(typeName), Boolean.TRUE);
      }
      if (bindableDeps != null) {
         for (Iterator<Map.Entry<String,PropertyDep[]>> it = bindableDeps.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<String,PropertyDep[]> ent = it.next();
            PropertyDep[] pdeps = ent.getValue();
            int toRemove = 0;
            for (int k = 0; k < pdeps.length; k++) {
               if (tocull.get(pdeps[k].typeIndex) != null)
                  toRemove++;
            }
            if (toRemove > 0) {
               if (pdeps.length == toRemove)
                  it.remove();
               else {
                  PropertyDep[] newValues = new PropertyDep[pdeps.length - toRemove];
                  int j = 0;
                  for (int k = 0; k < pdeps.length; k++) {
                     if (tocull.get(pdeps[k].typeIndex) == null)
                        newValues[j++] = pdeps[k];
                  }
                  ent.setValue(newValues);
               }
            }
         }
      }
      if (dynMethods != null) {
         for (Iterator<Map.Entry<MethodKey,int[]>> it = dynMethods.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry<MethodKey,int[]> ent = it.next();
            int[] values = ent.getValue();
            int toRemove = 0;
            for (int k = 0; k < values.length; k++) {
               if (tocull.get(values[k]) != null)
                  toRemove++;
            }
            if (toRemove > 0) {
               if (values.length == toRemove)
                  it.remove();
               else {
                  int[] newValues = new int[values.length - toRemove];
                  int j = 0;
                  for (int k = 0; k < values.length; k++) {
                     if (tocull.get(values[k]) == null)
                        newValues[j++] = values[k];
                  }
                  ent.setValue(newValues);
               }
            }
         }
      }
   }
public void cleanStaleEntries ( HashSet < String > changedTypes ) { HashMap < Integer , Boolean > tocull = new HashMap < Integer , Boolean > ( ) ; for ( String typeName : typeRegistry . keySet ( ) ) { if ( changedState == null ) changedState = new HashMap < String , Boolean > ( ) ; if ( changedTypes . contains ( typeName ) && changedState . get ( typeName ) == null ) tocull . put ( typeRegistry . get ( typeName ) , Boolean . TRUE ) ; } if ( bindableDeps != null ) { for ( Iterator < Map . Entry < String , PropertyDep [ ] > > it = bindableDeps . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry < String , PropertyDep [ ] > ent = it . next ( ) ; PropertyDep [ ] pdeps = ent . getValue ( ) ; int toRemove = 0 ; for ( int k = 0 ; k < pdeps . length ; k ++ ) { if ( tocull . get ( pdeps [ k ] . typeIndex ) != null ) toRemove ++ ; } if ( toRemove > 0 ) { if ( pdeps . length == toRemove ) it . remove ( ) ; else { PropertyDep [ ] newValues = new PropertyDep [ pdeps . length - toRemove ] ; int j = 0 ; for ( int k = 0 ; k < pdeps . length ; k ++ ) { if ( tocull . get ( pdeps [ k ] . typeIndex ) == null ) newValues [ j ++ ] = pdeps [ k ] ; } ent . setValue ( newValues ) ; } } } } if ( dynMethods != null ) { for ( Iterator < Map . Entry < MethodKey , int [ ] > > it = dynMethods . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry < MethodKey , int [ ] > ent = it . next ( ) ; int [ ] values = ent . getValue ( ) ; int toRemove = 0 ; for ( int k = 0 ; k < values . length ; k ++ ) { if ( tocull . get ( values [ k ] ) != null ) toRemove ++ ; } if ( toRemove > 0 ) { if ( values . length == toRemove ) it . remove ( ) ; else { int [ ] newValues = new int [ values . length - toRemove ] ; int j = 0 ; for ( int k = 0 ; k < values . length ; k ++ ) { if ( tocull . get ( values [ k ] ) == null ) newValues [ j ++ ] = values [ k ] ; } ent . setValue ( newValues ) ; } } } } }
This removes any dependencies from types in our registry which were changed but did not add a new entry.
This removes any dependencies from types in our registry which were changed but did not add a new entry .