Skip to content

Kunkgg/kunDict

Repository files navigation

KunDict

class App {
    - String configFileName;
    - ArrayList<LocalDict> registeredLocalDicts;
    - ArrayList<OnlineDict> registeredOnlineDicts;

    + {static} Database db;
    + {static} Properties configs;

    - void loadConfigs()
    + String getConfigFileName()
    + void setConfigFileName(String configFileName)
    + ArrayList<Dict> getRegisteredDicts()
    + ArrayList<LocalDict> getRegisteredLocalDicts()
    + ArrayList<OnlineDict> getRegisteredOnlineDicts()

    + void initializeTables()
    + boolean hasTables()
    + void insertValuesIntoDictTypes()
    + void registerDicts()
    + void registerDict()
}

abstract class Dict {
     - String name;
     - String shortName;
     - String description;
     - DictType type;

     + String getName()
     + String getShortName()
     + String getDescription()
     + DictType getType()
     + void setName(String name)
     + void setShortName(String shortName)
     + void setDescription(String description)
     + void setType(DictType type)

     + {static} String preProcessWordSpell(String wordSpell)

    {abstract} Word queryWord(String wordSpell);
}

enum  DictType {
    Online
    Local
}

abstract class OnlineDict {
     - DictType type = this.setType(DictType.Online);
}

abstract class LocalDict {
    - Instant atime;
    - Instant mtime;
    - {static} Database db;

    + LocalDict(String name, String description, String shortname)

    + Instant getAtime()
    + Instant getMtime()
    + void updateAtime()
    + void updateMtime()

    + void initializeTables()
    + void dropTables()
    + boolean hasTables()

    + Word queryWord(String wordSpell)
    + void addWord(Word word)
    + void deleteWord(Word word)
    + void updateWord(Word word)
    + Word random();
    + int size()

    {abstract} void build();
}

class DefaultLocalDict {
    - {static} String name = "Default local dictionary";
    - {static} String shortName = "def";
    - {static} String description = "the default local dictionary"
}

class MITDict {
    - {static} String name = "MIT Englinsh Dictionary";
    - {static} String shortName = "mit";
    - {static} String description = "Word list is from MIT..."

    + void build();
}

class CollinsOnlineDict {
    - {static} String name = "Collins Online English Dictionary";
    - {static} String shortName = "collins";
    - {static} String description = "English to English"
    - {static} String queryUrlBase = "...url"

    + Word queryWord(String wordSpell);
}

class Word {
    - String spell;
    - ArrayList<String> forms;
    - Frequency frequency;
    - Pronounce pronounce;
    - ArrayList<SenseEntry> senseEntryList;
    - String source = "";
    - Instant mtime;
    - Instant atime;
    - int acounter = -1;

    + String toString()
    + boolean equals(Object otherObj)
    + boolean isEmpty()

    + String getSpell();
    + Pronounce getPronounce();
    + String getfrequency();
    + ArrayList<String> getforms();
    + ArrayList<SenseEntry> getSenseEntries()
    + Instant getMtime()
    + Instant getAtime()
    + Instant getSource()

    + void setSpell();
    + void setPronounce();
    + void setfrequency();
    + void setforms();
    + void setSenseEntries();
    + void setSource()
    + void updateMtime()
    + void updateAtime()

    + void combine(SenseEntry other)
    + {static} ArrayList<SenseEntry> noDuplicatedSense(ArrayList<SenseEntry>
    senseEntryList)
}

class Pronounce {
    + String soundmark;
    + String[] sound;
}

class SenseEntry {
    + String wordClass;
    + String sense;
    + String[] examples;
}

class Formatter {
    - Word word

    + Wrod getWord()
    + void setWord(Word word)
    + void printText()
    + String toAnki()
}

class Printer {
    + {static} void toTerminal(String formattedWord)
}

class Extractor {
    - String input;

    + {static} Word collinsOnline()
    + {static} Word getWord(String text)
    + {static} String[] getAbility()
    + {static} Boolean ifCan(String ability)
}

class Request {
    - {static} String proxyHost
    - {static} int proxyPort
    - HttpClient client
    - HttpRequest.Builder requestBuilder
    - HttpResponse.BodyHandler bodyHandler
    - String url

    + HttpResponse<String> get()
    + HttpResponse<String> head()
    + HttpResponse<String> post()
    + HttpResponse<String> delete()
    + HttpResponse<String> put()
    + HttpResponse<String> option()

    + void setUrl()
    + void setClient()
    + void setRequestBuilder()
    + void setBodyHandler()
    + void setProxyHost()
    + void setProxyPort()

    + String getProxyHost()
    + int getProxyPort()
    + HttpClient getClient()
    + HttpRequest.Builder getRequestBuilder()
    + HttpResponse.BodyHandler getBodyHandler()
    + String getUrl()
}

class Database {
    - String propertiesFileName = ".../database.config";
    - String dbms;
    - String dbName;
    - String userName;
    - String password;
    - String urlString;
    - String driver;
    - String serverName;
    - int portNumber;
    - Properties prop;
    - Connection currentCon;

    + void getConnectionUseDbName()
    + void useDbName()
    + void getConnection()
    + void closeConnection()
    + boolean isConnected()
    + Connection getCurrentConUseDbName()
    + Connection getCurrentCon()

    + void createTable(String creatTableStr)
    + void addForeignKey(String addForeignKeyStr)
    + void dropTable(String dropTableStr)
    + void createDatabase()

    + {static} void printSQLException(SQLException e)
    + {static} bolean ignoreSQLException(String sqlState)
    + {static} void getWarningsFromResultSet(ResultSet rs)
    + {static} void getWarningsFromStatement(ResultSet rs)
    + {static} printWarnings(SQLWarning warning)

    + void setProperties()
}

Dict <|.. LocalDict
Dict <|.. OnlineDict
LocalDict <|.. DefaultLocalDict
LocalDict <|.. MITDict
OnlineDict <|.. CollinsOnlineDict
Word *-- Pronounce
Word *-- SenseEntry : sensenEntrylist
MITDict o-- Word
DefaultLocalDict o-- Word
Database -- App
App -- Dict
CollinsOnlineDict <-- Request
Request <-- Extractor
Extractor <-- Word
Word <-- Formatter
Formatter <-- Printer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published