Skip to content

Commit

Permalink
## Description of Changes
Browse files Browse the repository at this point in the history
In accord with this [comment](#1152 (review)), this PR converts all occurrences of
````
"static public" to "public static"
and
"static protected" to "protected static"
````
There are a couple of spotLess changes as well.

Warning: It turn out there are a lot of occurrences
of "static public", so this PR touches a lot of files.

The changes were made by two commands:
````
1. find . -name '*.java' -exec grep '^[\t ]*static[ ][ ]*public' '{}' \;
2. sed -i.bak2 -e 's|^\([\t ]*\)static[ ][ ]*protected|\1protected static|' <file>
````
Command 1 located all .java files containing "static public".
Command 2 was applied to the files located by command 1; it converts "static public" to "public static".
Similar commands were applied for "static protected".

## PR Checklist
<!-- This will become an interactive checklist once the PR is opened -->
- [X] Link to any issues that the PR addresses
- [X] Add labels
- [X] Open as a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/)
       until ready for review
- [X] Make sure GitHub tests pass
- [ ] Mark PR as "Ready for Review"
  • Loading branch information
DennisHeimbigner committed Jun 8, 2023
1 parent a512a86 commit 6d334cf
Show file tree
Hide file tree
Showing 95 changed files with 335 additions and 335 deletions.
12 changes: 6 additions & 6 deletions bufr/src/test/java/ucar/nc2/iosp/bufr/tables/CodeTableGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private boolean readOneCode(boolean first) throws IOException {

// try to pretty print the WORD xml

static public void prettyPrint() throws IOException {
public static void prettyPrint() throws IOException {
org.jdom2.Document doc;
try {
SAXBuilder builder = new SAXBuilder();
Expand All @@ -121,7 +121,7 @@ static public void prettyPrint() throws IOException {

///////////////////////////////////////////////////////////////////////

static public void transform(Element elem, Element telem) {
public static void transform(Element elem, Element telem) {
String name = elem.getName();

if (name.equals("sub-section") || name.equals("tc")) {
Expand Down Expand Up @@ -166,7 +166,7 @@ static boolean hasAncestor(Element e, String name) {
// tranform the WORD xml into something more pareseable
// unfortunately, we then have to hand-edit the result
// next time, probably beter to start with the NCEP HTML pages
static public void passOne() throws IOException {
public static void passOne() throws IOException {
org.jdom2.Document orgDoc;
try {
SAXBuilder builder = new SAXBuilder();
Expand Down Expand Up @@ -248,7 +248,7 @@ else if (kinds.startsWith("bit"))


// pass 2 - transform the hand-edited XML to its final form
static public void passTwo() throws IOException {
public static void passTwo() throws IOException {
org.jdom2.Document tdoc;
try {
SAXBuilder builder = new SAXBuilder();
Expand Down Expand Up @@ -334,7 +334,7 @@ static int parseAll(String text) {
}

// pass 3 - look for problems
static public void passThree() throws IOException {
public static void passThree() throws IOException {
org.jdom2.Document tdoc;
try {
SAXBuilder builder = new SAXBuilder();
Expand Down Expand Up @@ -367,7 +367,7 @@ static public void passThree() throws IOException {
static Formatter f = new Formatter(System.out);


static public void main(String args[]) throws IOException {
public static void main(String args[]) throws IOException {
// passTwo();
passThree();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ boolean equiv(String org1, String org2) {
}


static public void main(String args[]) throws IOException {
public static void main(String args[]) throws IOException {
Map<Integer, Feature> wmoMap = new TreeMap<Integer, Feature>();
CompareCodeTables ct = new CompareCodeTables();
ct.readWmoCsv("C:/docs/BC_CodeFlagTable.csv", wmoMap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void compareBrit() throws IOException {
compare2(robbMap, bmTable);
}

static public void mainBrit(String args[]) throws IOException {
public static void mainBrit(String args[]) throws IOException {
CompareTableB ct = new CompareTableB();
ct.compareBrit();
}
Expand Down Expand Up @@ -202,7 +202,7 @@ void readWmoCsv(String filename, Map<Integer, Feature> map) throws IOException {
System.out.printf("%s lines=%d elems=%d avg name len=%d%n", filename, count, n, avg / n);
}

static public void main(String args[]) throws IOException {
public static void main(String args[]) throws IOException {
CompareTableB ct = new CompareTableB();
Map<Integer, Feature> wmoMap = new TreeMap<Integer, Feature>();
ct.readWmoCsv("C:/docs/BC_TableB.csv", wmoMap);
Expand Down Expand Up @@ -551,7 +551,7 @@ String compare(TableB.Descriptor f1, TableB.Descriptor f2) {
return sb.toString();
}

static public void main2(String args[]) throws IOException {
public static void main2(String args[]) throws IOException {
CompareTableB ct = new CompareTableB();
ct.compareAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ String fxy(int fxy) {
return f + "-" + x + "-" + y;
}

static public void main(String args[]) throws IOException {
public static void main(String args[]) throws IOException {
CompareTableD ct = new CompareTableD();
ct.readWmoCsv("C:/docs/B_TableD.csv", wmoMap);
ct.readTable();
Expand Down
2 changes: 1 addition & 1 deletion cdm-test/src/test/java/SevenZip/CRC.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package SevenZip;

public class CRC {
static public int[] Table = new int[256];
public static int[] Table = new int[256];

static {
for (int i = 0; i < 256; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ public void Encode(short[] probs, int index, int symbol) throws IOException {
}
}

static public int GetPrice(int Prob, int symbol) {
public static int GetPrice(int Prob, int symbol) {
return ProbPrices[(((Prob - symbol) ^ ((-symbol))) & (kBitModelTotal - 1)) >>> kNumMoveReducingBits];
}

static public int GetPrice0(int Prob) {
public static int GetPrice0(int Prob) {
return ProbPrices[Prob >>> kNumMoveReducingBits];
}

static public int GetPrice1(int Prob) {
public static int GetPrice1(int Prob) {
return ProbPrices[(kBitModelTotal - Prob) >>> kNumMoveReducingBits];
}
}
2 changes: 1 addition & 1 deletion cdm-test/src/test/java/SevenZip/LzmaAlone.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package SevenZip;

public class LzmaAlone {
static public class CommandLine {
public static class CommandLine {
public static final int kEncode = 0;
public static final int kDecode = 1;
public static final int kBenchmak = 2;
Expand Down
2 changes: 1 addition & 1 deletion cdm-test/src/test/java/SevenZip/LzmaBench.java
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ static void PrintResults(int dictionarySize, long elapsedTime, long size, boolea
PrintRating(rating);
}

static public int LzmaBenchmark(int numIterations, int dictionarySize) throws Exception {
public static int LzmaBenchmark(int numIterations, int dictionarySize) throws Exception {
if (numIterations <= 0)
return 0;
if (dictionarySize < (1 << 18)) {
Expand Down
2 changes: 1 addition & 1 deletion cdm-test/src/test/java/ucar/nc2/TestCheckFileType.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TestCheckFileType extends UnitTestCommon {
static final String PREFIX = "thredds/public/testdata/";

@Parameterized.Parameters(name = "{1}")
static public List<Object[]> getTestParameters() {
public static List<Object[]> getTestParameters() {
List<Object[]> result = new ArrayList<>();
result.add(new Object[] {NCheader.NC_FORMAT_NETCDF3, "testData.nc"});
result.add(new Object[] {NCheader.NC_FORMAT_64BIT_OFFSET, "nc_test_cdf2.nc"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public void openAsGridAndCount() throws Exception {
doOne(dir, name, ngrids, ncoordSys, ncoordAxes, nVertCooordAxes);
}

static public void doOne(String dir, String name, int ngrids, int ncoordSys, int ncoordAxes, int nVertCooordAxes)
public static void doOne(String dir, String name, int ngrids, int ncoordSys, int ncoordAxes, int nVertCooordAxes)
throws Exception {
System.out.printf("test read GridDataset= %s%s%n", dir, name);
ucar.nc2.dt.grid.GridDataset gridDs = GridDataset.open(dir + name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public class TestRdaCoordsMatchGbx {
private static final boolean showFileCounters = true;

@BeforeClass
static public void before() {
public static void before() {
Grib.setDebugFlags(new DebugFlagsImpl("Grib/debugGbxIndexOnly"));
countersAll = GribCoordsMatchGbx.getCounters();
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
System.out.printf("countersAll = %s%n", countersAll);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@RunWith(Parameterized.class)
public class TestCFPointDatasets {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
static public String CFpointObs_topdir = TestDir.cdmLocalFromTestDataDir + "point/";
public static String CFpointObs_topdir = TestDir.cdmLocalFromTestDataDir + "point/";

public static List<Object[]> getPointDatasets() {
List<Object[]> result = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
@RunWith(Parameterized.class)
public class TestPreCFpointDatasets {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
static public String CFpointObs_pre16 = TestDir.cdmLocalFromTestDataDir + "pointPre1.6/";
public static String CFpointObs_pre16 = TestDir.cdmLocalFromTestDataDir + "pointPre1.6/";

@Parameterized.Parameters(name = "{0}")
public static List<Object[]> getTestParameters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class TestCoordinatesMatchGbx {
private static final boolean showFileCounters = false;

@BeforeClass
static public void before() {
public static void before() {
Grib.setDebugFlags(new DebugFlagsImpl("Grib/debugGbxIndexOnly"));
countersAll = GribCoordsMatchGbx.getCounters();

Expand All @@ -39,7 +39,7 @@ static public void before() {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
logger.debug("countersAll = {}", countersAll);
Variable.permitCaching = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public class TestCoordinatesMatchGbxP {
private static final boolean showFileCounters = true;

@BeforeClass
static public void before() {
public static void before() {
Grib.setDebugFlags(new DebugFlagsImpl("Grib/debugGbxIndexOnly"));
countersAll = GribCoordsMatchGbx.getCounters();
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
System.out.printf("countersAll = %s%n", countersAll);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class TestGribCollectionCoordinates {
private static CollectionUpdateType updateMode = CollectionUpdateType.always;

@BeforeClass
static public void before() throws IOException {
public static void before() throws IOException {
GribIosp.debugIndexOnlyCount = 0;
GribCollectionImmutable.countGC = 0;
PartitionCollectionImmutable.countPC = 0;
Expand All @@ -48,7 +48,7 @@ static public void before() throws IOException {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
/*
* Formatter out = new Formatter(System.out);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class TestGribCollectionMissing {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@BeforeClass
static public void before() {
public static void before() {
GribIosp.debugIndexOnlyCount = 0;
GribCollectionImmutable.countGC = 0;
PartitionCollectionImmutable.countPC = 0;
Expand All @@ -81,7 +81,7 @@ static public void before() {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
Formatter out = new Formatter(System.out);

Expand Down Expand Up @@ -322,7 +322,7 @@ private static void read(GridDatatype gdt, Count count, int rtIndex, int tIndex,
count.nread++;
}

static public class Count {
public static class Count {
int nread;
int nmiss;
int nerrs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class TestGribCollectionsBig {
// String topdir = "B:/rdavm"; // use for local windows to get around samba bug

@BeforeClass
static public void before() {
public static void before() {
GribIosp.debugIndexOnlyCount = 0;
GribCollectionImmutable.countGC = 0;
PartitionCollectionImmutable.countPC = 0;
Expand All @@ -78,7 +78,7 @@ static public void before() {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
Formatter out = new Formatter(System.out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class TestGribCollectionsDense {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

@BeforeClass
static public void before() {
public static void before() {
GribIosp.debugIndexOnlyCount = 0;
GribCollectionImmutable.countGC = 0;
PartitionCollectionImmutable.countPC = 0;
Expand All @@ -77,7 +77,7 @@ static public void before() {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
Formatter out = new Formatter(System.out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class TestGribIndexCreation {
private static CollectionUpdateType updateMode = CollectionUpdateType.always;

@BeforeClass
static public void before() {
public static void before() {
GribIosp.debugIndexOnlyCount = 0;
GribCollectionImmutable.countGC = 0;
PartitionCollectionImmutable.countPC = 0;
Expand All @@ -61,7 +61,7 @@ static public void before() {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
Formatter out = new Formatter(System.out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class TestGribIndexCreationOther {
private static final boolean show = false;

@BeforeClass
static public void before() {
public static void before() {
GribIosp.debugIndexOnlyCount = 0;
GribCollectionImmutable.countGC = 0;
PartitionCollectionImmutable.countPC = 0;
Expand All @@ -46,7 +46,7 @@ static public void before() {
}

@AfterClass
static public void after() {
public static void after() {
Grib.setDebugFlags(new DebugFlagsImpl());
Formatter out = new Formatter(System.out);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ public int compare(Pqact o1, Pqact o2) {
static Formatter out = new Formatter(System.out);

// LOOK turn this into a test
static public void main(String args[]) throws IOException {
public static void main(String args[]) throws IOException {

// read pattern matching
readPqactTable("D:/bufr/pqact.txt");
Expand Down
2 changes: 1 addition & 1 deletion cdm-test/src/test/java/ucar/nc2/iosp/hdf4/TestH4eos.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class TestH4eos {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

static public String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/eos/";
public static String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/eos/";

// test the coordSysBuilder - check if grid exists
@Test
Expand Down
2 changes: 1 addition & 1 deletion cdm-test/src/test/java/ucar/nc2/iosp/hdf4/TestH4misc.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
@Category(NeedsCdmUnitTest.class)
public class TestH4misc {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
static public String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/";
public static String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/";

@Test
public void testUnsigned() throws IOException, InvalidRangeException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TestH4readAll {
static private String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/";

@AfterClass
static public void after() {
public static void after() {
H4header.setDebugFlags(new DebugFlagsImpl("")); // make sure debug flags are off
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class TestH4readAndCount {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

static public String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/";
public static String testDir = TestDir.cdmUnitTestDir + "formats/hdf4/";

@Parameterized.Parameters(name = "{0}")
public static List<Object[]> getTestParameters() {
Expand Down
Loading

0 comments on commit 6d334cf

Please sign in to comment.