net.jetrix
Interface Protocol

All Known Implementing Classes:
ConsoleProtocol, IRCProtocol, QueryProtocol, TetrifastProtocol, TetrinetProtocol, TspecProtocol

public interface Protocol

A protocol to communicate with a client. A protocol is responsible for transforming the messages in string format comming for a client into the corresponding server Message, as well as performing the reverse operation.

Version:
$Revision: 393 $, $Date: 2004-06-04 16:44:04 +0200 (ven., 04 juin 2004) $
Author:
Emmanuel Bourg

Method Summary
 String applyStyle(String text)
          Transform the style tags (<blue>, <u>, etc...) contained in the specified string into the style codes of this protocol.
 char getEOL()
          Return the end of line character used by this protocol.
 Message getMessage(String message)
          Parse the specified string and return the corresponding server message for this protocol.
 String getName()
          Return the name of this protocol.
 String translate(Message m, Locale locale)
          Translate the specified message into a string that will be sent to a client using this protocol.
 

Method Detail

getName

String getName()
Return the name of this protocol.

Returns:
the name of this protocol

getMessage

Message getMessage(String message)
Parse the specified string and return the corresponding server message for this protocol.

Parameters:
message - the client message to parse
Returns:
the Message equivalent of the specified String or null if the protocol cannot understand the message.

translate

String translate(Message m,
                 Locale locale)
Translate the specified message into a string that will be sent to a client using this protocol.

Parameters:
m - the message to translate
locale - the locale used for internationalized text messages
Returns:
the String equivalent in this protocol for the specified Message or null if it can't be translated.

applyStyle

String applyStyle(String text)
Transform the style tags (<blue>, <u>, etc...) contained in the specified string into the style codes of this protocol.

Parameters:
text - the string to transform
Returns:
the stylized representation of the specified string for this protocol.

getEOL

char getEOL()
Return the end of line character used by this protocol.



Copyright © 2001-2008 Emmanuel Bourg. All Rights Reserved.