mercredi 26 avril 2017

Interpreter design pattern using java

I am doing a DBMS using this interface

package eg.edu.alexu.csd.oop.db;

public interface Database {
/**
* Creates/drops table or database.
* @param query structure definition query (e.g., create or drop table)
* @returns true if success, or false otherwise
* @throws SQLException syntax error
*/
public boolean executeStructureQuery(String query) throws java.sql.SQLException;
/**
* Select from table
* @param query data retrieval query (e.g., select)
* @return the selected records or an empty array if no records match. Columns
types must be preserved, i.e, Columns of “int” data type return
Integer objects, and columns of “varchar” data type return String
objects)
* @throws SQLException syntax error
*/
public Object[][] executeRetrievalQuery(String query) throws java.sql.SQLException;
/**
* Insert or update or delete the data
* @param query data manipulation query (e.g., insert, update or delete)
* @return the updated rows count
* @throws SQLException syntax error
*/
public int executeUpdateQuery(String query) throws java.sql.SQLException;
}

So I created a validator and a tokenizer which returns an area. And I want to use the tokens to use Interpreter design pattern, however, all resources have a very simple code and I am unable to understand how to use it here. Any guidance would or suggestions would be appreciated

Aucun commentaire:

Enregistrer un commentaire