TechnicalInformation.java

Index Score
weka.core
Weka

View: Reasons, Metrics, Source Code

These are the metrics that contribute to the Enerjy Score for this file, ranked by impact. So the metrics listed at the top influence the score to a greater extent that the metrics listed at the bottom.

MetricDescription
JAVA0034JAVA0034 Missing braces in if statement
JAVA0144JAVA0144 Line exceeds maximum M characters
JAVA0177JAVA0177 Variable declaration missing initializer
COMPARISONSNumber of comparison operators
SIZESize of the file in bytes
JAVA0266JAVA0266 Use of System.out
UNIQUE_OPERANDSNumber of unique operands
OPERANDSNumber of operands
LINESNumber of lines in the source file
LOOPSNumber of loops
ELOCEffective lines of code
LOGICAL_LINESNumber of statements
OPERATORSNumber of operators
CYCLOMATICCyclomatic complexity
LOCLines of code
JAVA0036JAVA0036 Missing braces in while statement
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0110JAVA0110 Incorrect javadoc: no @return tag
UNIQUE_OPERATORSNumber of unique operators
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
FUNCTIONSNumber of function declarations
JAVA0068JAVA0068 Modifiers not declared in recommended order
JAVA0145JAVA0145 Tab character used in source file
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * TechnicalInformation.java * Copyright (C) 2006 University of Waikato, Hamilton, New Zealand */ package weka.core; import java.util.Collections; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; /** * Used for paper references in the Javadoc and for BibTex generation. * Based on documentation found here: <p/> * <a href="http://www.ecst.csuchico.edu/~jacobsd/bib/formats/bibtex.html" target="_blank">http://www.ecst.csuchico.edu/~jacobsd/bib/formats/bibtex.html</a> * <p/> * BibTex examples can be found here: <p/> * <a href="http://bib2web.djvuzone.org/bibtex.html" target="_blank">http://bib2web.djvuzone.org/bibtex.html</a> * * @author fracpete (fracpete at waikato dot ac dot nz) * @version $Revision: 1.11$ * @see TechnicalInformationHandler */ public class TechnicalInformation implements RevisionHandler { /** the different types of information */ public enum Type { /** An article from a journal or magazine. */ ARTICLE("article", "An article from a journal or magazine."), /** A book with an explicit publisher. */ BOOK("book", "A book with an explicit publisher."), /** A work that is printed and bound, but without a named publisher or sponsoring institution. */ BOOKLET("booklet", "A work that is printed and bound, but without a named publisher or sponsoring institution."), /** The same as inproceedings. */ CONFERENCE("conference", "The same as inproceedings."), /** A part of a book, which may be a chapter (or section or whatever) and/or a range of pages. */ INBOOK("inbook", "A part of a book, which may be a chapter (or section or whatever) and/or a range of pages."), /** A part of a book having its own title. */ INCOLLECTION("incollection", "A part of a book having its own title."), /** An article in a conference proceedings. */ INPROCEEDINGS("inproceedings", "An article in a conference proceedings."), /** Technical documentation. */ MANUAL("manual", "Technical documentation."), /** A Master's thesis. */ MASTERSTHESIS("mastersthesis", "A Master's thesis."), /** Use this type when nothing else fits. */ MISC("misc", "Use this type when nothing else fits."), /** A PhD thesis. */ PHDTHESIS("phdthesis", "A PhD thesis."), /** The proceedings of a conference. */ PROCEEDINGS("proceedings", "The proceedings of a conference."), /** A report published by a school or other institution, usually numbered within a series. */ TECHREPORT("techreport", "A report published by a school or other institution, usually numbered within a series."), /** A document having an author and title, but not formally published. */ UNPUBLISHED("unpublished", "A document having an author and title, but not formally published."); /** the string used in toString() */ protected String m_Display; /** the comment about this type */ protected String m_Comment; /** * the constructor * * @param display the string to return in toString() * @param comment a comment about the type */ private Type(String display, String comment) { m_Display = display; m_Comment = comment; } /** * returns the display string * * @return the display string */ public String getDisplay() { return m_Display; } /** * returns the comment string * * @return the comment string */ public String getComment() { return m_Comment; } /** * returns the display string of the Type * * @return the display string */ public String toString() { return m_Display; } } /** the possible fields */ public enum Field { /** Usually the address of the publisher or other type of institution. For major publishing houses, van Leunen recommends omitting the information entirely. For small publishers, on the other hand, you can help the reader by giving the complete address. */ ADDRESS("address", "Usually the address of the publisher or other type of institution. For major publishing houses, van Leunen recommends omitting the information entirely. For small publishers, on the other hand, you can help the reader by giving the complete address."), /** An annotation. It is not used by the standard bibliography styles, but may be used by others that produce an annotated bibliography. */ ANNOTE("annote", "An annotation. It is not used by the standard bibliography styles, but may be used by others that produce an annotated bibliography."), /** The name(s) of the author(s), in the format described in the LaTeX book. */ AUTHOR("author", "The name(s) of the author(s), in the format described in the LaTeX book."), /** Title of a book, part of which is being cited. See the LaTeX book for how to type titles. For book entries, use the title field instead. */ BOOKTITLE("booktitle", "Title of a book, part of which is being cited. See the LaTeX book for how to type titles. For book entries, use the title field instead."), /** A chapter (or section or whatever) number. */ CHAPTER("chapter", "A chapter (or section or whatever) number."), /** The database key of the entry being cross referenced. Any fields that are missing from the current record are inherited from the field being cross referenced. */ CROSSREF("crossref", "The database key of the entry being cross referenced. Any fields that are missing from the current record are inherited from the field being cross referenced."), /** The edition of a book---for example, Second''. This should be an ordinal, and should have the first letter capitalized, as shown here; the standard styles convert to lower case when necessary. */ EDITION("edition", "The edition of a book---for example, Second''. This should be an ordinal, and should have the first letter capitalized, as shown here; the standard styles convert to lower case when necessary."), /** Name(s) of editor(s), typed as indicated in the LaTeX book. If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears. */ EDITOR("editor", "Name(s) of editor(s), typed as indicated in the LaTeX book. If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears."), /** How something strange has been published. The first word should be capitalized. */ HOWPUBLISHED("howpublished", "How something strange has been published. The first word should be capitalized."), /** The sponsoring institution of a technical report. */ INSTITUTION("institution", "The sponsoring institution of a technical report."), /** A journal name. Abbreviations are provided for many journals. */ JOURNAL("journal", "A journal name. Abbreviations are provided for many journals."), /** Used for alphabetizing, cross referencing, and creating a label when the author'' information is missing. This field should not be confused with the key that appears in the cite command and at the beginning of the database entry. */ KEY("key", "Used for alphabetizing, cross referencing, and creating a label when the author'' information is missing. This field should not be confused with the key that appears in the cite command and at the beginning of the database entry."), /** The month in which the work was published or, for an unpublished work, in which it was written. You should use the standard three-letter abbreviation, as described in Appendix B.1.3 of the LaTeX book. */ MONTH("month", "The month in which the work was published or, for an unpublished work, in which it was written. You should use the standard three-letter abbreviation, as described in Appendix B.1.3 of the LaTeX book."), /** Any additional information that can help the reader. The first word should be capitalized. */ NOTE("note", "Any additional information that can help the reader. The first word should be capitalized."), /** The number of a journal, magazine, technical report, or of a work in a series. An issue of a journal or magazine is usually identified by its volume and number; the organization that issues a technical report usually gives it a number; and sometimes books are given numbers in a named series. */ NUMBER("number", "The number of a journal, magazine, technical report, or of a work in a series. An issue of a journal or magazine is usually identified by its volume and number; the organization that issues a technical report usually gives it a number; and sometimes books are given numbers in a named series."), /** The organization that sponsors a conference or that publishes a manual. */ ORGANIZATION("organization", "The organization that sponsors a conference or that publishes a manual."), /** One or more page numbers or range of numbers, such as 42--111 or 7,41,73--97 or 43+ (the +' in this last example indicates pages following that don't form a simple range). To make it easier to maintain Scribe-compatible databases, the standard styles convert a single dash (as in 7-33) to the double dash used in TeX to denote number ranges (as in 7--33). */ PAGES("pages", "One or more page numbers or range of numbers, such as 42--111 or 7,41,73--97 or 43+ (the +' in this last example indicates pages following that don't form a simple range). To make it easier to maintain Scribe-compatible databases, the standard styles convert a single dash (as in 7-33) to the double dash used in TeX to denote number ranges (as in 7--33)."), /** The publisher's name. */ PUBLISHER("publisher", "The publisher's name."), /** The name of the school where a thesis was written. */ SCHOOL("school", "The name of the school where a thesis was written."), /** The name of a series or set of books. When citing an entire book, the the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published. */ SERIES("series", "The name of a series or set of books. When citing an entire book, the the title field gives its title and an optional series field gives the name of a series or multi-volume set in which the book is published."), /** The work's title, typed as explained in the LaTeX book. */ TITLE("title", "The work's title, typed as explained in the LaTeX book."), /** The type of a technical report---for example, Research Note''. */ TYPE("type", "The type of a technical report---for example, Research Note''."), /** The volume of a journal or multi-volume book. */ VOLUME("volume", "The volume of a journal or multi-volume book."), /** The year of publication or, for an unpublished work, the year it was written. Generally it should consist of four numerals, such as 1984, although the standard styles can handle any year whose last four nonpunctuation characters are numerals, such as \\hbox{(about 1984)}'. */ YEAR("year", "The year of publication or, for an unpublished work, the year it was written. Generally it should consist of four numerals, such as 1984, although the standard styles can handle any year whose last four nonpunctuation characters are numerals, such as \\hbox{(about 1984)}'."), // other fields /** The authors affiliation. */ AFFILIATION("affiliation", "The authors affiliation."), /** An abstract of the work. */ ABSTRACT("abstract", "An abstract of the work."), /** A Table of Contents. */ CONTENTS("contents", "A Table of Contents "), /** Copyright information. */ COPYRIGHT("copyright", "Copyright information."), /** The International Standard Book Number (10 digits). */ ISBN("ISBN", "The International Standard Book Number (10 digits)."), /** The International Standard Book Number (13 digits). */ ISBN13("ISBN-13", "The International Standard Book Number (13 digits)."), /** The International Standard Serial Number. Used to identify a journal. */ ISSN("ISSN", "The International Standard Serial Number. Used to identify a journal."), /** Key words used for searching or possibly for annotation. */ KEYWORDS("keywords", "Key words used for searching or possibly for annotation."), /** The language the document is in. */ LANGUAGE("language", "The language the document is in."), /** A location associated with the entry, such as the city in which a conference took place. */ LOCATION("location", "A location associated with the entry, such as the city in which a conference took place."), /** The Library of Congress Call Number. I've also seen this as lib-congress. */ LCCN("LCCN", "The Library of Congress Call Number. I've also seen this as lib-congress."), /** The Mathematical Reviews number. */ MRNUMBER("mrnumber", "The Mathematical Reviews number."), /** The price of the document. */ PRICE("price", "The price of the document."), /** The physical dimensions of a work. */ SIZE("size", "The physical dimensions of a work."), /** The WWW Universal Resource Locator that points to the item being referenced. This often is used for technical reports to point to the ftp site where the postscript source of the report is located. */ URL("URL", "The WWW Universal Resource Locator that points to the item being referenced. This often is used for technical reports to point to the ftp site where the postscript source of the report is located."), // additional fields /** A link to a postscript file. */ PS("PS", "A link to a postscript file."), /** A link to a postscript file. */ PDF("PDF", "A link to a PDF file."), /** A link to a postscript file. */ HTTP("HTTP", "A hyperlink to a resource."); /** the string used in toString() */ protected String m_Display; /** the comment about this type */ protected String m_Comment; /** * the constructor * * @param display the string to return in toString() * @param comment a comment about the type */ private Field(String display, String comment) { m_Display = display; m_Comment = comment; } /** * returns the display string * * @return the display string */ public String getDisplay() { return m_Display; } /** * returns the comment string * * @return the comment string */ public String getComment() { return m_Comment; } /** * returns the display string of the Type * * @return the display string */ public String toString() { return m_Display; } } /** will be returned if no ID can be generated */ protected final static String MISSING_ID = "missing_id"; /** the type of this technical information */ protected Type m_Type = null; /** the unique identifier of this information, will be generated * automatically if left empty */ protected String m_ID = ""; /** stores all the values associated with the fields (FIELD - String) */ protected Hashtable m_Values = new Hashtable(); /** additional technical informations */ protected Vector m_Additional = new Vector(); /** * Initializes the information with the given type * * @param type the type of this information * @see Type */ public TechnicalInformation(Type type) { this(type, ""); } /** * Initializes the information with the given type * * @param type the type of this information * @param id the unique ID (for BibTex), can be empty * @see Type */ public TechnicalInformation(Type type, String id) { m_Type = type; m_ID = id; } /** * returns the type of this technical information * * @return the type of this information */ public Type getType() { return m_Type; } /** * splits the authors on the " and " and returns a vector with the names * * @return the authors in an array */ protected String[] getAuthors() { return getValue(Field.AUTHOR).split(" and "); } /** * Generates an ID based on the current settings and returns it. If nothing * can be generated the MISSING_ID string will be returned * * @return the ID * @see #MISSING_ID */ protected String generateID() { String result; String[] authors; String[] parts; result = m_ID; // try surname of first author and year if (result.length() == 0) { if (exists(Field.AUTHOR) && exists(Field.YEAR)) { authors = getAuthors(); if (authors[0].indexOf(",") > -1) { parts = authors[0].split(","); result = parts[0]; } else { parts = authors[0].split(" "); if (parts.length == 1) result = parts[0]; else result = parts[parts.length - 1]; } result += getValue(Field.YEAR); result = result.replaceAll(" ", ""); } } // still nothing? if (result.length() == 0) result = MISSING_ID; return result; } /** * returns the unique ID (either the one used in creating this instance * or the automatically generated one) * * @return the ID for this information */ public String getID() { return generateID(); } /** * sets the value for the given field, overwrites any previously existing one. * * @param field the field to set the value for * @param value the value of the field */ public void setValue(Field field, String value) { m_Values.put(field, value); } /** * returns the value associated with the given field, or empty if field is * not currently stored. * * @param field the field to retrieve the value for * @return the value associated with this field, empty if not existing */ public String getValue(Field field) { if (m_Values.containsKey(field)) return (String) m_Values.get(field); else return ""; } /** * returns TRUE if the field is stored and has a value different from the * empty string. * * @param field the field to check * @return true if a value is stored for the field and non-empty */ public boolean exists(Field field) { return ( m_Values.containsKey(field) && (((String) m_Values.get(field)).length() != 0) ); } /** * returns an enumeration over all the stored fields * * @return all currently stored fields */ public Enumeration fields() { return m_Values.keys(); } /** * returns true if there are further technical informations stored in this * * @return true if there are further technical informations available */ public boolean hasAdditional() { return (m_Additional.size() > 0); } /** * returns an enumeration of all the additional technical informations (if * there are any) * * @return an enumeration over all additional technical informations */ public Enumeration additional() { return m_Additional.elements(); } /** * adds the given information to the list of additional technical * informations * * @param value the information to add */ public void add(TechnicalInformation value) { if (value == this) throw new IllegalArgumentException("Can't add object to itself!"); m_Additional.add(value); } /** * Adds an empty technical information with the given type to the list * of additional informations and returns the instance. * * @param type the type of the new information to add * @return the generated information */ public TechnicalInformation add(Type type) { TechnicalInformation result; result = new TechnicalInformation(type); add(result); return result; } /** * Returns a plain-text string representing this technical information. * Note: it only returns a string based on some fields. At least AUTHOR, * YEAR and TITLE are necessary. * * @return a string representation of this information */ public String toString() { String result; String[] authors; int i; Enumeration enm; result = ""; authors = getAuthors(); // BOOK if (getType() == Type.BOOK) { for (i = 0; i < authors.length; i++) { if (i > 0) result += ", "; result += authors[i]; } if (exists(Field.YEAR)) result += " (" + getValue(Field.YEAR) + ")."; else result += "."; result += " " + getValue(Field.TITLE) + "."; result += " " + getValue(Field.PUBLISHER); if (exists(Field.ADDRESS)) result += ", " + getValue(Field.ADDRESS); result += "."; } // ARTICLE else if (getType() == Type.ARTICLE) { for (i = 0; i < authors.length; i++) { if (i > 0) result += ", "; result += authors[i]; } if (exists(Field.YEAR)) result += " (" + getValue(Field.YEAR) + ")."; else result += "."; result += " " + getValue(Field.TITLE) + "."; // journal if (exists(Field.JOURNAL)) { result += " " + getValue(Field.JOURNAL) + "."; if (exists(Field.VOLUME)) result += " " + getValue(Field.VOLUME); if (exists(Field.NUMBER)) result += "(" + getValue(Field.NUMBER) + ")"; if (exists(Field.PAGES)) result += ":" + getValue(Field.PAGES); result += "."; } // other than JOURNAL??? // URL if (exists(Field.URL)) result += " URL " + getValue(Field.URL) + "."; } // CONFERENCE/INPROCEEDINGS else if ( (getType() == Type.CONFERENCE) || (getType() == Type.INPROCEEDINGS) ) { for (i = 0; i < authors.length; i++) { if (i > 0) result += ", "; result += authors[i]; } result += ": " + getValue(Field.TITLE) + "."; result += " In: " + getValue(Field.BOOKTITLE); if (exists(Field.ADDRESS)) result += ", " + getValue(Field.ADDRESS); if (exists(Field.PAGES)) result += ", " + getValue(Field.PAGES); if (exists(Field.YEAR)) result += ", " + getValue(Field.YEAR) + "."; else result += "."; } // INCOLLECTION else if (getType() == Type.INCOLLECTION) { for (i = 0; i < authors.length; i++) { if (i > 0) result += ", "; result += authors[i]; } result += ": " + getValue(Field.TITLE) + "."; result += " In "; if (exists(Field.EDITOR)) result += getValue(Field.EDITOR) + ", editors, "; result += getValue(Field.BOOKTITLE); if (exists(Field.ADDRESS)) result += ", " + getValue(Field.ADDRESS); if (exists(Field.PAGES)) result += ", " + getValue(Field.PAGES); if (exists(Field.YEAR)) result += ", " + getValue(Field.YEAR) + "."; else result += "."; } // default else { for (i = 0; i < authors.length; i++) { if (i > 0) result += ", "; result += authors[i]; } if (exists(Field.YEAR)) result += " (" + getValue(Field.YEAR) + ")."; else result += "."; result += " " + getValue(Field.TITLE) + "."; if (exists(Field.ADDRESS)) result += " " + getValue(Field.ADDRESS) + "."; if (exists(Field.URL)) result += " URL " + getValue(Field.URL) + "."; } // additional informations? enm = additional(); while (enm.hasMoreElements()) { result += "\n\n" + enm.nextElement().toString(); } return result; } /** * Returns a BibTex string representing this technical information. * Note: this is just a very raw implementation, special characters need to * be escaped manually for LaTeX. * * @return the BibTeX representation of this information */ public String toBibTex() { String result; Enumeration enm; Field field; Vector list; int i; String value; result = "@" + getType() + "{" + getID() + ""; // sort the fields list = new Vector(); enm = fields(); while (enm.hasMoreElements()) list.add(enm.nextElement()); Collections.sort(list); // list field=value pairs for (i = 0; i < list.size(); i++) { field = (Field) list.get(i); if (!exists(field)) continue; value = getValue(field); value = value.replaceAll("\\~", "\\\\~"); result += ",\n " + field + " = {" + value + "}"; } result += "\n}"; // additional informations? enm = additional(); while (enm.hasMoreElements()) { result += "\n\n" + ((TechnicalInformation) enm.nextElement()).toBibTex(); } return result; } /** * Returns the revision string. * * @return the revision */ public String getRevision() { return RevisionUtils.extract("$Revision: 1.11$"); } /** * Prints some examples of technical informations if there are no * commandline options given. Otherwise the information of a given * TechnicalInformationHandler can be printed. <p/> * * Valid options are: <p/> * * -W classname <br/> * The classname of the TechnicalInformationHandler to print the * information for <p/> * * -bibtex <br/> * Print the information in BibTeX format <p/> * * -plaintext <br/> * Print the information in plain text format <p/> * * @param args the commandline options * @throws Exception if the option parsing fails */ public static void main(String[] args) throws Exception { TechnicalInformation info; TechnicalInformation additional; String tmpStr; Class cls; TechnicalInformationHandler handler; // example from command line if (args.length != 0) { info = null; tmpStr = Utils.getOption('W', args); if (tmpStr.length() != 0) { cls = Class.forName(tmpStr); handler = (TechnicalInformationHandler) cls.newInstance(); info = handler.getTechnicalInformation(); } else { throw new IllegalArgumentException("A classname has to be provided with the -W option!"); } if (Utils.getFlag("bibtex", args)) System.out.println("\n" + handler.getClass().getName() + ":\n" + info.toBibTex()); if (Utils.getFlag("plaintext", args)) System.out.println("\n" + handler.getClass().getName() + ":\n" + info.toString()); } else { // first example info = new TechnicalInformation(Type.BOOK); info.setValue(Field.AUTHOR, "Ross Quinlan"); info.setValue(Field.YEAR, "1993"); info.setValue(Field.TITLE, "C4.5: Programs for Machine Learning"); info.setValue(Field.PUBLISHER, "Morgan Kaufmann Publishers"); info.setValue(Field.ADDRESS, "San Mateo, CA"); additional = info; System.out.println("\ntoString():\n" + info.toString()); System.out.println("\ntoBibTex():\n" + info.toBibTex()); // second example info = new TechnicalInformation(Type.INPROCEEDINGS); info.setValue(Field.AUTHOR, "Freund, Y. and Mason, L."); info.setValue(Field.YEAR, "1999"); info.setValue(Field.TITLE, "The alternating decision tree learning algorithm"); info.setValue(Field.BOOKTITLE, "Proceeding of the Sixteenth International Conference on Machine Learning"); info.setValue(Field.ADDRESS, "Bled, Slovenia"); info.setValue(Field.PAGES, "124-133"); System.out.println("\ntoString():\n" + info.toString()); System.out.println("\ntoBibTex():\n" + info.toBibTex()); // third example info = new TechnicalInformation(Type.ARTICLE); info.setValue(Field.AUTHOR, "R. Quinlan"); info.setValue(Field.YEAR, "1986"); info.setValue(Field.TITLE, "Induction of decision trees"); info.setValue(Field.JOURNAL, "Machine Learning"); info.setValue(Field.VOLUME, "1"); info.setValue(Field.NUMBER, "1"); info.setValue(Field.PAGES, "81-106"); additional = new TechnicalInformation(Type.BOOK); additional.setValue(Field.AUTHOR, "Ross Quinlan"); additional.setValue(Field.YEAR, "1993"); additional.setValue(Field.TITLE, "C4.5: Programs for Machine Learning"); additional.setValue(Field.PUBLISHER, "Morgan Kaufmann Publishers"); additional.setValue(Field.ADDRESS, "San Mateo, CA"); info.add(additional); System.out.println("\ntoString():\n" + info.toString()); System.out.println("\ntoBibTex():\n" + info.toBibTex()); } } }

The table below shows all metrics for TechnicalInformation.java.

MetricValueDescription
BLOCKS48.00Number of blocks
BLOCK_COMMENT19.00Number of block comment lines
COMMENT_DENSITY 0.88Comment density
COMPARISONS92.00Number of comparison operators
CYCLOMATIC77.00Cyclomatic complexity
ELOC325.00Effective lines of code
EXITS39.00Procedure exits
FUNCTIONS26.00Number of function declarations
INTERFACE_COMPLEXITY49.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 1.00JAVA0002 Package name does not begin with a top level domain name or country code
JAVA0003 0.00JAVA0003 Minimize use of on-demand (.*) imports
JAVA0004 0.00JAVA0004 Unnecessary import from java.lang
JAVA0005 0.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 0.00JAVA0007 Should not declare public field
JAVA0008 0.00JAVA0008 Empty catch block
JAVA0009 0.00JAVA0009 Protected member in final class
JAVA0010 0.00JAVA0010 Non-instantiable class does not contain a non-private static member
JAVA0011 0.00JAVA0011 Abstract class does not contain an abstract method
JAVA0012 0.00JAVA0012 Non-constructor method with same name as declaring class
JAVA0013 0.00JAVA0013 Non-blank final field is not static
JAVA0014 0.00JAVA0014 Class with only static members has non-private constructor
JAVA0015 0.00JAVA0015 Package class contains public nested type
JAVA0016 0.00JAVA0016 Abstract class contains public constructor
JAVA0017 0.00JAVA0017 Class name does not have required form
JAVA0018 0.00JAVA0018 Method name does not have required form
JAVA0019 0.00JAVA0019 Interface name does not have required form
JAVA0020 0.00JAVA0020 Field name does not have required form
JAVA0021 0.00JAVA0021 Interface method name does not have required form
JAVA0022 0.00JAVA0022 Static final field name does not have required form
JAVA0023 0.00JAVA0023 Empty finalize method
JAVA0024 0.00JAVA0024 Empty class
JAVA0025 0.00JAVA0025 Method override is empty
JAVA0026 0.00JAVA0026 Finalize method with parameters
JAVA0029 0.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 0.00JAVA0031 Case statement not properly closed
JAVA0032 0.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA003436.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 1.00JAVA0036 Missing braces in while statement
JAVA0038 0.00JAVA0038 Non-case label in switch statement
JAVA0039 0.00JAVA0039 Break statement with label
JAVA0040 0.00JAVA0040 Switch statement contains N cases (maximum: M)
JAVA0041 0.00JAVA0041 Nested synchronized block
JAVA0042 0.00JAVA0042 Empty synchronized statement
JAVA0043 0.00JAVA0043 Inner class does not use outer class
JAVA0044 0.00JAVA0044 Serializable class with no instance variables
JAVA0045 0.00JAVA0045 Serializable class with only transient fields
JAVA0046 0.00JAVA0046 Name of class not derived from Exception ends with 'Exception'
JAVA0047 0.00JAVA0047 Serializable class derives from invalid base class
JAVA0048 0.00JAVA0048 Name of class derived from Exception does not end with 'Exception'
JAVA0049 0.00JAVA0049 Nested block at depth N (maximum: M)
JAVA0050 0.00JAVA0050 Class derives from java.lang.Error
JAVA0051 0.00JAVA0051 Class derives from java.lang.RuntimeException
JAVA0052 0.00JAVA0052 Class derives from java.lang.Throwable
JAVA0053 0.00JAVA0053 Unused label
JAVA0054 0.00JAVA0054 Inheritance depth N exceeds maximum M
JAVA0055 0.00JAVA0055 Class should be interface
JAVA0056 0.00JAVA0056 Unnecessary abstract modifier for interface or annotation
JAVA0057 0.00JAVA0057 Unnecessary default constructor
JAVA0058 0.00JAVA0058 Constructor calls super()
JAVA0059 0.00JAVA0059 Method override only calls super()
JAVA0061 0.00JAVA0061 Inaccessible member in anonymous class
JAVA0062 0.00JAVA0062 Public class missing public member or protected constructor
JAVA0063 0.00JAVA0063 Identifier name should not contain '\$'
JAVA0064 0.00JAVA0064 N variations of identifier name (maximum: M)
JAVA0065 0.00JAVA0065 Unnecessary final modifier for method in final class
JAVA0066 0.00JAVA0066 Unnecessary modifier for interface nested type
JAVA0067 0.00JAVA0067 Array descriptor on identifier name
JAVA0068 1.00JAVA0068 Modifiers not declared in recommended order
JAVA0071 0.00JAVA0071 Strings compared with ==
JAVA0073 0.00JAVA0073 Integer division in floating-point context
JAVA0074 0.00JAVA0074 Use of Object.notify()
JAVA0075 0.00JAVA0075 Method parameter hides field
JAVA0076 0.00JAVA0076 Use of magic number
JAVA0077 0.00JAVA0077 Private field not used in declaring class
JAVA0078 0.00JAVA0078 Floating point values compared with ==
JAVA0079 0.00JAVA0079 Use of instance to reference static member
JAVA0080 0.00JAVA0080 Import declaration not used
JAVA0081 0.00JAVA0081 Boolean literal in comparison
JAVA0082 0.00JAVA0082 Unnecessary widening cast
JAVA0083 0.00JAVA0083 Unnecessary instanceof test
JAVA0084 0.00JAVA0084 Should use compound assignment operator
JAVA0085 0.00JAVA0085 Use of sun.* class
JAVA0089 0.00JAVA0089 Use of restricted package
JAVA0092 0.00JAVA0092 Use of restricted type
JAVA0093 0.00JAVA0093 Redundant assignment
JAVA0094 0.00JAVA0094 Field hides a superclass field
JAVA0095 0.00JAVA0095 Uninitialized private field
JAVA0096 0.00JAVA0096 Field in nested class hides outer field
JAVA0098 0.00JAVA0098 Minimize use of implicit field initializers
JAVA0100 0.00JAVA0100 Class contains N non-final fields (maximum: M)
JAVA0101 0.00JAVA0101 Unnecessary modifier for field in interface
JAVA0102 0.00JAVA0102 Last statement in finalize() not super.finalize()
JAVA0103 0.00JAVA0103 Explicit call to finalize()
JAVA0104 0.00JAVA0104 finalize() only calls super.finalize()
JAVA0105 0.00JAVA0105 Duplicate import declaration
JAVA0106 0.00JAVA0106 Unnecessary import from current package
JAVA0108 0.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 0.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 0.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 0.00JAVA0111 Incorrect javadoc: @return tag for void method
JAVA0112 0.00JAVA0112 Incorrect javadoc: no exception 'exception' in throws
JAVA0113 0.00JAVA0113 Incorrect javadoc: no @author tag
JAVA0114 0.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 0.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA0117 0.00JAVA0117 Missing javadoc: method 'method'
JAVA0118 0.00JAVA0118 Missing javadoc: type 'type'
JAVA0119 0.00JAVA0119 Control variable changed within body of for loop
JAVA0123 0.00JAVA0123 Use all three components of for loop
JAVA0125 0.00JAVA0125 Continue statement with label
JAVA0126 0.00JAVA0126 Method declares unchecked exception in throws
JAVA0128 0.00JAVA0128 Public constructor in non-public class
JAVA0130 0.00JAVA0130 Non-static method does not use instance fields
JAVA0131 0.00JAVA0131 Compatible method does not override base
JAVA0132 0.00JAVA0132 Method overload with compatible signature
JAVA0133 0.00JAVA0133 Non-synchronized method overrides synchronized method
JAVA0135 0.00JAVA0135 Only one of Object.equals and Object.hashCode defined: missing 'method'
JAVA0136 0.00JAVA0136 N methods defined in class (maximum: M)
JAVA0137 0.00JAVA0137 Non-abstract class missing constructor
JAVA0138 0.00JAVA0138 N parameters defined for method (maximum: M)
JAVA0139 1.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 0.00JAVA0143 Synchronized method
JAVA014427.00JAVA0144 Line exceeds maximum M characters
JAVA0145145.00JAVA0145 Tab character used in source file
JAVA0150 0.00JAVA0150 java.lang.Error (or subclass) thrown
JAVA0153 0.00JAVA0153 Inefficient conversion of integer to string
JAVA0159 0.00JAVA0159 Inefficient conversion of string to integer
JAVA0160 0.00JAVA0160 Method does not throw specified exception
JAVA0161 0.00JAVA0161 Conditional wait() not in loop
JAVA0163 0.00JAVA0163 Empty statement
JAVA0165 0.00JAVA0165 Conflicting return statement in finally block
JAVA0166 0.00JAVA0166 Generic exception caught
JAVA0169 0.00JAVA0169 Unnecessary catch block: exception 'exception'
JAVA0170 0.00JAVA0170 Caught exception not derived from java.lang.Exception
JAVA0171 0.00JAVA0171 Unused local variable
JAVA0173 0.00JAVA0173 Unused method parameter
JAVA0174 0.00JAVA0174 Assigned local variable never used
JAVA0175 2.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA017719.00JAVA0177 Variable declaration missing initializer
JAVA0179 0.00JAVA0179 Local variable hides visible field
JAVA0233 0.00JAVA0233 Definition of serialVersionUID other than 'private static final long serialVersionUID'
JAVA0234 0.00JAVA0234 Class is Serializable but does not define serialVersionUID
JAVA0235 0.00JAVA0235 Class defines serialVersionUID but does not implement Serializable
JAVA0236 0.00JAVA0236 Attempt to clone an object which does not implement Cloneable
JAVA0237 0.00JAVA0237 Class implements Cloneable but does not have public clone method
JAVA0238 0.00JAVA0238 Clone method does not call super.clone()
JAVA0239 0.00JAVA0239 Class declares 'readObject' or 'writeObject' but does not implement Serializable
JAVA0240 0.00JAVA0240 Serializable class which declares readObject or writeObject but not both
JAVA0241 0.00JAVA0241 'readObject' or 'writeObject' should be declared private in Serializable class
JAVA0242 0.00JAVA0242 Transient field in non-Serializable class
JAVA0243 0.00JAVA0243 'readResolve' or 'writeReplace' should be declared private or protected
JAVA0244 0.00JAVA0244 Field or method name in subclass differs only by case from inherited field or method
JAVA0245 0.00JAVA0245 JUnit TestCase with non-trivial constructor
JAVA0246 0.00JAVA0246 JUnit assertXXX statement missing message parameter
JAVA0247 0.00JAVA0247 JUnit 'setUp()' and 'tearDown()' should call super method
JAVA0248 0.00JAVA0248 JUnit method 'setUp' or 'tearDown' with incorrect signature
JAVA0249 0.00JAVA0249 JUnit TestCase 'suite()' should be declared static
JAVA0250 0.00JAVA0250 JUnit TestCase declares testXXX method with incorrect signature
JAVA0251 0.00JAVA0251 Use '%n' for line breaks in printf/format for platform independence
JAVA0252 0.00JAVA0252 'enum' is a Java 1.5 reserved word
JAVA0253 0.00JAVA0253 Not all enum constants consumed in switch statement
JAVA0254 0.00JAVA0254 Use enhanced for loop construct instead of Iterator
JAVA0255 0.00JAVA0255 Result of method invocation not used
JAVA0256 0.00JAVA0256 Assignment of external collection/array to field
JAVA0257 0.00JAVA0257 Use of 'Constant Interface' anti-pattern
JAVA0258 0.00JAVA0258 Implement Iterable for foreach compatibility
JAVA0259 0.00JAVA0259 Return of collection/array field
JAVA0260 0.00JAVA0260 Use 'enum' instead of Enumerated Type pattern
JAVA0261 0.00JAVA0261 Use specialized Enum collection types
JAVA0262 0.00JAVA0262 Use of char in integer context
JAVA0263 0.00JAVA0263 Long literal ends with 'l' instead of 'L'
JAVA0264 0.00JAVA0264 Integer math in long context - check for overflow
JAVA0265 0.00JAVA0265 Use of Throwable.printStackTrace()
JAVA0266 8.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 0.00JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0271 0.00JAVA0271 Minimize use of on-demand (.*) static imports
JAVA0273 0.00JAVA0273 Non-final derivative of Thread calls start() in constructor
JAVA0274 0.00JAVA0274 Serializable class has a synchronized readObject()
JAVA0275 0.00JAVA0275 Serializable class has a synchronized writeObject() and no other synchronized methods
JAVA0276 0.00JAVA0276 Unnecessary use of String constructor
JAVA0277 0.00JAVA0277 Iterator.next() implementation does not throw NoSuchElementException
JAVA0278 0.00JAVA0278 Unnecessary use of Boolean constructor
JAVA0280 0.00JAVA0280 IllegalMonitorStateException caught
JAVA0281 0.00JAVA0281 Iterator.next() not called in loop
JAVA0282 0.00JAVA0282 Call to Iterator.next() in loop which does not test Iterator.hasNext()
JAVA0283 0.00JAVA0283 Control variable not updated in loop body
JAVA0284 0.00JAVA0284 Explicit garbage collection
JAVA0285 0.00JAVA0285 Dereference of potentially null variable
JAVA0286 0.00JAVA0286 Dereference of null variable
JAVA0287 0.00JAVA0287 Unnecessary null check
JAVA0288 0.00JAVA0288 Inconsistent null check
LINES736.00Number of lines in the source file
LOC376.00Lines of code
LOGICAL_LINES193.00Number of statements
LOOPS 9.00Number of loops
NEST_DEPTH 4.00Maximum nesting depth
OPERANDS1035.00Number of operands
OPERATORS1608.00Number of operators
PARAMS14.00Number of formal parameter declarations