net.sourceforge.foobase
Interface IsGameDatabase

All Known Implementing Classes:
CBFDatabase

public interface IsGameDatabase

Interface for databases of chess Games.


Field Summary
static java.lang.String __version
           
 
Method Summary
 void add(Game g)
          Add a new Game to the database.
 void close()
          Close a database.
 void create()
          Create a new database.
 void delete(Game g)
          Remove a Game from the database.
 Game get(int idx)
          Retrieve a game based on its index in the database.
 java.util.Vector getGames()
          Retrieve all Games present in the database.
 java.util.Vector getHeaders()
          Retrieve the headers for all games present in the database.
 void open()
          Open an existing database.
 void setName(java.lang.String nam)
          Set name of Game collection.
 int size()
          Returns the number of Games stored in the database.
 void update(Game g)
          Update a Game in the database.
 

Field Detail

__version

public static final java.lang.String __version
Method Detail

setName

public void setName(java.lang.String nam)
             throws java.lang.Exception
Set name of Game collection.

The meaning of this name is implementation dependent, that is, it is up to the implementing classes to interprete this name.

For example, this may be the name of a PGN file or it may be the basename for an old-style Chessbase database (that will use files with this basename followed by the extensions ".CBI" and ".CBF")

Parameters:
nam - String specifying the name of the database.
Throws:
java.lang.Exception - is thrown whenever the name is not acceptable.

create

public void create()
            throws java.lang.Exception
Create a new database.
Throws:
java.lang.Exception - if the database could not be created.

open

public void open()
          throws java.lang.Exception
Open an existing database.
Throws:
java.lang.Exception - if the database could not be opened.

size

public int size()
         throws java.lang.Exception
Returns the number of Games stored in the database.
Returns:
int containing the number of Games.
Throws:
java.lang.Exception - if an error occured during the operation.

getGames

public java.util.Vector getGames()
                          throws java.lang.Exception
Retrieve all Games present in the database.
Returns:
Vector containing the Games present in the database.
Throws:
java.lang.Exception - if an error occured during the operation.

getHeaders

public java.util.Vector getHeaders()
                            throws java.lang.Exception
Retrieve the headers for all games present in the database.
Returns:
Vector containing the header strings for all the games present in the database.
Throws:
java.lang.Exception - if an error occured during the operation.

get

public Game get(int idx)
         throws java.lang.Exception
Retrieve a game based on its index in the database.
Parameters:
idx - int zero-based index of the game to retrieve
Returns:
Game containing the specified game
Throws:
java.lang.Exception - if an error occured during the operation.

add

public void add(Game g)
         throws java.lang.Exception
Add a new Game to the database.

This method is not required to verify insertion of duplicate Games.

Parameters:
g - Game to add to the database.
Throws:
java.lang.Exception - if an error occured during the operation.

update

public void update(Game g)
            throws java.lang.Exception
Update a Game in the database.

Note that this method is only required to work on Games that were previously read from the same database as the update is being done.

Parameters:
g - Game to update in the database.
Throws:
java.lang.Exception - if an error occured during the operation.

delete

public void delete(Game g)
            throws java.lang.Exception
Remove a Game from the database.

Note that this method is only required to work on Games that were previously read from the same database as the update is being done.

Parameters:
g - Game to remove from the database.
Throws:
java.lang.Exception - if an error occured during the operation.

close

public void close()
           throws java.lang.Exception
Close a database.
Throws:
java.lang.Exception - if an error occured during the operation.