Format ReadSizes before changes
This commit is contained in:
parent
ac13b1fe34
commit
f5a415bd68
1 changed files with 47 additions and 55 deletions
|
@ -1,11 +1,9 @@
|
|||
import java.io.*;
|
||||
|
||||
public class ReadSizes
|
||||
{
|
||||
public class ReadSizes {
|
||||
private static int[] tileSizes = new int[72 * 36];
|
||||
|
||||
protected static String baseNameForTile( int tileIndex )
|
||||
{
|
||||
protected static String baseNameForTile(int tileIndex) {
|
||||
int lon = (tileIndex % 72) * 5 - 180;
|
||||
int lat = (tileIndex / 72) * 5 - 90;
|
||||
String slon = lon < 0 ? "W" + (-lon) : "E" + lon;
|
||||
|
@ -13,8 +11,7 @@ public class ReadSizes
|
|||
return slon + "_" + slat;
|
||||
}
|
||||
|
||||
private static int tileForBaseName( String basename )
|
||||
{
|
||||
private static int tileForBaseName(String basename) {
|
||||
String uname = basename.toUpperCase();
|
||||
int idx = uname.indexOf("_");
|
||||
if (idx < 0) return -1;
|
||||
|
@ -30,15 +27,12 @@ public class ReadSizes
|
|||
}
|
||||
|
||||
|
||||
private static void scanExistingFiles( File dir )
|
||||
{
|
||||
private static void scanExistingFiles(File dir) {
|
||||
String[] fileNames = dir.list();
|
||||
if (fileNames == null) return;
|
||||
String suffix = ".rd5";
|
||||
for( String fileName : fileNames )
|
||||
{
|
||||
if ( fileName.endsWith( suffix ) )
|
||||
{
|
||||
for (String fileName : fileNames) {
|
||||
if (fileName.endsWith(suffix)) {
|
||||
String basename = fileName.substring(0, fileName.length() - suffix.length());
|
||||
int tidx = tileForBaseName(basename);
|
||||
tileSizes[tidx] = (int) new File(dir, fileName).length();
|
||||
|
@ -47,12 +41,10 @@ public class ReadSizes
|
|||
}
|
||||
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
public static void main(String[] args) {
|
||||
scanExistingFiles(new File(args[0]));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for( int tidx=0; tidx < tileSizes.length; tidx++ )
|
||||
{
|
||||
for (int tidx = 0; tidx < tileSizes.length; tidx++) {
|
||||
if ((tidx % 12) == 0) sb.append("\n ");
|
||||
sb.append(tileSizes[tidx]).append(',');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue