From: gmungoc Date: Thu, 4 Apr 2019 15:00:54 +0000 (+0100) Subject: JAL-3220 unneeded main methods removed X-Git-Tag: Develop-2_11_2_0-d20201215~24^2~68^2~174^2~2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;ds=sidebyside;h=83a7efc57926ebf046f95de5291eb439563eb953;p=jalview.git JAL-3220 unneeded main methods removed --- diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index b681aa6..546a214 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -468,23 +468,4 @@ public class StructureFrequency System.arraycopy(rtnval, 0, result, 1, rtnval.length); return result; } - - public static void main(String args[]) - { - // Short test to see if checkBpType works - ArrayList test = new ArrayList(); - test.add("A"); - test.add("c"); - test.add("g"); - test.add("T"); - test.add("U"); - for (String i : test) - { - for (String j : test) - { - System.out.println(i + "-" + j + ": " - + Rna.isCanonicalOrWobblePair(i.charAt(0), j.charAt(0))); - } - } - } } diff --git a/src/jalview/appletgui/TitledPanel.java b/src/jalview/appletgui/TitledPanel.java index b2a996a..feeaf83 100644 --- a/src/jalview/appletgui/TitledPanel.java +++ b/src/jalview/appletgui/TitledPanel.java @@ -62,27 +62,6 @@ public class TitledPanel extends Panel g.drawString(getTitle(), 10, 10); } - public static void main(String[] args) - { - Frame f = new Frame("TitledPanel Tester"); - - TitledPanel p = new TitledPanel("Title of Panel"); - p.add(new Label("Label 1")); - p.add(new Label("Label 2")); - p.add(new Label("Label 3")); - f.add(p); - - f.addWindowListener(new WindowAdapter() - { - public void windowClosing(WindowEvent e) - { - System.exit(0); - } - }); - f.setBounds(300, 300, 300, 300); - f.setVisible(true); - } - public String getTitle() { return title; diff --git a/src/jalview/fts/service/pdb/PDBFTSRestClient.java b/src/jalview/fts/service/pdb/PDBFTSRestClient.java index 0b5d431..0e20338 100644 --- a/src/jalview/fts/service/pdb/PDBFTSRestClient.java +++ b/src/jalview/fts/service/pdb/PDBFTSRestClient.java @@ -482,32 +482,5 @@ public static String parseJsonExceptionString(String jsonErrorResponse) return allDefaultDisplayedStructureDataColumns; } - @SuppressWarnings("unchecked") -public static void main(String[] args) { - - - // check for transpiler fix associated with JSONParser yylex.java use of charAt() - // instead of codePointAt() - - String s = "e"; - char c = 'c'; - char f = 'f'; - s += c | f; - int x = c&f; - int y = 2 & c; - int z = c ^ 5; - String result = s +x + y + z; - assert (result == "e103982102"); - try - { - Map jsonObj = (Map) JSONUtils.parse("{\"a\":3}"); - System.out.println(jsonObj); - } catch (ParseException e) - { - e.printStackTrace(); - } - - } - } diff --git a/src/jalview/math/RotatableMatrix.java b/src/jalview/math/RotatableMatrix.java index 602c5e4..f3bf436 100755 --- a/src/jalview/math/RotatableMatrix.java +++ b/src/jalview/math/RotatableMatrix.java @@ -22,6 +22,7 @@ package jalview.math; import jalview.datamodel.Point; +import java.io.PrintStream; import java.util.HashMap; import java.util.Map; @@ -57,7 +58,7 @@ public class RotatableMatrix public enum Axis { X, Y, Z - }; + } float[][] matrix; @@ -101,16 +102,11 @@ public class RotatableMatrix /** * Prints the matrix in rows of space-delimited values */ - public void print() + public void print(PrintStream ps) { - System.out.println( - matrix[0][0] + " " + matrix[0][1] + " " + matrix[0][2]); - - System.out.println( - matrix[1][0] + " " + matrix[1][1] + " " + matrix[1][2]); - - System.out.println( - matrix[2][0] + " " + matrix[2][1] + " " + matrix[2][2]); + ps.println(matrix[0][0] + " " + matrix[0][1] + " " + matrix[0][2]); + ps.println(matrix[1][0] + " " + matrix[1][1] + " " + matrix[1][2]); + ps.println(matrix[2][0] + " " + matrix[2][1] + " " + matrix[2][2]); } /** @@ -248,74 +244,6 @@ public class RotatableMatrix } /** - * DOCUMENT ME! - * - * @param args - * DOCUMENT ME! - */ - public static void main(String[] args) - { - RotatableMatrix m = new RotatableMatrix(); - - m.setValue(0, 0, 1); - - m.setValue(0, 1, 0); - - m.setValue(0, 2, 0); - - m.setValue(1, 0, 0); - - m.setValue(1, 1, 2); - - m.setValue(1, 2, 0); - - m.setValue(2, 0, 0); - - m.setValue(2, 1, 0); - - m.setValue(2, 2, 1); - - m.print(); - - RotatableMatrix n = new RotatableMatrix(); - - n.setValue(0, 0, 2); - - n.setValue(0, 1, 1); - - n.setValue(0, 2, 1); - - n.setValue(1, 0, 2); - - n.setValue(1, 1, 1); - - n.setValue(1, 2, 1); - - n.setValue(2, 0, 2); - - n.setValue(2, 1, 1); - - n.setValue(2, 2, 1); - - n.print(); - - // m.postMultiply(n.matrix); - // m.print(); - // m.rotate(45,'z',new RotatableMatrix(3,3)); - float[] vect = new float[3]; - - vect[0] = 2; - - vect[1] = 4; - - vect[2] = 6; - - vect = m.vectorMultiply(vect); - - System.out.println(vect[0] + " " + vect[1] + " " + vect[2]); - } - - /** * Performs a vector multiplication whose result is the Point representing the * input point's value vector post-multiplied by this matrix. * diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index bddc1b1..23c6949 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -189,11 +189,6 @@ public class MsaWSClient extends Jws2Client } } - public static void main(String[] args) - { - System.out.println("A".matches("(-*[a-zA-Z]-*){1}[a-zA-Z-]*")); - } - protected String getServiceActionKey() { return "MsaWS"; diff --git a/test/jalview/math/RotatableMatrixTest.java b/test/jalview/math/RotatableMatrixTest.java index 06982d5..31b47aa 100644 --- a/test/jalview/math/RotatableMatrixTest.java +++ b/test/jalview/math/RotatableMatrixTest.java @@ -4,6 +4,9 @@ import static org.testng.Assert.assertEquals; import jalview.math.RotatableMatrix.Axis; +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -31,6 +34,17 @@ public class RotatableMatrixTest } @Test(groups = "Functional") + public void testPrint() + { + String expected = "0.5 1.0 1.5\n1.0 2.0 3.0\n1.5 3.0 4.5\n"; + ByteArrayOutputStream os = new ByteArrayOutputStream(); + PrintStream ps = new PrintStream(os, true); + rm.print(ps); + String result = new String(os.toByteArray()); + assertEquals(result, expected); + } + + @Test(groups = "Functional") public void testPreMultiply() { float[][] pre = new float[3][3]; diff --git a/utils/test/JalviewJSTest.java b/utils/test/JalviewJSTest.java index d81e392..3e08024 100644 --- a/utils/test/JalviewJSTest.java +++ b/utils/test/JalviewJSTest.java @@ -1,7 +1,6 @@ package test; -import jalview.gui.Desktop; import jalview.gui.JvOptionPane; -import jalview.util.MessageManager; +import jalview.util.JSONUtils; import java.awt.BorderLayout; import java.awt.ComponentOrientation; @@ -31,6 +30,8 @@ import javax.swing.SwingConstants; import javax.swing.WindowConstants; import javax.swing.border.TitledBorder; +import org.json.simple.parser.ParseException; + /** * A class with a main method entry point for ad hoc tests of JalviewJS * behaviour. The J2S transpiler should generate an html entry point for this @@ -40,9 +41,36 @@ public class JalviewJSTest extends JPanel { public static void main(String[] args) { - new JalviewJSTest().doTest5(); + new JalviewJSTest().doTest6(); } + void doTest6() + { + /* + * check for transpiler fix associated with JSONParser yylex.java use of charAt() + * instead of codePointAt(); moved here from PDBFTSRestClient + */ + + String s = "e"; + char c = 'c'; + char f = 'f'; + s += c | f; + int x = c & f; + int y = 2 & c; + int z = c ^ 5; + String result = s + x + y + z; + System.out.println("Expected " + "e103982102, found " + result); + try + { + Map jsonObj = (Map) JSONUtils + .parse("{\"a\":3}"); + System.out.println(jsonObj); + } catch (ParseException e) + { + e.printStackTrace(); + } + } + /** * Dialog message truncation */ @@ -259,10 +287,12 @@ private ImageIcon getImage(String name) { ImageIcon icon = new ImageIcon(getClass().getResource(name)); while(icon.getImageLoadStatus() == MediaTracker.LOADING) - try { - Thread.sleep(10); - } catch (InterruptedException e) { - } + { + try { + Thread.sleep(10); + } catch (InterruptedException e) { + } + } return icon; } }