|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--wtanaka.praya.Protocol
|
+--wtanaka.praya.dict.DictClient
Main entry point for this package.
| Field Summary | |
private static java.lang.String[] |
defaultStratDesc
|
private static java.lang.String[] |
defaultStrategies
|
private java.net.Socket |
dictSocket
|
private java.lang.String |
m_database
|
private Recipient |
m_dictRecipient
|
private java.lang.String |
m_server
|
private java.lang.Thread |
myThread
|
static int |
port
|
private java.io.BufferedReader |
sockIn
|
private java.io.PrintWriter |
sockOut
|
private java.lang.String[] |
strategies
|
private int |
strategy
|
private java.lang.String[] |
strategyDesc
|
| Fields inherited from class wtanaka.praya.Protocol |
descriptionListeners, iAmGarbage, m_buddyList, m_configPanel, m_currentDescription, m_messageListeners, recipientListeners |
| Constructor Summary | |
DictClient()
|
|
DictClient(java.lang.String server)
|
|
| Method Summary | |
void |
checkForNewMessages(boolean isAutomatic)
Checks for new messages on the protocol. |
void |
connect()
Connects to the network, if that makes any sense. |
CommandInterface[] |
consoleCommands()
Command-based input to the DictClient. |
void |
disconnect()
Disconnects from the network, if that makes any sense. |
Recipient |
getDefaultRecipient()
|
static java.awt.Image |
getIcon()
|
static java.lang.String |
getProtocolDescription()
Used to describe the class of this protocol, before any instances have been created. |
java.lang.String |
getServer()
The name of the DICT server to which this DictClient instance will next connect. |
java.lang.String[] |
getStrategies()
|
boolean |
isConnected()
Returns if the protocol is connected right now. |
private Definition |
parse151()
|
private java.lang.String |
parseAtom()
|
private java.lang.String |
parseSqDqOrPair()
|
private java.lang.String |
parseString()
|
private java.lang.String |
parseWord()
|
private Message |
process(java.lang.String response)
processes the given message, returning a Message if the user should get a message. |
void |
run()
|
void |
sendCommand(java.lang.String command)
Sends the verbatim command passed in as a parameter to the dict server |
private void |
setServer(java.lang.String server)
Sets the server to which this DictClient will next connect |
void |
setStatus(Status status)
Nobody else is ever able to see our status, so this method call does nothing. |
private void |
updateDescription(java.lang.String server)
|
private java.lang.String |
wordAt(java.lang.String line,
int offset)
|
| Methods inherited from class java.lang.Object |
|
| Field Detail |
public static final int port
private java.lang.String m_server
private java.net.Socket dictSocket
private java.io.PrintWriter sockOut
private java.io.BufferedReader sockIn
private java.lang.Thread myThread
private java.lang.String m_database
private static final java.lang.String[] defaultStrategies
private static final java.lang.String[] defaultStratDesc
private java.lang.String[] strategies
private java.lang.String[] strategyDesc
private int strategy
private final Recipient m_dictRecipient
| Constructor Detail |
public DictClient()
public DictClient(java.lang.String server)
| Method Detail |
public void checkForNewMessages(boolean isAutomatic)
ProtocolcheckForNewMessages in class Protocolwtanaka.praya.ProtocolisAutomatic - true if the check is generated automatically with a
timer. false if the check is generated manually by the user.public java.lang.String[] getStrategies()
public void connect()
throws java.io.IOException
Protocolconnect in class Protocolwtanaka.praya.Protocoljava.io.IOException - if the connection fails due to an I/O error.java.lang.InterruptedException - todo, why does it throw this?public void disconnect()
Protocoldisconnect in class Protocolpublic void setStatus(Status status)
setStatus in class Protocolpublic boolean isConnected()
ProtocolisConnected in class Protocolprivate final void updateDescription(java.lang.String server)
public Recipient getDefaultRecipient()
getDefaultRecipient in class Protocolpublic void sendCommand(java.lang.String command)
the - command to sendpublic CommandInterface[] consoleCommands()
/HELP : this message /SERVER <hostname>: switch DICT server (does not reconnect) /CONNECT : connect to server /DISCONNECT : disconnect from server /SERVERHELP : get help from server /STRATEGY foo : change strategy to foo /DATABASE foo : change database to foo (! first match, * for all) /DEFINE foo : define a word /MATCH foo : search for a word
consoleCommands in class Protocol
private java.lang.String parseSqDqOrPair()
throws ParseException,
java.io.IOException
private java.lang.String parseString()
throws ParseException,
java.io.IOException
private java.lang.String parseAtom()
throws java.io.IOException
private java.lang.String parseWord()
throws ParseException,
java.io.IOException
private Definition parse151()
throws java.io.IOException
private java.lang.String wordAt(java.lang.String line,
int offset)
private Message process(java.lang.String response)
throws java.io.InterruptedIOException,
java.io.IOException
public static java.awt.Image getIcon()
public static java.lang.String getProtocolDescription()
public void run()
run in interface java.lang.Runnablepublic java.lang.String getServer()
private void setServer(java.lang.String server)
server - the name of the server e.g. "dict.org"
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||