public void denormalize(int minLevel,int levelMod,ArrayList<S2CellId> output){
  output.clear();
  output.ensureCapacity(size());
  for (  S2CellId id : this) {
    int level=id.level();
    int newLevel=Math.max(minLevel,level);
    if (levelMod > 1) {
      newLevel+=(S2CellId.MAX_LEVEL - (newLevel - minLevel)) % levelMod;
      newLevel=Math.min(S2CellId.MAX_LEVEL,newLevel);
    }
    if (newLevel == level) {
      output.add(id);
    }
 else {
      S2CellId end=id.childEnd(newLevel);
      for (id=id.childBegin(newLevel); !id.equals(end); id=id.next()) {
        output.add(id);
      }
    }
  }
}

public void denormalize ( int minLevel , int levelMod , ArrayList < S2CellId > output ) { output . clear ( ) ; output . ensureCapacity ( size ( ) ) ; for ( S2CellId id : this ) { int level = id . level ( ) ; int newLevel = Math . max ( minLevel , level ) ; if ( levelMod > 1 ) { newLevel += ( S2CellId . MAX_LEVEL - ( newLevel - minLevel ) ) % levelMod ; newLevel = Math . min ( S2CellId . MAX_LEVEL , newLevel ) ; } if ( newLevel == level ) { output . add ( id ) ; } else { S2CellId end = id . childEnd ( newLevel ) ; for ( id = id . childBegin ( newLevel ) ; ! id . equals ( end ) ; id = id . next ( ) ) { output . add ( id ) ; } } } }
replaces " output " with an expanded version of the cell union where any cells whose level is less than " min_level " or where ( level - min_level ) is not a multiple of " level_mod " are replaced by their children , until either both of these conditions are satisfied or the maximum level is reached . this method allows a covering generated by s2regioncoverer using min_level ( ) or level_mod ( ) constraints to be stored as a normalized cell union ( which allows various geometric computations to be done ) and then converted back to the original list of cell ids that satisfies the desired constraints .
