DBZugriff.java

Index Score
de.hattrickorganizer.database
Hattrick Organizer

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
DECL_COMMENTSComments in declarations
DOC_COMMENTNumber of javadoc comment lines
LINE_COMMENTNumber of line comments
COMMENTSComment lines
PARAMSNumber of formal parameter declarations
SIZESize of the file in bytes
FUNCTIONSNumber of function declarations
INTERFACE_COMPLEXITYInterface complexity
EXEC_COMMENTSComments in executable code
EXITSProcedure exits
LINESNumber of lines in the source file
UNIQUE_OPERANDSNumber of unique operands
RETURNSNumber of return points from functions
PROGRAM_VOCABHalstead program vocabulary
OPERANDSNumber of operands
PROGRAM_LENGTHHalstead program length
OPERATORSNumber of operators
ELOCEffective lines of code
CYCLOMATICCyclomatic complexity
BLOCKSNumber of blocks
LOCLines of code
LOGICAL_LINESNumber of statements
JAVA0031JAVA0031 Case statement not properly closed
WHITESPACENumber of whitespace lines
JAVA0145JAVA0145 Tab character used in source file
JAVA0160JAVA0160 Method does not throw specified exception
JAVA0117JAVA0117 Missing javadoc: method 'method'
JAVA0166JAVA0166 Generic exception caught
JAVA0144JAVA0144 Line exceeds maximum M characters
JAVA0270JAVA0270 Use Java 5.0 enhanced for loop construct to iterate over all elements in an array
JAVA0034JAVA0034 Missing braces in if statement
JAVA0108JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0064JAVA0064 N variations of identifier name (maximum: M)
JAVA0109JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0076JAVA0076 Use of magic number
LOOPSNumber of loops
UNIQUE_OPERATORSNumber of unique operators
JAVA0143JAVA0143 Synchronized method
JAVA0111JAVA0111 Incorrect javadoc: @return tag for void method
PROGRAM_VOLUMEHalstead program volume
JAVA0136JAVA0136 N methods defined in class (maximum: M)
JAVA0032JAVA0032 Switch statement missing default
JAVA0174JAVA0174 Assigned local variable never used
JAVA0126JAVA0126 Method declares unchecked exception in throws
JAVA0029JAVA0029 Private method not used
NEST_DEPTHMaximum nesting depth
// %2522043834:de.hattrickorganizer.database% package de.hattrickorganizer.database; import gui.UserParameter; import java.sql.ResultSet; import java.sql.Timestamp; import java.util.Hashtable; import java.util.List; import java.util.Vector; import plugins.IFutureTrainingWeek; import de.hattrickorganizer.gui.HOMainFrame; import de.hattrickorganizer.gui.model.ArenaStatistikTableModel; import de.hattrickorganizer.gui.model.HOColumnModel; import de.hattrickorganizer.model.Aufstellung; import de.hattrickorganizer.model.Basics; import de.hattrickorganizer.model.FactorObject; import de.hattrickorganizer.model.Finanzen; import de.hattrickorganizer.model.HOModel; import de.hattrickorganizer.model.HOParameter; import de.hattrickorganizer.model.Liga; import de.hattrickorganizer.model.Spieler; import de.hattrickorganizer.model.Stadium; import de.hattrickorganizer.model.Team; import de.hattrickorganizer.model.User; import de.hattrickorganizer.model.Verein; import de.hattrickorganizer.model.XtraData; import de.hattrickorganizer.model.matches.MatchKurzInfo; import de.hattrickorganizer.model.matches.MatchLineup; import de.hattrickorganizer.model.matches.MatchLineupPlayer; import de.hattrickorganizer.model.matches.MatchLineupTeam; import de.hattrickorganizer.model.matches.Matchdetails; import de.hattrickorganizer.model.matchlist.Spielplan; import de.hattrickorganizer.tools.HOLogger; import de.hattrickorganizer.tools.backup.BackupDialog; /** * DOCUMENT ME! * * @author tom */ public class DBZugriff { //~ Static fields/initializers ----------------------------------------------------------------- //Datum der TSI Umstellung. Alle Marktwerte der Spieler m¸ssen vor dem Datum durch 1000 geteilt werden (ohne Sprachfaktor) /** TODO Missing Parameter Documentation */ private static final int DBVersion = 7; /** TODO Missing Parameter Documentation 2004-06-14 11:00:00.0 */ public static Timestamp TSIDATE = new Timestamp(1087203600000L); /** singelton */ protected static DBZugriff m_clInstance; //~ Instance fields ---------------------------------------------------------------------------- /** DB-Adapter */ private JDBCAdapter m_clJDBCAdapter = null; //new JDBCAdapter(); private DBAdapter m_clDBAdapter = null; /** all Tables */ private final Hashtable tables = new Hashtable(); /** Erster Start */ private boolean m_bFirstStart; //~ Constructors ------------------------------------------------------------------------------- /** * Creates a new instance of DBZugriff */ private DBZugriff() { m_clJDBCAdapter = new JDBCAdapter(); } //~ Methods ------------------------------------------------------------------------------------ //////////////////////////////////////////////////////////////////////////////// //INSTANCE //////////////////////////////////////////////////////////////////////////////// public static synchronized DBZugriff instance() { if (m_clInstance == null) { //HOLogger.instance().log(getClass(),"TSI: " + TSIDATE); // Create new instance DBZugriff tempInstance = new DBZugriff(); tempInstance.initAllTables(tempInstance.getAdapter()); // Try connecting to the DB try { tempInstance.connect(); } catch (Exception e) { String msg = e.getMessage(); boolean recover = User.getCurrentUser().isHSQLDB(); if (msg.indexOf("The database is already in use by another process") > -1) { msg = "The database is already in use. You have another HO running or the database is still closing, wait and try again"; recover = false; } else { msg = "Fatal DB Error. Exiting HO!\nYou should restore db folder from backup or delete folder."; } javax.swing.JOptionPane.showMessageDialog( null, msg, "Fatal DB Error", javax.swing.JOptionPane.ERROR_MESSAGE); if (recover) { BackupDialog dialog = new BackupDialog(); dialog.setVisible(true); while (dialog.isVisible()) { // wait } } System.exit(-1); } // Does DB already exists? final boolean existsDB = tempInstance.checkIfDBExists(); // What is this for? jailbird. tempInstance.setFirstStart(!existsDB); //final FirstStart firstStart = new FirstStart(tempInstance); // Do we need to create the database from scratch? if (!existsDB) { //firstStart.createAllTables(); tempInstance.createAllTables(); UserConfigurationTable configTable = (UserConfigurationTable) tempInstance.getTable(UserConfigurationTable.TABLENAME); configTable.store(UserParameter.instance()); configTable.store(HOParameter.instance()); } else { //Check if there are any updates on the database to be done. tempInstance.updateDB(); } // Check if there are any config updates // new since 1.401 - flattermann tempInstance.updateConfig(); m_clInstance = tempInstance; } return m_clInstance; } private void initAllTables(JDBCAdapter adapter) { tables.put(BasicsTable.TABLENAME, new BasicsTable(adapter)); tables.put(TeamTable.TABLENAME, new TeamTable(adapter)); tables.put(FaktorenTable.TABLENAME, new FaktorenTable(adapter)); tables.put(PositionenTable.TABLENAME, new PositionenTable(adapter)); tables.put(AufstellungTable.TABLENAME, new AufstellungTable(adapter)); tables.put(HRFTable.TABLENAME, new HRFTable(adapter)); tables.put(StadionTable.TABLENAME, new StadionTable(adapter)); tables.put(VereinTable.TABLENAME, new VereinTable(adapter)); tables.put(LigaTable.TABLENAME, new LigaTable(adapter)); tables.put(SpielerTable.TABLENAME, new SpielerTable(adapter)); tables.put(FinanzenTable.TABLENAME, new FinanzenTable(adapter)); tables.put(ScoutTable.TABLENAME, new ScoutTable(adapter)); tables.put(UserColumnsTable.TABLENAME, new UserColumnsTable(adapter)); tables.put(SpielerNotizenTable.TABLENAME, new SpielerNotizenTable(adapter)); tables.put(SpielplanTable.TABLENAME, new SpielplanTable(adapter)); tables.put(PaarungTable.TABLENAME, new PaarungTable(adapter)); tables.put(MatchLineupTeamTable.TABLENAME, new MatchLineupTeamTable(adapter)); tables.put(MatchLineupTable.TABLENAME, new MatchLineupTable(adapter)); tables.put(XtraDataTable.TABLENAME, new XtraDataTable(adapter)); tables.put(MatchLineupPlayerTable.TABLENAME, new MatchLineupPlayerTable(adapter)); tables.put(MatchesKurzInfoTable.TABLENAME, new MatchesKurzInfoTable(adapter)); tables.put(MatchDetailsTable.TABLENAME, new MatchDetailsTable(adapter)); tables.put(MatchHighlightsTable.TABLENAME, new MatchHighlightsTable(adapter)); tables.put(TrainingsTable.TABLENAME, new TrainingsTable(adapter)); tables.put(FutureTrainingTable.TABLENAME, new FutureTrainingTable(adapter)); tables.put(UserConfigurationTable.TABLENAME, new UserConfigurationTable(adapter)); tables.put(SpielerSkillupTable.TABLENAME, new SpielerSkillupTable(adapter)); } protected AbstractTable getTable(String tableName) { return (AbstractTable) tables.get(tableName); } //Accessor public JDBCAdapter getAdapter() { return m_clJDBCAdapter; } /** * Get an DBAdapter instance (lazy initialisation). * @return an DBAdapter instance */ public DBAdapter getDBAdapter() { if (m_clDBAdapter == null) { m_clDBAdapter = new DBAdapter(); } return m_clDBAdapter; } /** * Set First start flag */ private void setFirstStart(boolean firststart) { m_bFirstStart = firststart; } /** * TODO Missing Method Documentation * * @return TODO Missing Return Method Documentation */ public boolean isFirstStart() { return m_bFirstStart; } /** * trennt die Verbindung zur Datenbank */ public void disconnect() { m_clJDBCAdapter.disconnect(); m_clJDBCAdapter = null; m_clInstance = null; } /** * stellt die Verbindung zur DB her * * @return TODO Missing Return Method Documentation */ protected void connect() throws Exception { User user = User.getCurrentUser(); m_clJDBCAdapter.connect(user.getUrl(), user.getUser(), user.getPwd(), user.getDriver()); } /** * check if tables in DB exists * * @return boolean */ private boolean checkIfDBExists() { if (m_clJDBCAdapter.executeQuery("SELECT * FROM HRF WHERE 1=2") == null) { return false; } return true; } // ------------------------------- SpielerSkillupTable ------------------------------------------------- /** * liefert das Datum des letzen Levelups anhand key und value * * @param key Name des Skills * @param value Wert des Skills Vor dem LevelUp * @param spielerId TODO Missing Constructuor Parameter Documentation * * @return [0] = Time der ƒnderung [1] = Boolean: false=Keine ƒnderung gefunden */ public Object[] getLastLevelUp(int skill, int spielerId) { return ((SpielerSkillupTable) getTable(SpielerSkillupTable.TABLENAME)).getLastLevelUp( skill, spielerId); } /** * liefert das Datum des letzen LevelAufstiegs f¸r den angeforderten Skill Vector filled with * Skillup Objects * * @param skill TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Vector getAllLevelUp(int skill, int m_iSpielerID) { return ((SpielerSkillupTable) getTable(SpielerSkillupTable.TABLENAME)).getAllLevelUp( skill, m_iSpielerID); } public void saveSkillup(int hrfId, Timestamp datum, int m_iSpielerID, int skill, int value) { ((SpielerSkillupTable) getTable(SpielerSkillupTable.TABLENAME)).saveSkillup( hrfId, m_iSpielerID, datum, skill, value); } public void reimportSkillup() { ((SpielerSkillupTable) getTable(SpielerSkillupTable.TABLENAME)).importFromSpieler(); } public void checkSkillup(HOModel homodel) { ((SpielerSkillupTable) getTable(SpielerSkillupTable.TABLENAME)).importNewSkillup(homodel); } // ------------------------------- SpielerTable ------------------------------------------------- /** * gibt alle Spieler zur¸ck, auch ehemalige * * @return TODO Missing Return Method Documentation */ public Vector getAllSpieler() { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getAllSpieler(); } /** * Gibt die letzte Bewertung f¸r den Spieler zur¸ck // HRF * * @param spielerid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public int getLetzteBewertung4Spieler(int spielerid) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getLetzteBewertung4Spieler( spielerid); } /** * l‰dt die Spieler zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Vector getSpieler(int hrfID) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getSpieler(hrfID); } /** * Gibt einen Spieler zur¸ck mit den Daten kurz vor dem Timestamp * * @param spielerid TODO Missing Constructuor Parameter Documentation * @param time TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Spieler getSpielerAtDate(int spielerid, Timestamp time) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getSpielerAtDate(spielerid, time); } /** * * @param time * @param spielerid * @return */ public Spieler getSpielerBeforeDate(Timestamp time, int spielerid) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getSpielerBeforeDate( time, spielerid); } /** * Gibt einen Spieler zur¸ck aus dem ersten HRF * * @param spielerid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Spieler getSpielerFirstHRF(int spielerid) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getSpielerFirstHRF(spielerid); } /** * Gibt das Datum des ersten HRFs zur¸ck, in dem der Spieler aufgetaucht ist * * @param spielerid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Timestamp getTimestamp4FirstPlayerHRF(int spielerid) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getTimestamp4FirstPlayerHRF( spielerid); } /** * Returns the trainer code for the specified hrf. -99 if error * @param hrfID HRF for which to load TrainerType * @return */ public int getTrainerType(int hrfID) { return ((SpielerTable) getTable(SpielerTable.TABLENAME)).getTrainerType(hrfID); } /** * speichert die Spieler * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param spieler TODO Missing Constructuor Parameter Documentation * @param date TODO Missing Constructuor Parameter Documentation */ public void saveSpieler(int hrfId, Vector spieler, Timestamp date) { ((SpielerTable) getTable(SpielerTable.TABLENAME)).saveSpieler(hrfId, spieler, date); } // ------------------------------- LigaTable ------------------------------------------------- /** * Gibt alle bekannten Ligaids zur¸ck * * @return TODO Missing Return Method Documentation */ public Integer[] getAllLigaIDs() { return ((LigaTable) getTable(LigaTable.TABLENAME)).getAllLigaIDs(); } /** * l‰dt die Basics zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Liga getLiga(int hrfID) { return ((LigaTable) getTable(LigaTable.TABLENAME)).getLiga(hrfID); } /** * speichert die Basdics * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param liga TODO Missing Constructuor Parameter Documentation */ public void saveLiga(int hrfId, Liga liga) { ((LigaTable) getTable(LigaTable.TABLENAME)).saveLiga(hrfId, liga); } // ------------------------------- SpielplanTable ------------------------------------------------- /** * Gibt eine Ligaid zu einer Seasonid zur¸ck, oder -1, wenn kein Eintrag in der DB gefunden * wurde * * @param seasonid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public int getLigaID4SaisonID(int seasonid) { return ((SpielplanTable) getTable(SpielplanTable.TABLENAME)).getLigaID4SaisonID(seasonid); } /** * holt einen Spielplan aus der DB, -1 bei den params holt den zuletzt gesavten Spielplan * * @param ligaId Id der Liga * @param saison die Saison * * @return TODO Missing Return Method Documentation */ public Spielplan getSpielplan(int ligaId, int saison) { return ((SpielplanTable) getTable(SpielplanTable.TABLENAME)).getSpielplan(ligaId, saison); } /** * speichert einen Spielplan mitsamt Paarungen * * @param plan TODO Missing Constructuor Parameter Documentation */ public void storeSpielplan(Spielplan plan) { ((SpielplanTable) getTable(SpielplanTable.TABLENAME)).storeSpielplan(plan); } /** * TODO Missing Method Documentation * * @param whereSpalten TODO Missing Method Parameter Documentation * @param whereValues TODO Missing Method Parameter Documentation */ public void deleteSpielplanTabelle(String[] whereSpalten, String[] whereValues) { getTable(SpielplanTable.TABLENAME).delete(whereSpalten, whereValues); } /** * l‰dt alle Spielpl‰ne aus der DB * * @param mitPaarungen inklusive der Paarungen ja/nein * * @return TODO Missing Return Method Documentation */ public Spielplan[] getAllSpielplaene(boolean mitPaarungen) { return ((SpielplanTable) getTable(SpielplanTable.TABLENAME)).getAllSpielplaene( mitPaarungen); } // ------------------------------- MatchLineupPlayerTable ------------------------------------------------- /** * Gibt eine Liste an Ratings zur¸ck, auf denen der Spieler gespielt hat: 0 = Max 1 = Min 2 = * Durchschnitt 3 = posid * * @param spielerid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Vector getAlleBewertungen(int spielerid) { return ( (MatchLineupPlayerTable) getTable( MatchLineupPlayerTable.TABLENAME)).getAlleBewertungen( spielerid); } /** * Gibt die beste, schlechteste und durchschnittliche Bewertung f¸r den Spieler, sowie die * Anzahl der Bewertungen zur¸ck // Match * * @param spielerid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public float[] getBewertungen4Player(int spielerid) { return ( (MatchLineupPlayerTable) getTable( MatchLineupPlayerTable.TABLENAME)).getBewertungen4Player( spielerid); } /** * Gibt die beste, schlechteste und durchschnittliche Bewertung f¸r den Spieler, sowie die * Anzahl der Bewertungen zur¸ck // Match * * @param spielerid Spielerid * @param position Usere positionscodierung mit taktik * * @return TODO Missing Return Method Documentation */ public float[] getBewertungen4PlayerUndPosition(int spielerid, byte position) { return ( (MatchLineupPlayerTable) getTable( MatchLineupPlayerTable.TABLENAME)).getBewertungen4PlayerUndPosition( spielerid, position); } /** * TODO Missing Method Documentation * * @param matchID TODO Missing Method Parameter Documentation * @param teamID TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Vector getMatchLineupPlayers(int matchID, int teamID) { return ( (MatchLineupPlayerTable) getTable( MatchLineupPlayerTable.TABLENAME)).getMatchLineupPlayers( matchID, teamID); } /** * TODO Missing Method Documentation * * @param player TODO Missing Method Parameter Documentation * @param matchID TODO Missing Method Parameter Documentation * @param teamID TODO Missing Method Parameter Documentation */ protected void storeMatchLineupPlayer(MatchLineupPlayer player, int matchID, int teamID) { ( (MatchLineupPlayerTable) getTable( MatchLineupPlayerTable.TABLENAME)).storeMatchLineupPlayer( player, matchID, teamID); } // ------------------------------- AufstellungTable ------------------------------------------------- /** * l‰dt System Positionen * * @param hrfID TODO Missing Constructuor Parameter Documentation * @param name TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Aufstellung getAufstellung(int hrfID, String name) { return ((AufstellungTable) getTable(AufstellungTable.TABLENAME)).getAufstellung( hrfID, name); } /** * gibt liste f¸r Aufstellungen * * @param hrfID -1 f¸r default = hrf unabh‰ngig * * @return TODO Missing Return Method Documentation */ public Vector getAufstellungsListe(int hrfID) { return ((AufstellungTable) getTable(AufstellungTable.TABLENAME)).getAufstellungsListe( hrfID); } /** * Gibt eine Liste aller Usergespeicherten Aufstellungsnamen zur¸ck * * @return TODO Missing Return Method Documentation */ public Vector getUserAufstellungsListe() { return ((AufstellungTable) getTable(AufstellungTable.TABLENAME)).getUserAufstellungsListe(); } /** * speichert die Aufstellung und die aktuelle Aufstellung als STANDARD * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param aufstellung TODO Missing Constructuor Parameter Documentation * @param name TODO Missing Constructuor Parameter Documentation */ public void saveAufstellung(int hrfId, Aufstellung aufstellung, String name) { ((AufstellungTable) getTable(AufstellungTable.TABLENAME)).saveAufstellung( hrfId, aufstellung, name); } // ------------------------------- BasicsTable ------------------------------------------------- /** * l‰dt die Basics zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Basics getBasics(int hrfID) { return ((BasicsTable) getTable(BasicsTable.TABLENAME)).getBasics(hrfID); } /** * Gibt eine Vector mit HRF-CBItems zur¸ck * * @param datum from which hrf has to be returned, used to load a subset of hrf * * @return TODO Missing Return Method Documentation */ public java.util.Vector getCBItemHRFListe(Timestamp datum) { return ((BasicsTable) getTable(BasicsTable.TABLENAME)).getCBItemHRFListe(datum); } /** * Returns an HRF before the matchData and after previous TrainingTime * @param timestamp matchData * @return hrfId */ public int getHrfIDSameTraining(Timestamp matchTime) { return ((BasicsTable) getTable(BasicsTable.TABLENAME)).getHrfIDSameTraining(matchTime); } /** * speichert die Basdics * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param basics TODO Missing Constructuor Parameter Documentation */ public void saveBasics(int hrfId, de.hattrickorganizer.model.Basics basics) { ((BasicsTable) getTable(BasicsTable.TABLENAME)).saveBasics(hrfId, basics); } // ------------------------------- FaktorenTable ------------------------------------------------- /** * TODO Missing Method Documentation * * @param fo TODO Missing Method Parameter Documentation */ public void setFaktorenFromDB(FactorObject fo) { ((FaktorenTable) getTable(FaktorenTable.TABLENAME)).setFaktorenFromDB(fo); } /** * TODO Missing Method Documentation * * @param fo TODO Missing Method Parameter Documentation */ public void getFaktorenFromDB() { ((FaktorenTable) getTable(FaktorenTable.TABLENAME)).getFaktorenFromDB(); } // ------------------------------- FinanzenTable ------------------------------------------------- /** * l‰dt die Finanzen zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Finanzen getFinanzen(int hrfID) { return ((FinanzenTable) getTable(FinanzenTable.TABLENAME)).getFinanzen(hrfID); } /** * speichert die Finanzen * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param finanzen TODO Missing Constructuor Parameter Documentation * @param date TODO Missing Constructuor Parameter Documentation */ public void saveFinanzen(int hrfId, Finanzen finanzen, Timestamp date) { ((FinanzenTable) getTable(FinanzenTable.TABLENAME)).saveFinanzen(hrfId, finanzen, date); } // ------------------------------- HRFTable ------------------------------------------------- /** * liefert die aktuelle Id des neuesten HRF-Files * * @return TODO Missing Return Method Documentation */ public int getMaxHrfId() { return ((HRFTable) getTable(HRFTable.TABLENAME)).getMaxHrf().getHrfId(); } /** * liefert die Maximal Vergebene Id eines HRF-Files * * @return TODO Missing Return Method Documentation */ public int getLatestHrfId() { return ((HRFTable) getTable(HRFTable.TABLENAME)).getLatestHrf().getHrfId(); } /** * Sucht das letzte HRF zwischen dem angegebenen Datum und 6 Tagen davor Wird kein HRF gefunden * wird -1 zur¸ckgegeben * * @param hrfId TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public int getPreviousHRF(int hrfId) { return ((HRFTable) getTable(HRFTable.TABLENAME)).getPreviousHRF(hrfId); } /** * Sucht das letzte HRF zwischen dem angegebenen Datum und 6 Tagen davor Wird kein HRF gefunden * wird -1 zur¸ckgegeben * * @param hrfId TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public int getFollowingHRF(int hrfId) { return ((HRFTable) getTable(HRFTable.TABLENAME)).getFollowingHRF(hrfId); } /** * speichert das Verein * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param name TODO Missing Constructuor Parameter Documentation * @param datum TODO Missing Constructuor Parameter Documentation */ public void saveHRF(int hrfId, String name, Timestamp datum) { ((HRFTable) getTable(HRFTable.TABLENAME)).saveHRF(hrfId, name, datum); } /** * */ public int getHRFID4Date(Timestamp time) { return ((HRFTable) getTable(HRFTable.TABLENAME)).getHrfId4Date(time); } /** * gibt es ein HRFFile in der Datenbank mit dem gleichen Dateimodifieddatum schon? * * @param date der letzten Datei‰nderung der zu vergleichenden Datei * * @return Das Datum der Datei, an den die Datei importiert wurde oder null, wenn keine * passende Datei vorhanden ist */ public String getHRFName4Date(Timestamp date) { return ((HRFTable) getTable(HRFTable.TABLENAME)).getHrfName4Date(date); } // ------------------------------- SpielerNotizenTable ------------------------------------------------- /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public String getManuellerSmilie(int spielerId) { return ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).getManuellerSmilie( spielerId); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public String getTeamInfoSmilie(int spielerId) { return ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).getTeamInfoSmilie( spielerId); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public String getSpielerNotiz(int spielerId) { return ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).getSpielerNotiz( spielerId); } public boolean getSpielerSpielberechtigt(int spielerId) { return ( (SpielerNotizenTable) getTable( SpielerNotizenTable.TABLENAME)).getSpielerSpielberechtigt( spielerId); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public byte getSpielerUserPosFlag(int spielerId) { return ( (SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).getSpielerUserPosFlag( spielerId); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * @param smilie TODO Missing Method Parameter Documentation */ public void saveManuellerSmilie(int spielerId, String smilie) { ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).saveManuellerSmilie( spielerId, smilie); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * @param notiz TODO Missing Method Parameter Documentation */ public void saveSpielerNotiz(int spielerId, String notiz) { ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).saveSpielerNotiz( spielerId, notiz); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * @param spielberechtigt TODO Missing Method Parameter Documentation */ public void saveSpielerSpielberechtigt(int spielerId, boolean spielberechtigt) { ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).saveSpielerSpielberechtigt( spielerId, spielberechtigt); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * @param flag TODO Missing Method Parameter Documentation */ public void saveSpielerUserPosFlag(int spielerId, byte flag) { ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).saveSpielerUserPosFlag( spielerId, flag); } /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * @param smilie TODO Missing Method Parameter Documentation */ public void saveTeamInfoSmilie(int spielerId, String smilie) { ((SpielerNotizenTable) getTable(SpielerNotizenTable.TABLENAME)).saveTeamInfoSmilie( spielerId, smilie); } // ------------------------------- MatchLineupTable ------------------------------------------------- /** * TODO Missing Method Documentation * * @param matchID TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public MatchLineup getMatchLineup(int matchID) { return ((MatchLineupTable) getTable(MatchLineupTable.TABLENAME)).getMatchLineup(matchID); } /** * Ist das Match schon in der Datenbank vorhanden? * * @param matchid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public boolean isMatchLineupVorhanden(int matchid) { return ((MatchLineupTable) getTable(MatchLineupTable.TABLENAME)).isMatchLineupVorhanden( matchid); } /** * speichert ein Matchlineup * * @param lineup TODO Missing Constructuor Parameter Documentation */ public void storeMatchLineup(MatchLineup lineup) { ((MatchLineupTable) getTable(MatchLineupTable.TABLENAME)).storeMatchLineup(lineup); } // ------------------------------- MatchesKurzInfoTable ------------------------------------------------- /** * Ist das Match schon in der Datenbank vorhanden? * * @param matchid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public boolean isMatchVorhanden(int matchid) { return ((MatchesKurzInfoTable) getTable(MatchesKurzInfoTable.TABLENAME)).isMatchVorhanden( matchid); } /** * holt die MAtches zu einem Team aus der DB * * @param teamId Die Teamid oder -1 f¸r alle * * @return TODO Missing Return Method Documentation */ public MatchKurzInfo[] getMatchesKurzInfo(int teamId) { return ( (MatchesKurzInfoTable) getTable(MatchesKurzInfoTable.TABLENAME)).getMatchesKurzInfo( teamId); } /** * Wichtig: Wenn die Teamid = -1 ist muss der Matchtyp ALLE_SPIELE sein! * * @param teamId Die Teamid oder -1 f¸r alle * @param matchtyp Welche Matches? Konstanten im SpielePanel! * @param asc TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public MatchKurzInfo[] getMatchesKurzInfo(int teamId, int matchtyp, boolean asc) { return ( (MatchesKurzInfoTable) getTable(MatchesKurzInfoTable.TABLENAME)).getMatchesKurzInfo( teamId, matchtyp, asc); } /** * speichert die Matches * * @param matches TODO Missing Constructuor Parameter Documentation */ public void storeMatchKurzInfos(MatchKurzInfo[] matches) { ((MatchesKurzInfoTable) getTable(MatchesKurzInfoTable.TABLENAME)).storeMatchKurzInfos( matches); } // ------------------------------- ScoutTable ------------------------------------------------- /** * Load player list for insertion into TransferScout * * @return TODO Missing Return Method Documentation */ public Vector getScoutList() { return ((ScoutTable) getTable(ScoutTable.TABLENAME)).getScoutList(); } /** * Save players from TransferScout * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param list TODO Missing Constructuor Parameter Documentation */ public void saveScoutList(Vector list) { ((ScoutTable) getTable(ScoutTable.TABLENAME)).saveScoutList(list); } // ------------------------------- StadionTable ------------------------------------------------- /** * l‰dt die Finanzen zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Stadium getStadion(int hrfID) { return ((StadionTable) getTable(StadionTable.TABLENAME)).getStadion(hrfID); } /** * speichert die Finanzen * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param stadion TODO Missing Constructuor Parameter Documentation */ public void saveStadion(int hrfId, de.hattrickorganizer.model.Stadium stadion) { ((StadionTable) getTable(StadionTable.TABLENAME)).saveStadion(hrfId, stadion); } // ------------------------------- TeamTable ------------------------------------------------- /** * Gibt die Teamstimmung und das Selbstvertrauen f¸r ein HRFID zur¸ck [0] = Stimmung [1] = * Selbstvertrauen * * @param hrfid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public String[] getStimmmungSelbstvertrauen(int hrfid) { return ((TeamTable) getTable(TeamTable.TABLENAME)).getStimmmungSelbstvertrauen(hrfid); } /** * Gibt die Teamstimmung und das Selbstvertrauen f¸r ein HRFID zur¸ck [0] = Stimmung [1] = * Selbstvertrauen * * @param hrfid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public int[] getStimmmungSelbstvertrauenValues(int hrfid) { return ((TeamTable) getTable(TeamTable.TABLENAME)).getStimmmungSelbstvertrauenValues(hrfid); } /** * l‰dt die Basics zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Team getTeam(int hrfID) { return ((TeamTable) getTable(TeamTable.TABLENAME)).getTeam(hrfID); } /** * speichert das Team * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param team TODO Missing Constructuor Parameter Documentation */ public void saveTeam(int hrfId, Team team) { ((TeamTable) getTable(TeamTable.TABLENAME)).saveTeam(hrfId, team); } // ------------------------------- PositionenTable ------------------------------------------------- /** * l‰dt System Positionen * * @param hrfID TODO Missing Constructuor Parameter Documentation * @param sysName TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Vector getSystemPositionen(int hrfID, String sysName) { return ((PositionenTable) getTable(PositionenTable.TABLENAME)).getSystemPositionen( hrfID, sysName); } /** * speichert System Positionen * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param positionen TODO Missing Constructuor Parameter Documentation * @param sysName TODO Missing Constructuor Parameter Documentation */ public void saveSystemPositionen(int hrfId, Vector positionen, String sysName) { ((PositionenTable) getTable(PositionenTable.TABLENAME)).saveSystemPositionen( hrfId, positionen, sysName); } /** * delete das System * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param sysName TODO Missing Constructuor Parameter Documentation */ public void deleteSystem(int hrfId, String sysName) { final String[] whereS = { "Aufstellungsname", "HRF_ID" }; final String[] whereV = { "'" + sysName + "'", "" + hrfId }; //erst vorhandene eintr‰ge f¸r diesen Posnamen entfernen getTable(PositionenTable.TABLENAME).delete(whereS, whereV); } // ------------------------------- TrainingsTable ------------------------------------------------- /** * TODO Missing Method Documentation * * @return TODO Missing Return Method Documentation */ public java.util.Vector getTrainingsVector() { return ((TrainingsTable) getTable(TrainingsTable.TABLENAME)).getTrainingsVector(); } /** * TODO Missing Method Documentation * * @param training TODO Missing Method Parameter Documentation */ public void saveTraining(de.hattrickorganizer.model.TrainingPerWeek training) { ((TrainingsTable) getTable(TrainingsTable.TABLENAME)).saveTraining(training); } // ------------------------------- FutureTrainingTable ------------------------------------------------- public List getFutureTrainingsVector() { return ((FutureTrainingTable) getTable(FutureTrainingTable.TABLENAME)) .getFutureTrainingsVector(); } /** * TODO Missing Method Documentation * * @param training TODO Missing Method Parameter Documentation */ public void saveFutureTraining(IFutureTrainingWeek training) { ((FutureTrainingTable) getTable(FutureTrainingTable.TABLENAME)).saveFutureTraining( training); } // ------------------------------- VereinTable ------------------------------------------------- /** * l‰dt die Basics zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Verein getVerein(int hrfID) { return ((VereinTable) getTable(VereinTable.TABLENAME)).getVerein(hrfID); } /** * speichert das Verein * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param verein TODO Missing Constructuor Parameter Documentation */ public void saveVerein(int hrfId, Verein verein) { ((VereinTable) getTable(VereinTable.TABLENAME)).saveVerein(hrfId, verein); } // ------------------------------- XtraDataTable ------------------------------------------------- /** * l‰dt die Basics zum angegeben HRF file ein * * @param hrfID TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public XtraData getXtraDaten(int hrfID) { return ((XtraDataTable) getTable(XtraDataTable.TABLENAME)).getXtraDaten(hrfID); } /** * speichert das Team * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param xtra TODO Missing Constructuor Parameter Documentation */ public void saveXtraDaten(int hrfId, XtraData xtra) { ((XtraDataTable) getTable(XtraDataTable.TABLENAME)).saveXtraDaten(hrfId, xtra); } // ------------------------------- MatchLineupTeamTable ------------------------------------------------- /** * TODO Missing Method Documentation * * @param matchID TODO Missing Method Parameter Documentation * @param teamID TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ protected MatchLineupTeam getMatchLineupTeam(int matchID, int teamID) { return ( (MatchLineupTeamTable) getTable(MatchLineupTeamTable.TABLENAME)).getMatchLineupTeam( matchID, teamID); } /** * TODO Missing Method Documentation * * @param team TODO Missing Method Parameter Documentation * @param matchID TODO Missing Method Parameter Documentation */ protected void storeMatchLineupTeam(MatchLineupTeam team, int matchID) { ((MatchLineupTeamTable) getTable(MatchLineupTeamTable.TABLENAME)).storeMatchLineupTeam( team, matchID); } // ------------------------------- UserParameterTable ------------------------------------------------- /** * Speichert die Spaltenreihenfolge der Tabellen private void saveTabellenSpaltenReihenfolge( * int[][] spieleruebersicht, int[][] aufstellung ) {} */ /** * L‰dt die UserParameter direkt in das UserParameter-SingeltonObjekt */ public void loadUserParameter() { UserConfigurationTable table = (UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME); table.load(UserParameter.instance()); table.load(HOParameter.instance()); } /** * Speichert die UserParameter in der Datenbank * */ public void saveUserParameter() { UserConfigurationTable table = (UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME); table.store(UserParameter.instance()); table.store(HOParameter.instance()); } // ------------------------------- PaarungTable ------------------------------------------------- /** * holt die Paarungen zum Plan aus der DB und added sie * * @param plan TODO Missing Constructuor Parameter Documentation */ protected void getPaarungen(Spielplan plan) { ((PaarungTable) getTable(PaarungTable.TABLENAME)).getPaarungen(plan); } /** * speichert die Paarungen zu einem Spielplan * * @param paarungen TODO Missing Constructuor Parameter Documentation * @param ligaId TODO Missing Constructuor Parameter Documentation * @param saison TODO Missing Constructuor Parameter Documentation */ protected void storePaarung(Vector paarungen, int ligaId, int saison) { ((PaarungTable) getTable(PaarungTable.TABLENAME)).storePaarung(paarungen, ligaId, saison); } /** * TODO Missing Method Documentation * * @param whereSpalten TODO Missing Method Parameter Documentation * @param whereValues TODO Missing Method Parameter Documentation */ public void deletePaarungTabelle(String[] whereSpalten, String[] whereValues) { getTable(PaarungTable.TABLENAME).delete(whereSpalten, whereValues); } // ------------------------------- MatchDetailsTable ------------------------------------------------- /** * Gibt die MatchDetails zu einem Match zur¸ck * * @param matchId TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Matchdetails getMatchDetails(int matchId) { return ((MatchDetailsTable) getTable(MatchDetailsTable.TABLENAME)).getMatchDetails(matchId); } /** * speichert die MatchDetails * * @param details TODO Missing Constructuor Parameter Documentation */ public void storeMatchDetails(Matchdetails details) { ((MatchDetailsTable) getTable(MatchDetailsTable.TABLENAME)).storeMatchDetails(details); } // ------------------------------- MatchHighlightsTable ------------------------------------------------- /** * Gibt die MatchHighlights zu einem Match zur¸ck * * @param matchId TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ protected Vector getMatchHighlights(int matchId) { return ( (MatchHighlightsTable) getTable(MatchHighlightsTable.TABLENAME)).getMatchHighlights( matchId); } /** * Speichert die Highlights zu einem Spiel * * @param details TODO Missing Constructuor Parameter Documentation */ protected void storeMatchHighlights(Matchdetails details) { ((MatchHighlightsTable) getTable(MatchHighlightsTable.TABLENAME)).storeMatchHighlights( details); } // -------------------------------------------------------------------------------- // -------------------------------- Statistik Part -------------------------------- // -------------------------------------------------------------------------------- /** * TODO Missing Method Documentation * * @param spielerId TODO Missing Method Parameter Documentation * @param anzahlHRF TODO Missing Method Parameter Documentation * * @return TODO Missing Return Method Documentation */ public double[][] getSpielerDaten4Statistik(int spielerId, int anzahlHRF) { return StatisticQuery.getSpielerDaten4Statistik(spielerId,anzahlHRF); } public double[][] getFinanzen4Statistik(int anzahlHRF) { return StatisticQuery.getFinanzen4Statistik(anzahlHRF); } public double[][] getSpielerFinanzDaten4Statistik(int spielerId, int anzahlHRF) { return StatisticQuery.getSpielerFinanzDaten4Statistik(spielerId,anzahlHRF); } public ArenaStatistikTableModel getArenaStatistikModel(int matchtyp) { return StatisticQuery.getArenaStatistikModel(matchtyp); } public double[][] getDurchschnittlicheSpielerDaten4Statistik(int anzahlHRF, String group) { return StatisticQuery.getDurchschnittlicheSpielerDaten4Statistik(anzahlHRF,group); } // --------------------------------- TODO --------------------------- /** * Sucht das letzte HRF zwischen dem angegebenen Datum und 6 Tagen davor Wird kein HRF gefunden * wird -1 zur¸ckgegeben * * @param hrfId TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Timestamp getPreviousTrainingDate(int hrfId) { String sql = "select trainingdate from HRF, XTRADATA where HRF.hrf_id=XTRADATA.hrf_id and trainingdate < (select trainingdate from XTRADATA where hrf_id=" + hrfId + ") order by datum desc limit 1"; final ResultSet rs = m_clJDBCAdapter.executeQuery(sql); try { if (rs != null) { if (rs.first()) { return rs.getTimestamp("trainingdate"); } } } catch (Exception e) { HOLogger.instance().log( getClass(), "DBZugriff.getPreviousTrainingDate: " + e.toString()); } return null; } /** * Gibt eine Liste mit SpielerMatchCBItems zu den einzelnen Matches zur¸ck * * @param spielerid TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public Vector getSpieler4Matches(int spielerid) { final Vector spielerMatchCBItems = new Vector(); //Liste aller Matchplayer mit der spielerid holen try { final Vector tempSpielerMatchCBItems = new Vector(); final String sql = "SELECT DISTINCT MATCHLINEUPPLAYER.MatchID, MATCHLINEUPPLAYER.MatchID, MATCHLINEUPPLAYER.Rating, MATCHLINEUP.MatchDate, MATCHLINEUP.HeimName, MATCHLINEUP.HeimID, MATCHLINEUP.GastName, MATCHLINEUP.GastID, MATCHLINEUPPLAYER.HoPosCode, MATCHLINEUP.MatchTyp FROM MATCHLINEUPPLAYER, MATCHLINEUP WHERE MATCHLINEUPPLAYER.SpielerID=" + spielerid + " AND MATCHLINEUPPLAYER.Rating>-1 AND MATCHLINEUPPLAYER.MatchID=MATCHLINEUP.MatchID ORDER BY MATCHLINEUP.MatchDate DESC"; final ResultSet rs = m_clJDBCAdapter.executeQuery(sql); rs.beforeFirst(); //Alle Daten zu dem Spieler holen while (rs.next()) { final de.hattrickorganizer.gui.model.SpielerMatchCBItem temp = new de.hattrickorganizer.gui.model.SpielerMatchCBItem( null, rs.getInt("MatchID"), rs.getFloat("Rating") * 2, rs.getInt("HoPosCode"), rs.getString("MatchDate"), DBZugriff.deleteEscapeSequences(rs.getString("HeimName")), rs.getInt("HeimID"), DBZugriff.deleteEscapeSequences(rs.getString("GastName")), rs.getInt("GastID"), rs.getInt("MatchTyp"), null, "", ""); tempSpielerMatchCBItems.add(temp); } final java.text.SimpleDateFormat simpleFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss", java.util.Locale.GERMANY); final java.text.SimpleDateFormat simpleFormat2 = new java.text.SimpleDateFormat("yyyy-MM-dd", java.util.Locale.GERMANY); Timestamp filter = null; java.util.Date datum = null; //Die Spielerdaten zu den Matches holen for (int i = 0; i < tempSpielerMatchCBItems.size(); i++) { final de.hattrickorganizer.gui.model.SpielerMatchCBItem item = ( de .hattrickorganizer .gui .model .SpielerMatchCBItem) tempSpielerMatchCBItems .get( i); try { datum = simpleFormat.parse(item.getMatchdate()); } catch (Exception e1) { } if (datum == null) { datum = simpleFormat2.parse(item.getMatchdate()); } if (datum != null) { filter = new Timestamp(datum.getTime()); } //Spieler final de.hattrickorganizer.model.Spieler player = getSpielerAtDate(spielerid, filter); //Matchdetails final de.hattrickorganizer.model.matches.Matchdetails details = getMatchDetails(item.getMatchID()); //Stimmung und Selbstvertrauen final String[] stimmungSelbstvertrauen = getStimmmungSelbstvertrauen(getHRFID4Date(filter)); //Nur wenn Spielerdaten gefunden wurden diese in den R¸ckgabeVector ¸bergeben if ((player != null) && (details != null) && (stimmungSelbstvertrauen != null)) { item.setSpieler(player); item.setMatchdetails(details); item.setStimmung(stimmungSelbstvertrauen[0]); item.setSelbstvertrauen(stimmungSelbstvertrauen[1]); spielerMatchCBItems.add(item); } } } catch (Exception e) { HOLogger.instance().log(getClass(), "DatenbankZugriff.getSpieler4Matches : " + e); } return spielerMatchCBItems; } //------------------------------------- Delete ------------------------------------------------------- /** * TODO Missing Method Documentation * * @param hrfid TODO Missing Method Parameter Documentation */ public void deleteHRF(int hrfid) { final String[] where = { "HRF_ID" }; final String[] value = { hrfid + "" }; getTable(StadionTable.TABLENAME).delete(where, value); getTable(HRFTable.TABLENAME).delete(where, value); getTable(LigaTable.TABLENAME).delete(where, value); getTable(VereinTable.TABLENAME).delete(where, value); getTable(AufstellungTable.TABLENAME).delete(where, value); getTable(PositionenTable.TABLENAME).delete(where, value); getTable(TeamTable.TABLENAME).delete(where, value); getTable(FinanzenTable.TABLENAME).delete(where, value); getTable(BasicsTable.TABLENAME).delete(where, value); getTable(SpielerTable.TABLENAME).delete(where, value); getTable(SpielerSkillupTable.TABLENAME).delete(where, value); getTable(XtraDataTable.TABLENAME).delete(where, value); } /** * Lˆscht alle Daten zu dem Match * * @param matchid TODO Missing Constructuor Parameter Documentation */ public void deleteMatch(int matchid) { final String[] whereSpalten = { "MatchID" }; final String[] whereValues = { "" + matchid }; getTable(MatchDetailsTable.TABLENAME).delete(whereSpalten, whereValues); getTable(MatchHighlightsTable.TABLENAME).delete(whereSpalten, whereValues); getTable(MatchLineupTable.TABLENAME).delete(whereSpalten, whereValues); getTable(MatchLineupTeamTable.TABLENAME).delete(whereSpalten, whereValues); getTable(MatchLineupPlayerTable.TABLENAME).delete(whereSpalten, whereValues); getTable(MatchesKurzInfoTable.TABLENAME).delete(whereSpalten, whereValues); } /** * delete eine Aufstellung + Positionen * * @param hrfId TODO Missing Constructuor Parameter Documentation * @param name TODO Missing Constructuor Parameter Documentation */ public void deleteAufstellung(int hrfId, String name) { final String[] whereS = { "HRF_ID", "Aufstellungsname" }; final String[] whereV = { "" + hrfId, "'" + name + "'" }; //erst Vorhandene Aufstellung lˆschen getTable(AufstellungTable.TABLENAME).delete(whereS, whereV); //Standard sys resetten getTable(PositionenTable.TABLENAME).delete(whereS, whereV); } private void createAllTables() { Object[] allTables = tables.values().toArray(); for (int i = 0; i < allTables.length; i++) { AbstractTable table = (AbstractTable) allTables[i]; table.createTable(); String[] statements = table.getCreateIndizeStatements(); for (int j = 0; j < statements.length; j++) { m_clJDBCAdapter.executeUpdate(statements[j]); } } } /** * Set a single UserParameter in the DB * * @param fieldName the name of the parameter to set * @param value the target value */ private void saveUserParameter(String fieldName, int value) { ((UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME)).update(fieldName,value + ""); } /** * Set a single UserParameter in the DB * * @param fieldName the name of the parameter to set * @param value the target value */ private void saveUserParameter(String fieldName, double value) { ((UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME)).update(fieldName,value + ""); } public void saveHOColumnModel(HOColumnModel model) { ((UserColumnsTable) getTable(UserColumnsTable.TABLENAME)).saveModel(model); } public void loadHOColumModel(HOColumnModel model) { ((UserColumnsTable) getTable(UserColumnsTable.TABLENAME)).loadModel(model); } protected void updateDB() { // I introduce some new db versioning system. // Just add new version cases in the switch..case part // and leave the old ones active, so also users which // have skipped a version get their database updated. // jailbird. int version = 0; version = ((UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME)).getDBVersion(); // If development always force to rebuild latest DB if (version == DBVersion && HOMainFrame.isDevelopment()) { version = DBVersion - 1; } // We may now update depending on the version identifier! if (version != DBVersion) { try { HOLogger.instance().log(getClass(), "Updating DB to version " + DBVersion + "..."); switch (version) { case 0 : updateDBv1(); case 1 : updateDBv2(); case 2 : updateDBv3(); case 3 : updateDBv4(); case 4 : updateDBv5(); case 5 : updateDBv6(); case 6 : updateDBv7(); //case 2: updateDB_v3(); // For future versions! } HOLogger.instance().log(getClass(), "done."); } catch (Exception e) { HOLogger.instance().log(getClass(), "failed."); } } else { HOLogger.instance().log(getClass(), "No DB update necessary."); } } /** * TODO Missing Method Documentation * * @throws Exception TODO Missing Method Exception Documentation */ private void updateDBv1() throws Exception { // Add TimeZone and DBVersion field m_clJDBCAdapter.executeUpdate("ALTER TABLE UserParameter ADD COLUMN DBVersion INTEGER"); m_clJDBCAdapter.executeUpdate( "ALTER TABLE UserParameter ADD COLUMN TimeZoneDifference INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE UserParameter SET TimeZoneDifference = 0"); // Add fields to Scout and set default values for existing entries m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT ADD COLUMN PlayerID INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE SCOUT SET PlayerID = 0"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT ADD COLUMN Speciality INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE SCOUT SET Speciality = 0"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT ADD COLUMN Price INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE SCOUT SET Price = 0"); m_clJDBCAdapter.executeUpdate("ALTER TABLE UserParameter ADD COLUMN HOUsers INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE UserParameter SET HOUsers = 0"); m_clJDBCAdapter.executeUpdate("ALTER TABLE UserParameter ADD COLUMN HOUsersTot INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE UserParameter SET HOUsersTot = 0"); m_clJDBCAdapter.executeUpdate( "ALTER TABLE UserParameter ADD COLUMN AAP_ExcludeLastLineup BIT"); m_clJDBCAdapter.executeUpdate("UPDATE UserParameter SET AAP_ExcludeLastLineup = false"); // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! m_clJDBCAdapter.executeUpdate("UPDATE UserParameter SET DBVersion = 1"); } /** * TODO Missing Method Documentation * * @throws Exception TODO Missing Method Exception Documentation */ private void updateDBv2() throws Exception { // Move Future Weeks from TA into Main HO Database // createFutureTrainingsTabelle(); getTable(SpielerSkillupTable.TABLENAME).createTable(); getTable(FutureTrainingTable.TABLENAME).createTable(); getTable(UserConfigurationTable.TABLENAME).createTable(); getTable(UserColumnsTable.TABLENAME).createTable(); m_clJDBCAdapter.executeUpdate( "INSERT INTO FUTURETRAINING select * from TRAININGEXPERIENCE_TRAINWEEK"); m_clJDBCAdapter.executeUpdate("DROP TABLE TRAININGEXPERIENCE_TRAINWEEK"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT ADD COLUMN AGE INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE SCOUT SET AGE=ALTER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT DROP COLUMN ALTER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SPIELER ADD COLUMN AGE INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE SPIELER SET AGE=ALTER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SPIELER DROP COLUMN ALTER"); DBUserParameter userParameter = new DBUserParameter(); userParameter.loadUserParameter(m_clJDBCAdapter); userParameter = null; UserConfigurationTable configTable = (UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME); configTable.store(UserParameter.instance()); configTable.store(HOParameter.instance()); // configTable.store(FormulaFactors.instance()); m_clJDBCAdapter.executeUpdate("DROP TABLE UserParameter"); m_clJDBCAdapter.executeUpdate("DROP TABLE SpaltenReihenfolge"); m_clJDBCAdapter.executeUpdate( "UPDATE MATCHLINEUPPLAYER SET HOPOSCODE = 21 WHERE POSITIONCODE = 11 AND TAKTIK = 4"); m_clJDBCAdapter.executeUpdate( "UPDATE MATCHLINEUPPLAYER SET HOPOSCODE = 21 WHERE POSITIONCODE = 10 AND TAKTIK = 4"); // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! saveUserParameter("DBVersion", 2); } /** * TODO Missing Method Documentation * * @throws Exception TODO Missing Method Exception Documentation */ private void updateDBv3() throws Exception { changeColumnType("MATCHDETAILS","Matchreport","Matchreport","VARCHAR(8196)"); changeColumnType("MatchHighlights","EventText","EventText","VARCHAR(512)"); changeColumnType("FAKTOREN","HOPosition","HOPosition","INTEGER"); changeColumnType("POSITIONEN","Taktik","Taktik","INTEGER"); changeColumnType("SPIELERNOTIZ","userPos","userPos","INTEGER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE MatchHighLights RENAME TO MATCHHIGHLIGHTS"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SpielerSkillup RENAME TO SPIELERSKILLUP"); m_clJDBCAdapter.executeUpdate("ALTER TABLE USERCOLUMNS ADD COLUMN COLUMN_WIDTH INTEGER"); // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! saveUserParameter("DBVersion", 3); } /** * TODO Missing Method Documentation * * @throws Exception TODO Missing Method Exception Documentation */ private void updateDBv4() throws Exception { m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT DROP COLUMN Finanzberater"); // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! saveUserParameter("DBVersion", 4); } /** * TODO Missing Method Documentation * * @throws Exception TODO Missing Method Exception Documentation */ private void updateDBv5() throws Exception { m_clJDBCAdapter.executeUpdate("ALTER TABLE TEAM ADD COLUMN STAMINATRAININGPART INTEGER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE TRAINING ADD COLUMN STAMINATRAININGPART INTEGER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE FUTURETRAINING ADD COLUMN STAMINATRAININGPART INTEGER"); m_clJDBCAdapter.executeUpdate("UPDATE FUTURETRAINING SET STAMINATRAININGPART=5"); // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! saveUserParameter("DBVersion", 5); } /** * Update DB structure to v6 * * @throws Exception */ private void updateDBv6() throws Exception { m_clJDBCAdapter.executeUpdate("ALTER TABLE SPIELER ADD COLUMN AGEDAYS INTEGER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE SCOUT ADD COLUMN AGEDAYS INTEGER"); // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! saveUserParameter("DBVersion", 6); } /** * Update DB structure to v7 * * @throws Exception */ private void updateDBv7() throws Exception { // Adding arena/region ID m_clJDBCAdapter.executeUpdate("ALTER TABLE BASICS ADD COLUMN Region INTEGER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE STADION ADD COLUMN ArenaID INTEGER"); m_clJDBCAdapter.executeUpdate("ALTER TABLE MATCHDETAILS ADD COLUMN RegionID INTEGER"); // Drop and recreate the table // (i.e. use defaults from defaults.xml) AbstractTable faktorenTab = (AbstractTable)tables.get(FaktorenTable.TABLENAME); if (faktorenTab != null) { faktorenTab.dropTable(); faktorenTab.createTable(); } // Always set field DBVersion to the new value as last action. // Do not use DBVersion but the value, as update packs might // do version checking again before applying! saveUserParameter("DBVersion", 7); } private void changeColumnType(String table,String oldName, String newName, String type) { m_clJDBCAdapter.executeUpdate("ALTER TABLE "+table+" ADD COLUMN TEMPCOLUMN "+ type); m_clJDBCAdapter.executeUpdate("UPDATE "+table+" SET TEMPCOLUMN="+oldName); m_clJDBCAdapter.executeUpdate("ALTER TABLE "+table+" DROP COLUMN "+oldName); m_clJDBCAdapter.executeUpdate("ALTER TABLE "+table+" ADD COLUMN "+newName+" "+ type); m_clJDBCAdapter.executeUpdate("UPDATE "+table+" SET "+newName+"=TEMPCOLUMN"); m_clJDBCAdapter.executeUpdate("ALTER TABLE "+table+" DROP COLUMN TEMPCOLUMN"); } /** * Alle \ entfernen * * @param text TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public static String deleteEscapeSequences(String text) { if (text == null) { return ""; } final StringBuffer buffer = new StringBuffer(); final char[] chars = text.toCharArray(); for (int i = 0; i < chars.length; i++) { if (chars[i] == 'ß') { buffer.append("\\"); } else if (chars[i] != '#') { buffer.append("" + chars[i]); } else { buffer.append("'"); } } return buffer.toString(); } /** * ' " und ¥ codieren durch \ * * @param text TODO Missing Constructuor Parameter Documentation * * @return TODO Missing Return Method Documentation */ public static String insertEscapeSequences(String text) { if (text == null) { return ""; } final StringBuffer buffer = new StringBuffer(); final char[] chars = text.toCharArray(); for (int i = 0; i < chars.length; i++) { int code = (int) chars[i]; if ((chars[i] == '"') || (chars[i] == '\'') || (chars[i] == '¥')) { buffer.append("#"); } else if ( code == 92) { buffer.append("ß"); } else { buffer.append("" + chars[i]); } } return buffer.toString(); } /** * Automatic update of User Configuration parameters * * This method is similar to the updateDB() method above * The main difference is that it is based on the * HO release version instead of the DB version * * @author flattermann <flattermannHO@gmail.com> */ private void updateConfig () { double lastConfigUpdate = ((UserConfigurationTable) getTable(UserConfigurationTable.TABLENAME)).getLastConfUpdate(); /** * We have to use separate 'if-then' clauses for each conf version (ascending order) * because a user might have skipped some HO releases * * DO NOT use 'if-then-else' here, as this would ignores some updates! */ if (lastConfigUpdate < 1.4101) { HOLogger.instance().log(getClass(), "Updating configuration to version 1.410-1..."); updateConfigTo1410_1(); } // if (lastConfigUpdate < 1.420) { // HOLogger.instance().log(getClass(), "Updating configuration to version 1.420..."); // updateConfigTo1420(); // } } private void updateConfigTo1410_1 () { // Reset Training Speed Parameters for New Training HOLogger.instance().info(this.getClass(), "Resetting training parameters to default values"); saveUserParameter("DAUER_TORWART", 3.7); saveUserParameter("DAUER_VERTEIDIGUNG", 6.1); saveUserParameter("DAUER_SPIELAUFBAU", 5.5); saveUserParameter("DAUER_PASSPIEL", 4.5); saveUserParameter("DAUER_FLUEGELSPIEL", 3.8); saveUserParameter("DAUER_CHANCENVERWERTUNG", 5.2); saveUserParameter("DAUER_STANDARDS", 1.5); saveUserParameter("AlterFaktor", 1.0); saveUserParameter("TrainerFaktor", 1.0); saveUserParameter("CoTrainerFaktor", 1.0); saveUserParameter("IntensitaetFaktor", 1.0); // Reset Rating offsets for Rating Prediction // because of changes in the prediction files HOLogger.instance().info(this.getClass(), "Resetting rating prediction offsets"); saveUserParameter("leftDefenceOffset", 0.0); saveUserParameter("middleDefenceOffset", 0.0); saveUserParameter("rightDefenceOffset", 0.0); saveUserParameter("midfieldOffset", 0.0); saveUserParameter("leftAttackOffset", 0.0); saveUserParameter("middleAttackOffset", 0.0); saveUserParameter("rightAttackOffset", 0.0); // Drop the feedback tables to force new feedback upload for beta testers m_clJDBCAdapter.executeUpdate("DROP TABLE IF EXISTS FEEDBACK_SETTINGS"); m_clJDBCAdapter.executeUpdate("DROP TABLE IF EXISTS FEEDBACK_UPLOAD"); // always set the LastConfUpdate as last step saveUserParameter("LastConfUpdate", 1.4101); } private void updateConfigTo1420 () { // DUMMY // always set the LastConfUpdate as last step saveUserParameter("LastConfUpdate", 1.420); } }

The table below shows all metrics for DBZugriff.java.

MetricValueDescription
BLOCKS176.00Number of blocks
BLOCK_COMMENT 0.00Number of block comment lines
COMMENTS840.00Comment lines
COMMENT_DENSITY 1.18Comment density
COMPARISONS33.00Number of comparison operators
CYCLOMATIC176.00Cyclomatic complexity
DECL_COMMENTS158.00Comments in declarations
DOC_COMMENT729.00Number of javadoc comment lines
ELOC710.00Effective lines of code
EXEC_COMMENTS49.00Comments in executable code
EXITS188.00Procedure exits
FUNCTIONS133.00Number of function declarations
HALSTEAD_DIFFICULTY79.91Halstead difficulty
HALSTEAD_EFFORT 0.00Halstead effort
INTERFACE_COMPLEXITY293.00Interface complexity
JAVA0001 0.00JAVA0001 Package name does not contain only lower case letters
JAVA0002 0.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 1.00JAVA0005 Imports not in specified order
JAVA0006 0.00JAVA0006 Empty finally block
JAVA0007 1.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 1.00JAVA0029 Private method not used
JAVA0030 0.00JAVA0030 Private field not used
JAVA0031 7.00JAVA0031 Case statement not properly closed
JAVA0032 1.00JAVA0032 Switch statement missing default
JAVA0033 0.00JAVA0033 default: not last case in switch statement
JAVA0034 0.00JAVA0034 Missing braces in if statement
JAVA0035 0.00JAVA0035 Missing braces in for statement
JAVA0036 0.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 6.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 0.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 5.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
JAVA0087 0.00JAVA0087 Use of Thread.sleep()
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 5.00JAVA0108 Incorrect javadoc: no @param tag for 'parameter'
JAVA0109 5.00JAVA0109 Incorrect javadoc: no parameter 'parameter'
JAVA0110 1.00JAVA0110 Incorrect javadoc: no @return tag
JAVA0111 1.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 1.00JAVA0114 Incorrect javadoc: no @version tag
JAVA0115 1.00JAVA0115 Incorrect javadoc: no @throws or @exception tag for 'exception'
JAVA0116 0.00JAVA0116 Missing javadoc: field 'field'
JAVA011715.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 1.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 0.00JAVA0139 Definition of main other than public static void main(java.lang.String[])
JAVA0141 0.00JAVA0141 Unnecessary modifier for method in interface
JAVA0143 1.00JAVA0143 Synchronized method
JAVA0144 5.00JAVA0144 Line exceeds maximum M characters
JAVA01452872.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 7.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 5.00JAVA0166 Generic exception caught
JAVA0167 0.00JAVA0167 ThreadDeath not rethrown
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 1.00JAVA0174 Assigned local variable never used
JAVA0175 0.00JAVA0175 Successive assignment to variable
JAVA0176 0.00JAVA0176 Local variable name does not have required form
JAVA0177 0.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 0.00JAVA0266 Use of System.out
JAVA0267 0.00JAVA0267 Use of System.err
JAVA0269 0.00JAVA0269 Contents of StringBuffer never used
JAVA0270 4.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
JAVA0272 0.00JAVA0272 Thread.run() called
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
JAVA0279 0.00JAVA0279 Serialization method readObject or readObjectNoData calls an overridable method
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
LINES1961.00Number of lines in the source file
LINE_COMMENT111.00Number of line comments
LOC878.00Lines of code
LOGICAL_LINES408.00Number of statements
LOOPS 7.00Number of loops
NEST_DEPTH 5.00Maximum nesting depth
OPERANDS2367.00Number of operands
OPERATORS4302.00Number of operators
PARAMS155.00Number of formal parameter declarations
PROGRAM_LENGTH6669.00Halstead program length
PROGRAM_VOCAB838.00Halstead program vocabulary
PROGRAM_VOLUME 0.00Halstead program volume
RETURNS138.00Number of return points from functions
SIZE66362.00Size of the file in bytes
UNIQUE_OPERANDS785.00Number of unique operands
UNIQUE_OPERATORS53.00Number of unique operators
WHITESPACE243.00Number of whitespace lines