From 6a96f4eadde2fe2d2053c41972e43dbbeaae81f9 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Wed, 23 Mar 2005 15:37:11 +0000 Subject: [PATCH] no longer used --- src/jalview/gui/ColourKey.java | 240 ---------- src/jalview/gui/DrawableSequence.java | 221 ---------- src/jalview/jbgui/GColourKey.java | 201 --------- src/jalview/schemes/SecondaryColourScheme.java | 28 -- src/jalview/util/ErrorLog.java | 18 - src/jalview/util/Format.save | 563 ------------------------ src/jalview/util/ListenList.java | 28 -- src/jalview/util/WindowUtil.java | 45 -- 8 files changed, 1344 deletions(-) delete mode 100755 src/jalview/gui/ColourKey.java delete mode 100755 src/jalview/gui/DrawableSequence.java delete mode 100755 src/jalview/jbgui/GColourKey.java delete mode 100755 src/jalview/schemes/SecondaryColourScheme.java delete mode 100755 src/jalview/util/ErrorLog.java delete mode 100755 src/jalview/util/Format.save delete mode 100755 src/jalview/util/ListenList.java delete mode 100755 src/jalview/util/WindowUtil.java diff --git a/src/jalview/gui/ColourKey.java b/src/jalview/gui/ColourKey.java deleted file mode 100755 index 6d6646e..0000000 --- a/src/jalview/gui/ColourKey.java +++ /dev/null @@ -1,240 +0,0 @@ -package jalview.gui; - -import jalview.jbgui.GColourKey; -import jalview.schemes.*; -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - - -public class ColourKey extends GColourKey -{ - - Color midBlue = new Color(100,100,255); - public ColourKey(ColourSchemeI current) - { - if(current==null) - zappoMenuItem_actionPerformed(null); - - else if(current instanceof Blosum62ColourScheme) - blosumMenuItem_actionPerformed(null); - - else if(current instanceof BuriedColourScheme) - buriedMenuItem_actionPerformed(null); - -// else if(current instanceof ClustalxColourScheme) - // cl - else if(current instanceof HelixColourScheme) - helixMenuItem_actionPerformed(null); - - else if(current instanceof HydrophobicColourScheme) - hydroMenuItem_actionPerformed(null); - - else if(current instanceof StrandColourScheme) - strandMenuItem_actionPerformed(null); - - else if(current instanceof TaylorColourScheme) - taylorMenuItem_actionPerformed(null); - - else if(current instanceof TurnColourScheme) - turnMenuItem_actionPerformed(null); - - else // default - zappoMenuItem_actionPerformed(null); - } - - void displayKey(String [] residue, String [] description, Color [] colour, String comment) - { - this.getContentPane().removeAll(); - - for(int i=0; i 80 % Mid blue -> 60 % Light blue -> 40 % Light grey -<= 40% White -*/ - - - - - - - - - - - - - - diff --git a/src/jalview/gui/DrawableSequence.java b/src/jalview/gui/DrawableSequence.java deleted file mode 100755 index 48b3827..0000000 --- a/src/jalview/gui/DrawableSequence.java +++ /dev/null @@ -1,221 +0,0 @@ -package jalview.gui; - -import jalview.datamodel.*; -import jalview.schemes.*; -import java.awt.*; -import java.util.*; - -public class DrawableSequence implements SequenceI { - protected boolean fastDraw = true; - protected Color color = Color.black; - - protected SequenceI sequence; - - ColourSchemeI cs = null; - - public Vector sequenceFeatures = new Vector(); - public void setSequenceFeatures(Vector v) - { sequenceFeatures = v; } - public Vector getSequenceFeatures() - {return sequenceFeatures; } - - String pdbId; - public void setPDBId(String id) - { pdbId = id; } - public String getPDBId() - { return pdbId; } - - - public DrawableSequence(SequenceI s) { - this.sequence = s; - - _init(); - } - - public DrawableSequence(String name,String seq, int start, int end) { - sequence = new Sequence(name,seq,start,end); - - _init(); - } - - private void _init() { - - } - - public void setColourScheme(ColourSchemeI cs) { - this.cs = cs; - } - - public Color getResidueBoxColour(int i) { - Color c = cs.findColour( sequence.getSequence(i,i+1),i,null); - return c; - } - - public void drawSequence(Graphics g,int start, int end, int x1, int y1, int width, int height,boolean showScores, boolean displayBoxes, boolean displayText) { - - if (displayBoxes == true) { - drawBoxes(g,start,end,x1,y1,width, height); - } - if (displayText == true) { - drawText(g,start,end,x1,y1,width,height); - } - } - - public void drawBoxes(Graphics g,int start, int end, int x1, int y1, int width, int height) { - int i = start; - int length = getSequence().length(); - - Color currentColor = Color.white; - - int curStart = x1; - int curWidth = width; - - while (i <= end && i < length) { - Color c = getResidueBoxColour(i); - - if (c != currentColor || c != null) { - g.fillRect(x1+width*(curStart-start),y1,curWidth,height); - - currentColor = c; - g.setColor(c); - - curStart = i; - curWidth = width; - } else { - curWidth += width; - } - - i++; - } - g.fillRect(x1+width*(curStart-start),y1,curWidth,height); - } - - public void drawText(Graphics g, int start, int end, int x1, int y1, int width, int height) { - int pady = 2; - g.setColor(Color.black); -System.out.println("drawablesequence is drawing"); - // Need to find the sequence position here. - - if (fastDraw) { - String s; - if (end < getSequence().length()) { - s = getSequence().substring(start,end+1); - } else { - s = getSequence().substring(start); - } - System.out.println(s+" "+x1+" "+y1); - g.drawString(s,x1,y1+height-pady); - } else { - - for (int i=start; i <= end; i++) { - String s = ""; - - if (i < end && i < getSequence().length()) { - s = getSequence().substring(i,i+1); - } else { - s = getSequence().substring(i,i+1); - } - - - g.drawString(s,x1+width*(i-start),y1+height-pady); - } - - } - } - - - public int getPosition(int res) { - - return res; - } - - public int getResidue(int pos) { - - return pos; - } - - // SequenceI methods - - public void setName(String name) { - sequence.setName(name); - } - public String getName() { - return sequence.getName(); - } - public String getDisplayId() { - return sequence.getDisplayId(); - } - - public void setStart(int start) { - sequence.setStart(start); - } - public int getStart() { - return sequence.getStart(); - } - - public void setEnd(int end) { - sequence.setEnd(end); - } - public int getEnd() { - return sequence.getEnd(); - } - - public int getLength() { - return sequence.getLength(); - } - - public void setSequence(String seq) { - sequence.setSequence(seq); - } - public String getSequence() { - return sequence.getSequence(); - } - public String getSequence(int start,int end) { - return sequence.getSequence(start,end); - } - public char getCharAt(int i) { - return sequence.getCharAt(i); - } - - public void setDescription(String desc) { - sequence.setDescription(desc); - } - public String getDescription() { - return sequence.getDescription(); - } - - public int findIndex(int pos) { - return sequence.findIndex(pos); - } - public int findPosition(int i) { - return sequence.findPosition(i); - } - - - public void deleteCharAt(int i) { - sequence.deleteCharAt(i); - } - - public void deleteChars(int i, int j) - { - - } - - public void insertCharAt(int i,char c) { - sequence.insertCharAt(i,c); - - } - - public void insertCharAt(int i,char c,boolean chop) { - sequence.insertCharAt(i,c,chop); - - } - public Color getColor() { - return this.color; - } - - public void setColor(Color c) { - this.color = c; - } - -} diff --git a/src/jalview/jbgui/GColourKey.java b/src/jalview/jbgui/GColourKey.java deleted file mode 100755 index da4eb74..0000000 --- a/src/jalview/jbgui/GColourKey.java +++ /dev/null @@ -1,201 +0,0 @@ -package jalview.jbgui; - -import javax.swing.*; -import java.awt.event.*; -import java.awt.*; - -public class GColourKey extends JInternalFrame -{ - JMenuBar jMenuBar1 = new JMenuBar(); - protected JMenu menu = new JMenu(); - JRadioButtonMenuItem clustalMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem zappoMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem taylorMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem hydroMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem helixMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem strandMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem turnMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem buriedMenuItem = new JRadioButtonMenuItem(); - JRadioButtonMenuItem blosumMenuItem = new JRadioButtonMenuItem(); - FlowLayout flowLayout1 = new FlowLayout(); - - public GColourKey() - { - try - { - jbInit(); - } - catch(Exception e) - { - e.printStackTrace(); - } - - this.setJMenuBar( jMenuBar1 ); - ButtonGroup colours = new ButtonGroup(); - colours.add(clustalMenuItem); - colours.add(zappoMenuItem); - colours.add(taylorMenuItem); - colours.add(hydroMenuItem); - colours.add(helixMenuItem); - colours.add(strandMenuItem); - colours.add(turnMenuItem); - colours.add(buriedMenuItem); - colours.add(blosumMenuItem); - - } - private void jbInit() throws Exception - { - menu.setBackground(new Color(212, 208, 255)); - menu.setActionCommand("Color Scheme"); - menu.setText("Zappo Colour Scheme"); - clustalMenuItem.setBackground(new Color(212, 208, 255)); - clustalMenuItem.setText("ClustalX "); - clustalMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - clustalMenuItem_actionPerformed(e); - } - }); - zappoMenuItem.setBackground(new Color(212, 208, 255)); - zappoMenuItem.setSelected(true); - zappoMenuItem.setText("Zappo"); - zappoMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - zappoMenuItem_actionPerformed(e); - } - }); - taylorMenuItem.setBackground(new Color(212, 208, 255)); - taylorMenuItem.setText("Taylor"); - taylorMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - taylorMenuItem_actionPerformed(e); - } - }); - hydroMenuItem.setBackground(new Color(212, 208, 255)); - hydroMenuItem.setText("Hydrophobicity"); - hydroMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - hydroMenuItem_actionPerformed(e); - } - }); - helixMenuItem.setBackground(new Color(212, 208, 255)); - helixMenuItem.setText("Helix Propensity"); - helixMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - helixMenuItem_actionPerformed(e); - } - }); - strandMenuItem.setBackground(new Color(212, 208, 255)); - strandMenuItem.setText("Strand Propensity"); - strandMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - strandMenuItem_actionPerformed(e); - } - }); - turnMenuItem.setBackground(new Color(212, 208, 255)); - turnMenuItem.setText("Turn Propensity"); - turnMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - turnMenuItem_actionPerformed(e); - } - }); - buriedMenuItem.setBackground(new Color(212, 208, 255)); - buriedMenuItem.setText("Buried Index"); - buriedMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - buriedMenuItem_actionPerformed(e); - } - }); - blosumMenuItem.setBackground(new Color(212, 208, 255)); - blosumMenuItem.setText("Blosum62"); - blosumMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - blosumMenuItem_actionPerformed(e); - } - }); - this.getContentPane().setLayout(flowLayout1); - this.getContentPane().setBackground(new Color(212, 208, 255)); - jMenuBar1.setBackground(new Color(212, 208, 255)); - jMenuBar1.add(menu); - menu.add(clustalMenuItem); - menu.add(zappoMenuItem); - menu.add(taylorMenuItem); - menu.add(hydroMenuItem); - menu.add(helixMenuItem); - menu.add(strandMenuItem); - menu.add(turnMenuItem); - menu.add(buriedMenuItem); - menu.add(blosumMenuItem); - - } - - protected void clustalMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void zappoMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void taylorMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void hydroMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void helixMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void strandMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void turnMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void buriedMenuItem_actionPerformed(ActionEvent e) - { - - } - - protected void blosumMenuItem_actionPerformed(ActionEvent e) - { - - } - - - - - - - - -} diff --git a/src/jalview/schemes/SecondaryColourScheme.java b/src/jalview/schemes/SecondaryColourScheme.java deleted file mode 100755 index ddf205c..0000000 --- a/src/jalview/schemes/SecondaryColourScheme.java +++ /dev/null @@ -1,28 +0,0 @@ -package jalview.schemes; - -import jalview.gui.DrawableSequence; - -import java.util.*; -import java.awt.*; - - -public class SecondaryColourScheme extends ResidueColourScheme { - - public Color getColor(DrawableSequence seq, int j, Vector aa) { - Color c = Color.white; - - String s = seq.getSequence().substring(j,j+1); - - if (ResidueProperties.ssHash.containsKey(s)) { - c = (Color)ResidueProperties.ssHash.get(s); - } else { - c = Color.white; - } - return c; - } -} - - - - - diff --git a/src/jalview/util/ErrorLog.java b/src/jalview/util/ErrorLog.java deleted file mode 100755 index dd95b06..0000000 --- a/src/jalview/util/ErrorLog.java +++ /dev/null @@ -1,18 +0,0 @@ -package jalview.util; - -import java.io.*; - -public class ErrorLog { - static PrintStream errStream = System.err; - static PrintStream teeFile = null; - - private ErrorLog() {} - - public static void println(String str) { - errStream.println("Error Logger: " + str); - } - - public static void main(String [] argv) { - ErrorLog.println("ERROR"); - } -} diff --git a/src/jalview/util/Format.save b/src/jalview/util/Format.save deleted file mode 100755 index 5783670..0000000 --- a/src/jalview/util/Format.save +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Cay S. Horstmann & Gary Cornell, Core Java - * Published By Sun Microsystems Press/Prentice-Hall - * Copyright (C) 1997 Sun Microsystems Inc. - * All Rights Reserved. - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for NON-COMMERCIAL purposes - * and without fee is hereby granted provided that this - * copyright notice appears in all copies. - * - * THE AUTHORS AND PUBLISHER MAKE NO REPRESENTATIONS OR - * WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THE AUTHORS - * AND PUBLISHER SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED - * BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING - * THIS SOFTWARE OR ITS DERIVATIVES. - */ - -/** - * A class for formatting numbers that follows printf conventions. - * Also implements C-like atoi and atof functions - * @version 1.03 25 Oct 1997 - * @author Cay Horstmann - */ - -package jalview.util; - -import java.io.*; - -public class Format - -{ /** - * Formats the number following printf conventions. - * Main limitation: Can only handle one format parameter at a time - * Use multiple Format objects to format more than one number - * @param s the format string following printf conventions - * The string has a prefix, a format code and a suffix. The prefix and suffix - * become part of the formatted output. The format code directs the - * formatting of the (single) parameter to be formatted. The code has the - * following structure - * - * @exception IllegalArgumentException if bad format - */ - - public Format(String s) - { width = 0; - precision = -1; - pre = ""; - post = ""; - leading_zeroes = false; - show_plus = false; - alternate = false; - show_space = false; - left_align = false; - fmt = ' '; - - int state = 0; - int length = s.length(); - int parse_state = 0; - // 0 = prefix, 1 = flags, 2 = width, 3 = precision, - // 4 = format, 5 = end - int i = 0; - - while (parse_state == 0) - { if (i >= length) parse_state = 5; - else if (s.charAt(i) == '%') - { if (i < length - 1) - { if (s.charAt(i + 1) == '%') - { pre = pre + '%'; - i++; - } - else - parse_state = 1; - } - else throw new java.lang.IllegalArgumentException(); - } - else - pre = pre + s.charAt(i); - i++; - } - while (parse_state == 1) - { if (i >= length) parse_state = 5; - else if (s.charAt(i) == ' ') show_space = true; - else if (s.charAt(i) == '-') left_align = true; - else if (s.charAt(i) == '+') show_plus = true; - else if (s.charAt(i) == '0') leading_zeroes = true; - else if (s.charAt(i) == '#') alternate = true; - else { parse_state = 2; i--; } - i++; - } - while (parse_state == 2) - { if (i >= length) parse_state = 5; - else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') - { width = width * 10 + s.charAt(i) - '0'; - i++; - } - else if (s.charAt(i) == '.') - { parse_state = 3; - precision = 0; - i++; - } - else - parse_state = 4; - } - while (parse_state == 3) - { if (i >= length) parse_state = 5; - else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') - { precision = precision * 10 + s.charAt(i) - '0'; - i++; - } - else - parse_state = 4; - } - if (parse_state == 4) - { if (i >= length) parse_state = 5; - else fmt = s.charAt(i); - i++; - } - if (i < length) - post = s.substring(i, length); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream - * @param fmt the format string - * @param x the double to print - */ - - public static void print(java.io.PrintStream s, String fmt, double x) - { s.print(new Format(fmt).form(x)); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream - * @param fmt the format string - * @param x the long to print - */ - public static void print(java.io.PrintStream s, String fmt, long x) - { s.print(new Format(fmt).form(x)); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream - * @param fmt the format string - * @param x the character to - */ - - public static void print(java.io.PrintStream s, String fmt, char x) - { s.print(new Format(fmt).form(x)); - } - - /** - * prints a formatted number following printf conventions - * @param s a PrintStream, fmt the format string - * @param x a string that represents the digits to print - */ - - public static void print(java.io.PrintStream s, String fmt, String x) - { s.print(new Format(fmt).form(x)); - } - - /** - * Converts a string of digits (decimal, octal or hex) to an integer - * @param s a string - * @return the numeric value of the prefix of s representing a base 10 integer - */ - - public static int atoi(String s) - { return (int)atol(s); - } - - /** - * Converts a string of digits (decimal, octal or hex) to a long integer - * @param s a string - * @return the numeric value of the prefix of s representing a base 10 integer - */ - - public static long atol(String s) - { int i = 0; - - while (i < s.length() && Character.isWhitespace(s.charAt(i))) i++; - if (i < s.length() && s.charAt(i) == '0') - { if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X')) - return parseLong(s.substring(i + 2), 16); - else return parseLong(s, 8); - } - else return parseLong(s, 10); - } - - private static long parseLong(String s, int base) - { int i = 0; - int sign = 1; - long r = 0; - - while (i < s.length() && Character.isWhitespace(s.charAt(i))) i++; - if (i < s.length() && s.charAt(i) == '-') { sign = -1; i++; } - else if (i < s.length() && s.charAt(i) == '+') { i++; } - while (i < s.length()) - { char ch = s.charAt(i); - if ('0' <= ch && ch < '0' + base) - r = r * base + ch - '0'; - else if ('A' <= ch && ch < 'A' + base - 10) - r = r * base + ch - 'A' + 10 ; - else if ('a' <= ch && ch < 'a' + base - 10) - r = r * base + ch - 'a' + 10 ; - else - return r * sign; - i++; - } - return r * sign; - } - - /** - * Converts a string of digits to an double - * @param s a string - */ - - public static double atof(String s) - { int i = 0; - int sign = 1; - double r = 0; // integer part - double f = 0; // fractional part - double p = 1; // exponent of fractional part - int state = 0; // 0 = int part, 1 = frac part - - while (i < s.length() && Character.isWhitespace(s.charAt(i))) i++; - if (i < s.length() && s.charAt(i) == '-') { sign = -1; i++; } - else if (i < s.length() && s.charAt(i) == '+') { i++; } - while (i < s.length()) - { char ch = s.charAt(i); - if ('0' <= ch && ch <= '9') - { if (state == 0) - r = r * 10 + ch - '0'; - else if (state == 1) - { p = p / 10; - r = r + p * (ch - '0'); - } - } - else if (ch == '.') - { if (state == 0) state = 1; - else return sign * r; - } - else if (ch == 'e' || ch == 'E') - { long e = (int)parseLong(s.substring(i + 1), 10); - return sign * r * Math.pow(10, e); - } - else return sign * r; - i++; - } - return sign * r; - } - - /** - * Formats a double into a string (like sprintf in C) - * @param x the number to format - * @return the formatted string - * @exception IllegalArgumentException if bad argument - */ - - public String form(double x) - { String r; - if (precision < 0) precision = 6; - int s = 1; - if (x < 0) { x = -x; s = -1; } - if (fmt == 'f') - r = fixed_format(x); - else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G') - r = exp_format(x); - else throw new java.lang.IllegalArgumentException(); - - return pad(sign(s, r)); - } - - /** - * Formats a long integer into a string (like sprintf in C) - * @param x the number to format - * @return the formatted string - */ - - public String form(long x) - { String r; - int s = 0; - if (fmt == 'd' || fmt == 'i') - { if (x < 0) - { r = ("" + x).substring(1); - s = -1; - } - else - { r = "" + x; - s = 1; - } - } - else if (fmt == 'o') - r = convert(x, 3, 7, "01234567"); - else if (fmt == 'x') - r = convert(x, 4, 15, "0123456789abcdef"); - else if (fmt == 'X') - r = convert(x, 4, 15, "0123456789ABCDEF"); - else throw new java.lang.IllegalArgumentException(); - - return pad(sign(s, r)); - } - - /** - * Formats a character into a string (like sprintf in C) - * @param x the value to format - * @return the formatted string - */ - - public String form(char c) - { if (fmt != 'c') - throw new java.lang.IllegalArgumentException(); - - String r = "" + c; - return pad(r); - } - - /** - * Formats a string into a larger string (like sprintf in C) - * @param x the value to format - * @return the formatted string - */ - - public String form(String s) - { if (fmt != 's') - throw new java.lang.IllegalArgumentException(); - if (precision >= 0) s = s.substring(0, precision); - return pad(s); - } - - - /** - * a test stub for the format class - */ - - public static void main(String[] a) - { double x = 1.23456789012; - double y = 123; - double z = 1.2345e30; - double w = 1.02; - double u = 1.234e-5; - int d = 0xCAFE; - Format.print(System.out, "x = |%f|\n", x); - Format.print(System.out, "u = |%20f|\n", u); - Format.print(System.out, "x = |% .5f|\n", x); - Format.print(System.out, "w = |%20.5f|\n", w); - Format.print(System.out, "x = |%020.5f|\n", x); - Format.print(System.out, "x = |%+20.5f|\n", x); - Format.print(System.out, "x = |%+020.5f|\n", x); - Format.print(System.out, "x = |% 020.5f|\n", x); - Format.print(System.out, "y = |%#+20.5f|\n", y); - Format.print(System.out, "y = |%-+20.5f|\n", y); - Format.print(System.out, "z = |%20.5f|\n", z); - - Format.print(System.out, "x = |%e|\n", x); - Format.print(System.out, "u = |%20e|\n", u); - Format.print(System.out, "x = |% .5e|\n", x); - Format.print(System.out, "w = |%20.5e|\n", w); - Format.print(System.out, "x = |%020.5e|\n", x); - Format.print(System.out, "x = |%+20.5e|\n", x); - Format.print(System.out, "x = |%+020.5e|\n", x); - Format.print(System.out, "x = |% 020.5e|\n", x); - Format.print(System.out, "y = |%#+20.5e|\n", y); - Format.print(System.out, "y = |%-+20.5e|\n", y); - - Format.print(System.out, "x = |%g|\n", x); - Format.print(System.out, "z = |%g|\n", z); - Format.print(System.out, "w = |%g|\n", w); - Format.print(System.out, "u = |%g|\n", u); - Format.print(System.out, "y = |%.2g|\n", y); - Format.print(System.out, "y = |%#.2g|\n", y); - - Format.print(System.out, "d = |%d|\n", d); - Format.print(System.out, "d = |%20d|\n", d); - Format.print(System.out, "d = |%020d|\n", d); - Format.print(System.out, "d = |%+20d|\n", d); - Format.print(System.out, "d = |% 020d|\n", d); - Format.print(System.out, "d = |%-20d|\n", d); - Format.print(System.out, "d = |%20.8d|\n", d); - Format.print(System.out, "d = |%x|\n", d); - Format.print(System.out, "d = |%20X|\n", d); - Format.print(System.out, "d = |%#20x|\n", d); - Format.print(System.out, "d = |%020X|\n", d); - Format.print(System.out, "d = |%20.8x|\n", d); - Format.print(System.out, "d = |%o|\n", d); - Format.print(System.out, "d = |%020o|\n", d); - Format.print(System.out, "d = |%#20o|\n", d); - Format.print(System.out, "d = |%#020o|\n", d); - Format.print(System.out, "d = |%20.12o|\n", d); - - Format.print(System.out, "s = |%-20s|\n", "Hello"); - Format.print(System.out, "s = |%-20c|\n", '!'); - - // regression test to confirm fix of reported bugs - - Format.print(System.out, "|%i|\n", Long.MIN_VALUE); - - Format.print(System.out, "|%6.2e|\n", 0.0); - Format.print(System.out, "|%6.2g|\n", 0.0); - - Format.print(System.out, "|%6.2f|\n", 9.99); - Format.print(System.out, "|%6.2f|\n", 9.999); - - Format.print(System.out, "|%6.0f|\n", 9.999); - } - - private static String repeat(char c, int n) - { if (n <= 0) return ""; - StringBuffer s = new StringBuffer(n); - for (int i = 0; i < n; i++) s.append(c); - return s.toString(); - } - - private static String convert(long x, int n, int m, String d) - { if (x == 0) return "0"; - String r = ""; - while (x != 0) - { r = d.charAt((int)(x & m)) + r; - x = x >>> n; - } - return r; - } - - private String pad(String r) - { String p = repeat(' ', width - r.length()); - if (left_align) return pre + r + p + post; - else return pre + p + r + post; - } - - private String sign(int s, String r) - { String p = ""; - if (s < 0) p = "-"; - else if (s > 0) - { if (show_plus) p = "+"; - else if (show_space) p = " "; - } - else - { if (fmt == 'o' && alternate && r.length() > 0 && r.charAt(0) != '0') p = "0"; - else if (fmt == 'x' && alternate) p = "0x"; - else if (fmt == 'X' && alternate) p = "0X"; - } - int w = 0; - if (leading_zeroes) - w = width; - else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt == 'o') - && precision > 0) w = precision; - - return p + repeat('0', w - p.length() - r.length()) + r; - } - - private String fixed_format(double d) - { boolean removeTrailing - = (fmt == 'G' || fmt == 'g') && !alternate; - // remove trailing zeroes and decimal point - - if (d > 0x7FFFFFFFFFFFFFFFL) return exp_format(d); - if (precision == 0) - return (long)(d + 0.5) + (removeTrailing ? "" : "."); - - long whole = (long)d; - double fr = d - whole; // fractional part - if (fr >= 1 || fr < 0) return exp_format(d); - - double factor = 1; - String leading_zeroes = ""; - for (int i = 1; i <= precision && factor <= 0x7FFFFFFFFFFFFFFFL; i++) - { factor *= 10; - leading_zeroes = leading_zeroes + "0"; - } - long l = (long) (factor * fr + 0.5); - if (l >= factor) { l = 0; whole++; } // CSH 10-25-97 - - String z = leading_zeroes + l; - z = "." + z.substring(z.length() - precision, z.length()); - - if (removeTrailing) - { int t = z.length() - 1; - while (t >= 0 && z.charAt(t) == '0') t--; - if (t >= 0 && z.charAt(t) == '.') t--; - z = z.substring(0, t + 1); - } - - return whole + z; - } - - private String exp_format(double d) - { String f = ""; - int e = 0; - double dd = d; - double factor = 1; - if (d != 0) - { while (dd > 10) { e++; factor /= 10; dd = dd / 10; } - while (dd < 1) { e--; factor *= 10; dd = dd * 10; } - } - if ((fmt == 'g' || fmt == 'G') && e >= -4 && e < precision) - return fixed_format(d); - - d = d * factor; - f = f + fixed_format(d); - - if (fmt == 'e' || fmt == 'g') - f = f + "e"; - else - f = f + "E"; - - String p = "000"; - if (e >= 0) - { f = f + "+"; - p = p + e; - } - else - { f = f + "-"; - p = p + (-e); - } - - return f + p.substring(p.length() - 3, p.length()); - } - - private int width; - private int precision; - private String pre; - private String post; - private boolean leading_zeroes; - private boolean show_plus; - private boolean alternate; - private boolean show_space; - private boolean left_align; - private char fmt; // one of cdeEfgGiosxXos -} - - - - - diff --git a/src/jalview/util/ListenList.java b/src/jalview/util/ListenList.java deleted file mode 100755 index cc0fc5a..0000000 --- a/src/jalview/util/ListenList.java +++ /dev/null @@ -1,28 +0,0 @@ -package jalview.util; - -import java.util.*; - -public class ListenList { - protected Vector listeners; - public ListenList() { - listeners = new Vector(); - } - - public void addListener(EventListener l) { - if (l == null) { - return; - } - if (!listeners.contains(l)) { - listeners.addElement(l); - } - } - - public void removeListener(EventListener l) { - if (l == null) { - return; - } - if (listeners.contains(l)) { - listeners.removeElement(l); - } - } -} diff --git a/src/jalview/util/WindowUtil.java b/src/jalview/util/WindowUtil.java deleted file mode 100755 index 3f44167..0000000 --- a/src/jalview/util/WindowUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -package jalview.util; - -import java.awt.*; -import java.lang.reflect.*; - -public class WindowUtil { - - public static Window getWindowAncestor(Component c) { - for(Container p = c.getParent(); p != null; p = p.getParent()) { - if (p instanceof Window) { - return (Window)p; - } - } - return null; - } - - public static void removeComponents(Container cont) { - Component[] components = cont.getComponents(); - Component comp; - - for (int i = 0; i < components.length; i++) { - comp = components[i]; - if (comp != null) { - cont.remove(comp); - if (comp instanceof Container) - removeComponents((Container) comp); - } - } - } - public static void invalidateComponents(Container cont) { - Component[] components = cont.getComponents(); - Component comp; - - cont.invalidate(); - for (int i = 0; i < components.length; i++) { - comp = components[i]; - if (comp != null) { - if (comp instanceof Container) - invalidateComponents((Container) comp); - else - comp.invalidate(); - } - } - } -} -- 1.7.10.2