Permalink
Browse files

Add database parser.

  • Loading branch information...
0 parents commit 08a7f4236ce3016ef29a554aa27a6ad264ae1f4c @Nilhcem committed Dec 25, 2011
8 .classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="conf"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib" path="lib/sqlitejdbc-v056.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
4 .gitignore
@@ -0,0 +1,4 @@
+*.u8
+bin/
+dist/
+output/
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>CFDict-parser</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
2 .settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
11 .settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
6 README.md
@@ -0,0 +1,6 @@
+Database parser for FR/CN Dict
+==============================
+
+- Download CFDICT, and unzip the `cfdict.u8` file on the root of the project
+- Run the `ant` command
+- An `output` directory is now created with the database.
4 build.properties
@@ -0,0 +1,4 @@
+conf.dir=conf
+lib.dir=lib
+build.dir=build
+dist.dir=dist
37 build.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="CFDICT-parser" basedir="." default="run">
+ <property file="build.properties"/>
+
+ <path id="lib.path.id">
+ <fileset dir="${lib.dir}" />
+ <path location="${conf.dir}" />
+ </path>
+
+ <target name="clean" description="Remove all builded classes and jar file">
+ <delete dir="${build.dir}" />
+ <delete dir="${dist.dir}" />
+ <delete dir="bin" />
+ <delete dir="output" />
+ </target>
+
+ <target name="build" description="Build project">
+ <mkdir dir="${build.dir}" />
+ <javac srcdir="src" source="1.7" target="1.7" destdir="${build.dir}" includeantruntime="false" classpathref="lib.path.id" />
+ </target>
+
+ <target name="package" depends="build" description="Create jar file with dependencies">
+ <jar destfile="${dist.dir}/${ant.project.name}.jar" basedir="${build.dir}">
+ <fileset dir="${conf.dir}" />
+ <zipgroupfileset dir="${lib.dir}" includes="*.jar" />
+ <manifest>
+ <attribute name="Main-Class" value="com.nilhcem.cfdictparser.App" />
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="run" depends="package" description="Run JAR file">
+ <java jar="${dist.dir}/${ant.project.name}.jar" fork="true">
+ <arg value="cfdict.u8" />
+ </java>
+ </target>
+</project>
12 conf/configuration.properties
@@ -0,0 +1,12 @@
+#Output folder
+output.dir=output
+#Zipped database file name
+output.zip=dictionary.zip
+#Version file name
+output.version=version
+#Md5 file name
+output.md5=md5sum
+#Database file name
+db.name=dictionary.db
+#Database version date format
+version.format=yyyyMMddHHmm
BIN lib/sqlitejdbc-v056.jar
Binary file not shown.
46 src/com/nilhcem/cfdictparser/App.java
@@ -0,0 +1,46 @@
+package com.nilhcem.cfdictparser;
+
+import java.io.FileNotFoundException;
+
+import com.nilhcem.cfdictparser.args.ArgsParser;
+import com.nilhcem.cfdictparser.args.DisplayUsageException;
+
+/**
+ * Entry point of the application.
+ * <p>
+ * Checks arguments, parses file and creates output data.
+ * </p>
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class App {
+ /**
+ * Launches application.
+ *
+ * @param args an Array of String which should contain only one parameter: the UTF-8 text file dictionary.
+ */
+ public static void main(final String[] args) {
+ try {
+ System.out.println("Processing, please wait...");
+
+ // Check parameters
+ ArgsParser params = new ArgsParser();
+ params.checkArgs(args);
+
+ // Parse file
+ FileParser parser = new FileParser(params.getInputFile());
+ parser.parseFile();
+
+ // Create output data
+ OutputMaker output = new OutputMaker();
+ output.create();
+
+ System.out.println("Done.");
+ } catch (DisplayUsageException e) {
+ System.err.println(e.getMessage());
+ } catch (FileNotFoundException e) {
+ System.err.println(String.format("File not found: %s. Exit.", e.getMessage()));
+ }
+ }
+}
88 src/com/nilhcem/cfdictparser/FileParser.java
@@ -0,0 +1,88 @@
+package com.nilhcem.cfdictparser;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.nilhcem.cfdictparser.sqlite.DbHandler;
+
+/**
+ * Provides methods to parse the UTF-8 text file dictionary, to fill the database.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class FileParser {
+ private File inputFile;
+ private static final Pattern PATTERN = Pattern.compile("^\\s*(.+)\\s+\\[(.*)\\]\\s+/(.+)/\\s*$");
+
+ /**
+ * @param pathname a String containing the UTF-8 text file dictionary path.
+ * @throws FileNotFoundException if the dictionary was not found.
+ */
+ public FileParser(String pathname) throws FileNotFoundException {
+ inputFile = new File(pathname);
+ if (!inputFile.exists()) {
+ throw new FileNotFoundException(pathname);
+ }
+ }
+
+ /**
+ * Parses the text file and fills the database.
+ */
+ public void parseFile() {
+ try {
+ String line;
+ DbHandler db = new DbHandler();
+ BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile.getAbsolutePath()), "UTF8"));
+
+ while ((line = in.readLine()) != null) {
+ parseLine(line.trim(), db);
+ }
+ db.flush();
+ in.close();
+ db.close();
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Parses the String in parameter.
+ *
+ * @param line the String which should be parsed.
+ * @param db the {@code DbHandler} object. Will be used to insert data in database.
+ */
+ private void parseLine(String line, DbHandler db) {
+ // Check if line is a comment
+ if (line.startsWith("#")) {
+ return;
+ }
+
+ // Parse line
+ Matcher matcher = PATTERN.matcher(line);
+ if (matcher.find()) {
+ String[] chinese = matcher.group(1).split(" ");
+ String simplified;
+ String traditional;
+
+ if (chinese.length == 2 && chinese[0].length() == chinese[1].length()) {
+ traditional = chinese[0];
+ simplified = chinese[1];
+ } else {
+ simplified = matcher.group(1);
+ traditional = "";
+ }
+ String pinyin = matcher.group(2);
+ String translation = matcher.group(3);
+
+ db.add(simplified, traditional, pinyin, translation);
+ }
+ }
+}
97 src/com/nilhcem/cfdictparser/OutputMaker.java
@@ -0,0 +1,97 @@
+package com.nilhcem.cfdictparser;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import com.nilhcem.cfdictparser.core.Configuration;
+import com.nilhcem.cfdictparser.core.Md5;
+import com.nilhcem.cfdictparser.core.VersionGenerator;
+import com.nilhcem.cfdictparser.core.Zipper;
+
+/**
+ * Creates the output folder and places every needed files inside.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class OutputMaker {
+ private static final Configuration CONFIG = Configuration.getInstance();
+ private static final String OUTPUT_FILE = CONFIG.get("output.dir") + File.separator + CONFIG.get("output.zip");
+
+ /**
+ * Creates the output folder, and puts every needed files inside.
+ */
+ public void create() {
+ createOutputFolder();
+ zipDatabase();
+ createMd5File();
+ createVersion();
+ rmTempDatabase();
+ }
+
+ /**
+ * Creates the output directory.
+ */
+ private void createOutputFolder() {
+ File output = new File(CONFIG.get("output.dir"));
+ output.mkdir();
+ }
+
+ /**
+ * Compresses the database in a .zip file.
+ */
+ private void zipDatabase() {
+ Zipper zipper = new Zipper(OUTPUT_FILE, new String[] {CONFIG.get("db.name")});
+ zipper.start();
+ }
+
+ /**
+ * Deletes the non-zipped database.
+ */
+ private void rmTempDatabase() {
+ File database = new File(CONFIG.get("db.name"));
+ database.delete();
+ }
+
+ /**
+ * Generates an MD5 checksum of the zipped database, and writes it into a file.
+ */
+ private void createMd5File() {
+ try {
+ writeToFile(Md5.getMd5Sum(OUTPUT_FILE), CONFIG.get("output.dir") + File.separator + CONFIG.get("output.md5"));
+ } catch (FileNotFoundException e) {
+ e.getMessage();
+ e.printStackTrace();
+ }
+
+ }
+
+ /**
+ * Creates a file containing the database version number.
+ */
+ private void createVersion() {
+ writeToFile(VersionGenerator.getVersion(), CONFIG.get("output.dir")
+ + File.separator + CONFIG.get("output.version"));
+ }
+
+ /**
+ * Writes the content of a String passed in parameter into a file.
+ *
+ * @param content the content of the new file which will be created.
+ * @param filePath the file path of the new file which will be created.
+ */
+ private void writeToFile(String content, String filePath) {
+ try {
+ BufferedWriter out = new BufferedWriter(new FileWriter(filePath));
+ out.write(content);
+ out.newLine();
+ out.close();
+ } catch (IOException e) {
+ e.getMessage();
+ e.printStackTrace();
+ }
+ }
+}
32 src/com/nilhcem/cfdictparser/args/ArgsParser.java
@@ -0,0 +1,32 @@
+package com.nilhcem.cfdictparser.args;
+
+/**
+ * Arguments parser.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class ArgsParser {
+ private String inputFile = null;
+
+ /**
+ * Checks arguments.
+ *
+ * @param args program arguments.
+ * @throws DisplayUsageException if the arguments doesn't match the specifications.
+ */
+ public void checkArgs(String[] args) throws DisplayUsageException {
+ if (args.length != 1) {
+ throw new DisplayUsageException();
+ }
+ inputFile = args[0];
+ }
+
+ /**
+ * Returns the name of the input file.
+ * @return the name of the input file.
+ */
+ public String getInputFile() {
+ return inputFile;
+ }
+}
21 src/com/nilhcem/cfdictparser/args/DisplayUsageException.java
@@ -0,0 +1,21 @@
+package com.nilhcem.cfdictparser.args;
+
+/**
+ * Thrown if the program arguments were invalid.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class DisplayUsageException extends Exception {
+ private static final long serialVersionUID = 7329560806636980938L;
+
+ /**
+ * Displays the program usage.
+ *
+ * @return the program usage.
+ */
+ @Override
+ public String getMessage() {
+ return "usage: java -jar CFDICT-parser.jar /path/to/cfdict.u8";
+ }
+}
4 src/com/nilhcem/cfdictparser/args/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides classes related to command-line arguments.
+ */
+package com.nilhcem.cfdictparser.args;
53 src/com/nilhcem/cfdictparser/core/Configuration.java
@@ -0,0 +1,53 @@
+package com.nilhcem.cfdictparser.core;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+/**
+ * Contains and returns some project-specific configuration variables.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class Configuration {
+ private static final Configuration INSTANCE = new Configuration();
+ private static final String CONFIG_FILE = "/configuration.properties";
+ private static final Properties CONFIG = new Properties();
+
+ /**
+ * Returns the unique instance of the class.
+ *
+ * @return the unique instance.
+ */
+ public static Configuration getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Opens the "{@code configuration.properties}" file and maps data.
+ */
+ private Configuration() {
+ InputStream in = getClass().getResourceAsStream(CONFIG_FILE);
+ try {
+ CONFIG.load(in);
+ in.close();
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Returns the value of a specific entry from the "{@code configuration.properties}" file.
+ *
+ * @param key a string representing the key from a key/value couple.
+ * @return the value of the key, or an empty string if the key was not found.
+ */
+ public String get(String key) {
+ if (CONFIG != null && CONFIG.containsKey(key)) {
+ return CONFIG.getProperty(key);
+ }
+ return "";
+ }
+}
56 src/com/nilhcem/cfdictparser/core/Md5.java
@@ -0,0 +1,56 @@
+package com.nilhcem.cfdictparser.core;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Provides classes to compute md5 checksum.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class Md5 {
+ /**
+ * Returns the MD5 checksum of the file passed in parameters.
+ *
+ * @param file the file path from which we should calculate the checksum.
+ * @return the MD5 checksum of the file passed in parameters.
+ * @throws FileNotFoundException if the file specified in parameters was not found.
+ */
+ public static String getMd5Sum(String file) throws FileNotFoundException {
+ // Get an MD5 implementation of MessageDigest
+ MessageDigest digest;
+ try {
+ digest = MessageDigest.getInstance("MD5");
+ } catch (NoSuchAlgorithmException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+
+ // Open file and read contents
+ InputStream is = new FileInputStream(file);
+ byte[] buffer = new byte[8192];
+ int read = 0;
+ try {
+ while ((read = is.read(buffer)) != -1) {
+ // pass data read from file to digest for processing
+ digest.update(buffer, 0, read);
+ }
+ is.close();
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ return null;
+ }
+
+ // Get the MD5 sum
+ byte[] md5sum = digest.digest();
+ return new BigInteger(1, md5sum).toString(16);
+ }
+}
28 src/com/nilhcem/cfdictparser/core/VersionGenerator.java
@@ -0,0 +1,28 @@
+package com.nilhcem.cfdictparser.core;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * Generates a version number for the database.
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class VersionGenerator {
+ private static String version = null;
+
+ /**
+ * Returns a version number for the database.
+ * <p>
+ * If the version number was not computed yet, generates a new one.
+ * </p>
+ *
+ * @return the version number of the database.
+ */
+ public static String getVersion() {
+ if (version == null) {
+ version = new SimpleDateFormat(Configuration.getInstance().get("version.format")).format(new Date());
+ }
+ return version;
+ }
+}
64 src/com/nilhcem/cfdictparser/core/Zipper.java
@@ -0,0 +1,64 @@
+package com.nilhcem.cfdictparser.core;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * Compresses files into a .zip file.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class Zipper {
+ private final String[] filesToCompress;
+ private final String outputFile;
+
+ /**
+ * @param outputFile the .zip file path.
+ * @param filesToCompress an array containing files path names which should be compressed.
+ */
+ public Zipper(String outputFile, String[] filesToCompress) {
+ this.outputFile = outputFile;
+ this.filesToCompress = filesToCompress.clone();
+ }
+
+ /**
+ * Compresses files into a .zip file.
+ */
+ public void start() {
+ byte[] buffer = new byte[1024];
+
+ try {
+ // Create the ZIP file
+ ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outputFile));
+
+ // Compress the files
+ for (String fileToCompress : filesToCompress) {
+ FileInputStream fis = new FileInputStream(fileToCompress);
+ BufferedInputStream in = new BufferedInputStream(fis, buffer.length);
+ out.putNextEntry(new ZipEntry(fileToCompress));
+
+ // Transfer bytes from the file to the ZIP file
+ int size = 0;
+ while ((size = in.read(buffer, 0, buffer.length)) != -1) {
+ out.write(buffer, 0, size);
+ }
+
+ // Complete the entry
+ out.flush();
+ out.closeEntry();
+ in.close();
+ }
+
+ // Complete the ZIP file
+ out.close();
+ } catch (IOException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
4 src/com/nilhcem/cfdictparser/core/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides core methods of the project.
+ */
+package com.nilhcem.cfdictparser.core;
4 src/com/nilhcem/cfdictparser/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Entry point and main classes of the application.
+ */
+package com.nilhcem.cfdictparser;
131 src/com/nilhcem/cfdictparser/sqlite/DbHandler.java
@@ -0,0 +1,131 @@
+package com.nilhcem.cfdictparser.sqlite;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import com.nilhcem.cfdictparser.core.Configuration;
+import com.nilhcem.cfdictparser.core.VersionGenerator;
+
+/**
+ * Provides methods to communicate with an SQLite database.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public final class DbHandler {
+ private static final Configuration CONFIG = Configuration.getInstance();
+ private static final String DB_NAME = CONFIG.get("db.name");
+ private Connection conn;
+ private PreparedStatement prep;
+
+ /**
+ * Creates the SQLite database.
+ */
+ public DbHandler() {
+ try {
+ Class.forName("org.sqlite.JDBC");
+ conn = DriverManager.getConnection("jdbc:sqlite:" + DbHandler.DB_NAME);
+ createTables();
+ prep = conn.prepareStatement("INSERT INTO " + Tables.ENTRIES_TABLE_NAME + "("
+ + Tables.ENTRIES_KEY_SIMPLIFIED + ", "
+ + Tables.ENTRIES_KEY_TRADITIONAL + ", "
+ + Tables.ENTRIES_KEY_PINYIN + ", "
+ + Tables.ENTRIES_KEY_TRANSLATION + ") VALUES (?, ?, ?, ?);");
+ } catch (ClassNotFoundException | SQLException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Closes the database if it is not closed yet (should already be closed).
+ */
+ @Override
+ protected void finalize() throws Throwable {
+ close();
+ super.finalize();
+ }
+
+ /**
+ * Creates some tables.
+ *
+ * @throws SQLException if an SQL error happened.
+ */
+ private void createTables() throws SQLException {
+ Statement stat = conn.createStatement();
+
+ // android_metadata
+ stat.executeUpdate("DROP TABLE IF EXISTS android_metadata;");
+ stat.executeUpdate("CREATE TABLE android_metadata (locale TEXT);");
+ stat.executeUpdate("INSERT INTO android_metadata VALUES ('en_US');");
+
+ // ENTRIES_TABLE_NAME
+ stat.executeUpdate("DROP TABLE IF EXISTS " + Tables.ENTRIES_TABLE_NAME + ";");
+ stat.executeUpdate("CREATE TABLE " + Tables.ENTRIES_TABLE_NAME + " ("
+ + Tables.ENTRIES_KEY_ROWID + " integer primary key autoincrement, "
+ + Tables.ENTRIES_KEY_SIMPLIFIED + " text not null, "
+ + Tables.ENTRIES_KEY_TRADITIONAL + " text, "
+ + Tables.ENTRIES_KEY_PINYIN + " text, "
+ + Tables.ENTRIES_KEY_TRANSLATION + " text not null);");
+
+ // METADATA_TABLE_NAME
+ stat.executeUpdate("DROP TABLE IF EXISTS " + Tables.METADATA_TABLE_NAME + ";");
+ stat.executeUpdate("CREATE TABLE " + Tables.METADATA_TABLE_NAME + " ("
+ + Tables.METADATA_KEY_VERSION + " long not null);");
+ stat.executeUpdate("INSERT INTO " + Tables.METADATA_TABLE_NAME + " VALUES ('" + VersionGenerator.getVersion() + "');");
+ }
+
+ /**
+ * Closes the database.
+ */
+ public void close() {
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ } finally {
+ conn = null;
+ }
+ }
+ }
+
+ /**
+ * Add an entry in the database.
+ *
+ * @param simplified Simplified Chinese characters.
+ * @param traditional Traditional Chinese characters.
+ * @param pinyin Pinyin.
+ * @param translation Translation of the Chinese characters.
+ */
+ public void add(String simplified, String traditional, String pinyin, String translation) {
+ try {
+ prep.setString(1, simplified);
+ prep.setString(2, traditional);
+ prep.setString(3, pinyin);
+ prep.setString(4, translation);
+ prep.addBatch();
+ } catch (SQLException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Commit all the pending inserted entries.
+ */
+ public void flush() {
+ try {
+ conn.setAutoCommit(false);
+ prep.executeBatch();
+ conn.setAutoCommit(true);
+ } catch (SQLException e) {
+ System.err.println(e.getMessage());
+ e.printStackTrace();
+ }
+ }
+}
21 src/com/nilhcem/cfdictparser/sqlite/Tables.java
@@ -0,0 +1,21 @@
+package com.nilhcem.cfdictparser.sqlite;
+
+/**
+ * Contains tables and columns names.
+ *
+ * @author Nilhcem
+ * @since 1.0
+ */
+public interface Tables {
+ // Entries table
+ public static final String ENTRIES_TABLE_NAME = "entries";
+ public static final String ENTRIES_KEY_ROWID = "_id";
+ public static final String ENTRIES_KEY_SIMPLIFIED = "simplified";
+ public static final String ENTRIES_KEY_TRADITIONAL = "traditional";
+ public static final String ENTRIES_KEY_PINYIN = "pinyin";
+ public static final String ENTRIES_KEY_TRANSLATION = "translation";
+
+ // Metadata table
+ public static final String METADATA_TABLE_NAME = "dict_metadata";
+ public static final String METADATA_KEY_VERSION = "version";
+}
4 src/com/nilhcem/cfdictparser/sqlite/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Provides classes to communicate with the SQLite database.
+ */
+package com.nilhcem.cfdictparser.sqlite;

0 comments on commit 08a7f42

Please sign in to comment.