|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.claudio.trainer.Model
public abstract class Model
Contains all the logic of this program. This is the logical data structure:
Note: This is not yet implemented. I'm yet undecided, if a media can be associated with only one or even several sentence. Probably several and so there is a need for a MediaConnection which performs the association. It is undisputed that a sentence can be associated with many medias e.g. an explaining picture and an audio sample of its pronunciation.
Not yet implemented.
Not yet implemented.
Not yet implemented.
Copyright (C) 2006-2008 Claudio Nieder <private@claudio.ch>, CH-8610 Uster
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Constructor Summary | |
---|---|
Model()
|
Method Summary | |
---|---|
static void |
addMedia(Media media)
Add some media (e.g. |
static void |
addSentence(java.lang.String language,
java.lang.String sentence,
User user)
Add a new sentence to the database. |
static void |
addUsedLanguages(java.lang.String languageCode)
Add a language to the table of languages to be used. |
static void |
associateSentence(Sentence from,
Sentence to,
ConnectionType type,
User user)
Create association between sentences. |
static java.util.SortedSet<Language> |
availableLanguages()
Find all languages which are not yet added to the used languages list. |
static boolean |
canLearn()
Are there any connections between words of different languages? |
static void |
close()
Close the access to the database. |
static void |
delSentence(Sentence sentence)
Add a new sentence to the database. |
static java.util.SortedSet<Language> |
getUsedLanguages()
Return the languages selected for usage. |
static boolean |
hasConnectableWords()
Are there at least two words so that connections can be made? |
static void |
initDB()
Create the connection to the database. |
static java.lang.String[] |
languageNames(java.lang.String[] langCodes)
Map language codes to display text which contains the name in the current locale as well as in the locale of the given language (if available). |
static void |
main(java.lang.String[] args)
Print license. |
static ConnectedWords |
randomConnection()
Find a pair of words where one sentence belongs to a known language, while the other belongs to an unknown language. |
void |
reassociateMedia(Media media,
Sentence sentence)
Associate a different sentence to a media. |
static void |
removeUsedLanguages(java.lang.String languageCode)
|
static java.util.List<Sentence> |
searchSentence(java.lang.String language,
java.lang.String snippet,
boolean headMatch)
Look which sentences in a given language match the given string. |
static void |
setLanguageKnown(java.lang.String languageCode,
boolean known)
Change the languag flag |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Model()
Method Detail |
---|
public static void initDB()
public static void close()
public static java.util.SortedSet<Language> availableLanguages()
public static java.util.SortedSet<Language> getUsedLanguages()
public static void addUsedLanguages(java.lang.String languageCode)
languageCode
- public static void removeUsedLanguages(java.lang.String languageCode)
languageCode
- public static void setLanguageKnown(java.lang.String languageCode, boolean known)
languageCode
- to modifyknown
- new valuepublic static void addSentence(java.lang.String language, java.lang.String sentence, User user)
language
- sentence
- user
- public static java.util.List<Sentence> searchSentence(java.lang.String language, java.lang.String snippet, boolean headMatch)
language
- snippet
- headMatch
- true=snippet must match head of sentence, false=snippet
must match some part of the sentence
public static boolean hasConnectableWords()
public static boolean canLearn()
Note: Currently implemented just as returning if there are any connections.
public static void associateSentence(Sentence from, Sentence to, ConnectionType type, User user)
from
- "left" side of associationto
- "right" side of associationtype
- kind of associationuser
- user who created itpublic static ConnectedWords randomConnection()
public static void addMedia(Media media)
media
- public void reassociateMedia(Media media, Sentence sentence)
media
- sentence
- public static void delSentence(Sentence sentence)
sentence
- public static java.lang.String[] languageNames(java.lang.String[] langCodes)
langCodes
- Array of language codes
public static void main(java.lang.String[] args)
args
- ignored
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |