babase.db
Class Babase

java.lang.Object
  extended by babase.db.Babase

public class Babase
extends java.lang.Object


Nested Class Summary
static class Babase.DumpToXMLException
           
static class Babase.LoadFromXMLException
           
 
Field Summary
private  java.util.ArrayList<java.lang.String> _cachedClasses
           
private  java.util.ArrayList<Group> _cachedGroups
           
private  java.util.ArrayList<RankType> _cachedRankTypes
           
private  java.sql.Connection _connection
           
 
Constructor Summary
Babase()
           
 
Method Summary
 void connect(java.lang.String host, java.lang.String port, java.lang.String user, java.lang.String pass, java.lang.String db, java.lang.Boolean ssl)
           
static java.lang.String datetimeToString(java.util.Date d)
           
private static java.lang.String dateToSQLLiteral(java.util.Date d)
           
static java.lang.String dateToString(java.util.Date d)
           
static java.lang.String dateToXMLString(java.util.Date d)
           
 void disconnect()
           
static java.util.Date endOfMonth(java.util.Date d)
           
 Group[] getGroups()
           
 Individual[] getIndividuals(RankingIdentifier rankingId)
           
 java.lang.String[] getInteractionClasses()
           
 int[][] getInteractionMatrix(RankingIdentifier rankingId, InteractionSpec interactionSpec, Individual[] individuals)
           
 java.util.Date getLatestRankingDateSaved(RankingIdentifier rid)
           
 RankingInfo getRankingInfo(RankingIdentifier rid)
           
 RankType[] getRankTypes()
           
 java.lang.String getSnamesToRankQuery(RankingIdentifier rankingId)
           
 boolean isConnected()
           
static boolean isEndOfMonth(java.util.Date d)
           
static boolean isInSameMonth(java.util.Date d1, java.util.Date d2)
           
static boolean isStartOfMonth(java.util.Date d)
           
 void writeRankingInfo(RankingIdentifier rid, Individual[] individuals, int[] ranks)
           
static java.util.Date xmlStringToDate(java.lang.String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_connection

private java.sql.Connection _connection

_cachedGroups

private java.util.ArrayList<Group> _cachedGroups

_cachedClasses

private java.util.ArrayList<java.lang.String> _cachedClasses

_cachedRankTypes

private java.util.ArrayList<RankType> _cachedRankTypes
Constructor Detail

Babase

public Babase()
       throws java.lang.ClassNotFoundException
Throws:
java.lang.ClassNotFoundException
Method Detail

dateToString

public static java.lang.String dateToString(java.util.Date d)

datetimeToString

public static java.lang.String datetimeToString(java.util.Date d)

dateToXMLString

public static java.lang.String dateToXMLString(java.util.Date d)

isStartOfMonth

public static boolean isStartOfMonth(java.util.Date d)

isEndOfMonth

public static boolean isEndOfMonth(java.util.Date d)

isInSameMonth

public static boolean isInSameMonth(java.util.Date d1,
                                    java.util.Date d2)

endOfMonth

public static java.util.Date endOfMonth(java.util.Date d)

xmlStringToDate

public static java.util.Date xmlStringToDate(java.lang.String s)
                                      throws Babase.LoadFromXMLException
Throws:
Babase.LoadFromXMLException

dateToSQLLiteral

private static java.lang.String dateToSQLLiteral(java.util.Date d)

connect

public void connect(java.lang.String host,
                    java.lang.String port,
                    java.lang.String user,
                    java.lang.String pass,
                    java.lang.String db,
                    java.lang.Boolean ssl)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

isConnected

public boolean isConnected()

disconnect

public void disconnect()
                throws java.sql.SQLException
Throws:
java.sql.SQLException

getRankTypes

public RankType[] getRankTypes()
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getGroups

public Group[] getGroups()
                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getInteractionClasses

public java.lang.String[] getInteractionClasses()
                                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getSnamesToRankQuery

public java.lang.String getSnamesToRankQuery(RankingIdentifier rankingId)
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getIndividuals

public Individual[] getIndividuals(RankingIdentifier rankingId)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getInteractionMatrix

public int[][] getInteractionMatrix(RankingIdentifier rankingId,
                                    InteractionSpec interactionSpec,
                                    Individual[] individuals)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

writeRankingInfo

public void writeRankingInfo(RankingIdentifier rid,
                             Individual[] individuals,
                             int[] ranks)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getRankingInfo

public RankingInfo getRankingInfo(RankingIdentifier rid)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

getLatestRankingDateSaved

public java.util.Date getLatestRankingDateSaved(RankingIdentifier rid)
                                         throws java.sql.SQLException
Throws:
java.sql.SQLException