org.xistrat.util
Class SQL

java.lang.Object
  extended by org.xistrat.util.SQL
Direct Known Subclasses:
SQL3D

public class SQL
extends java.lang.Object

persistence util

Since:
0.5.42

Field Summary
protected  java.lang.String adx
           
protected  java.lang.String driver
           
protected  java.lang.String mysql_uri
           
 int poly
           
 int polygons
           
 int vertices
           
 
Constructor Summary
SQL()
           
SQL(int polygons, int poly, int vertices)
           
SQL(java.lang.String adx)
           
SQL(java.lang.String adx, int polygons, int poly, int vertices)
           
 
Method Summary
 void deleteMoves(int fightID, int move_count)
           
 java.util.LinkedList<MoveBean> getAllMoves(java.lang.String fightID)
           
 Grid getBoardByID(java.lang.String boardID)
           
 java.util.LinkedList<Grid> getBoardList(java.lang.String boardTable)
           
 FaceData getFaceData(java.lang.String table, java.lang.String variant)
           
 java.util.LinkedList<Fight> getFightList(java.lang.String fightTable, java.lang.String gameTable)
           
 FigurData[] getFiguresByPositionID(java.lang.String positionID, FastFace fastFace)
          retrieve list of pieces from database (in case of piece D use faceData to extract face id out of edge id)
 GameData getGameByID(java.lang.String id)
           
 GraphVariant getGraphVariant(int link)
           
 java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> getLinkData(int link)
           
 int getNumPlayers(java.lang.String positionID)
           
 java.lang.String getPositionByFight(java.lang.String fightID)
           
 java.util.LinkedList<Position> getPositionList(java.lang.String gameTable, java.lang.String boardID, java.lang.String v, java.lang.String familyID, java.lang.String numP)
           
 StonesBean getStonesByPositionID(java.lang.String positionID, FastFace fastFace, int numP)
          retrieve stones from database
 int insertFace(java.lang.String propStr, java.lang.String variant, java.lang.String faceTable, int id, int color, int[] points)
           
 int insertFace(java.lang.String propStr, java.lang.String variant, java.lang.String faceTable, int id, int color, int[] points, java.lang.String valid)
          insertFace and updateFace may be merged using REPLACE
 int insertPoint(java.lang.String propStr, java.lang.String variant, java.lang.String pointTable, int id, float x, float y, float z)
           
 void logMove(int fightID, int move_count, java.lang.String type, int from, int to)
           
 boolean savePosition(java.lang.String positionName, java.lang.String turnOfParty, java.lang.String board, FigurData[] figs)
           
 boolean savePosition(java.lang.String positionName, java.lang.String turnOfParty, java.lang.String board, StonesBean stonesBean)
           
 int startFight(java.lang.String position, java.lang.String desc, java.lang.String komi)
           
 int storeVar(java.lang.String graph, java.lang.String old_variant, java.lang.String new_variant, java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> rotiFaces, java.util.LinkedList<EdgeData> edges)
           
 int updateFace(java.lang.String propStr, java.lang.String variant, java.lang.String faceTable, int id, int color, int[] points)
          used in refreshing orientations (and quasicrystal face coloring)
 void updateFight(int fightID, java.lang.String _result)
          used to set the result in the database when the match is over
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

driver

protected java.lang.String driver

mysql_uri

protected java.lang.String mysql_uri

adx

protected java.lang.String adx

polygons

public int polygons

poly

public int poly

vertices

public int vertices
Constructor Detail

SQL

public SQL()

SQL

public SQL(java.lang.String adx)

SQL

public SQL(java.lang.String adx,
           int polygons,
           int poly,
           int vertices)

SQL

public SQL(int polygons,
           int poly,
           int vertices)
Method Detail

insertPoint

public int insertPoint(java.lang.String propStr,
                       java.lang.String variant,
                       java.lang.String pointTable,
                       int id,
                       float x,
                       float y,
                       float z)
                throws java.lang.Exception
Throws:
java.lang.Exception

savePosition

public boolean savePosition(java.lang.String positionName,
                            java.lang.String turnOfParty,
                            java.lang.String board,
                            FigurData[] figs)
                     throws java.lang.Exception
Throws:
java.lang.Exception

savePosition

public boolean savePosition(java.lang.String positionName,
                            java.lang.String turnOfParty,
                            java.lang.String board,
                            StonesBean stonesBean)
                     throws java.lang.Exception
Throws:
java.lang.Exception

startFight

public int startFight(java.lang.String position,
                      java.lang.String desc,
                      java.lang.String komi)
               throws java.lang.Exception
Throws:
java.lang.Exception

logMove

public void logMove(int fightID,
                    int move_count,
                    java.lang.String type,
                    int from,
                    int to)
             throws java.lang.Exception
Throws:
java.lang.Exception

insertFace

public int insertFace(java.lang.String propStr,
                      java.lang.String variant,
                      java.lang.String faceTable,
                      int id,
                      int color,
                      int[] points)
               throws java.lang.Exception
Throws:
java.lang.Exception

updateFace

public int updateFace(java.lang.String propStr,
                      java.lang.String variant,
                      java.lang.String faceTable,
                      int id,
                      int color,
                      int[] points)
               throws java.lang.Exception
used in refreshing orientations (and quasicrystal face coloring)

Throws:
java.lang.Exception

updateFight

public void updateFight(int fightID,
                        java.lang.String _result)
                 throws java.lang.Exception
used to set the result in the database when the match is over

Parameters:
fightID - the match to deal with
_result - the result of the match
Throws:
java.lang.Exception - in case s.th. occurs

deleteMoves

public void deleteMoves(int fightID,
                        int move_count)
                 throws java.lang.Exception
Throws:
java.lang.Exception

insertFace

public int insertFace(java.lang.String propStr,
                      java.lang.String variant,
                      java.lang.String faceTable,
                      int id,
                      int color,
                      int[] points,
                      java.lang.String valid)
               throws java.lang.Exception
insertFace and updateFace may be merged using REPLACE

Throws:
java.lang.Exception

getFaceData

public FaceData getFaceData(java.lang.String table,
                            java.lang.String variant)
                     throws java.lang.Exception
Throws:
java.lang.Exception

getBoardList

public java.util.LinkedList<Grid> getBoardList(java.lang.String boardTable)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

getPositionList

public java.util.LinkedList<Position> getPositionList(java.lang.String gameTable,
                                                      java.lang.String boardID,
                                                      java.lang.String v,
                                                      java.lang.String familyID,
                                                      java.lang.String numP)
                                               throws java.lang.Exception
Throws:
java.lang.Exception

getFightList

public java.util.LinkedList<Fight> getFightList(java.lang.String fightTable,
                                                java.lang.String gameTable)
                                         throws java.lang.Exception
Throws:
java.lang.Exception

getAllMoves

public java.util.LinkedList<MoveBean> getAllMoves(java.lang.String fightID)
                                           throws java.lang.Exception
Throws:
java.lang.Exception

getBoardByID

public Grid getBoardByID(java.lang.String boardID)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getGameByID

public GameData getGameByID(java.lang.String id)
                     throws java.lang.Exception
Throws:
java.lang.Exception

getPositionByFight

public java.lang.String getPositionByFight(java.lang.String fightID)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

getNumPlayers

public int getNumPlayers(java.lang.String positionID)
                  throws java.lang.Exception
Throws:
java.lang.Exception

getFiguresByPositionID

public FigurData[] getFiguresByPositionID(java.lang.String positionID,
                                          FastFace fastFace)
                                   throws java.lang.Exception
retrieve list of pieces from database (in case of piece D use faceData to extract face id out of edge id)

Parameters:
positionID - the id of the pieces' constellation to be loaded
fastFace - the graph to be played on
Returns:
the pieces
Throws:
java.lang.Exception

getStonesByPositionID

public StonesBean getStonesByPositionID(java.lang.String positionID,
                                        FastFace fastFace,
                                        int numP)
                                 throws java.lang.Exception
retrieve stones from database

Parameters:
positionID - the id of the stones constellation to be loaded
fastFace - the graph to be played on
Returns:
the stones as bean
Throws:
java.lang.Exception

storeVar

public int storeVar(java.lang.String graph,
                    java.lang.String old_variant,
                    java.lang.String new_variant,
                    java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> rotiFaces,
                    java.util.LinkedList<EdgeData> edges)
             throws java.lang.Exception
Throws:
java.lang.Exception

getLinkData

public java.util.LinkedList<java.util.LinkedList<java.lang.Integer>> getLinkData(int link)
                                                                          throws java.lang.Exception
Throws:
java.lang.Exception

getGraphVariant

public GraphVariant getGraphVariant(int link)
                             throws java.lang.Exception
Throws:
java.lang.Exception