Class NetWordClient

java.lang.Object
  extended by NetWordClient
All Implemented Interfaces:
I_WordSource

public class NetWordClient
extends java.lang.Object
implements I_WordSource

Hangman network client. This class is the client side of a client-server network communication. Its purpose is to separate the communication issues from the game control logic. All we do is get a single secret word from the word server.


Field Summary
private  java.lang.String siteurl
          Site that returns a randomword
 
Constructor Summary
NetWordClient()
           
 
Method Summary
 java.lang.String getSecretWord()
          Obtain a secret word from a random word server.
static void main(java.lang.String[] args)
          a local main for unit testing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

siteurl

private java.lang.String siteurl
Site that returns a randomword

Constructor Detail

NetWordClient

public NetWordClient()
Method Detail

getSecretWord

public java.lang.String getSecretWord()
Obtain a secret word from a random word server. This method requires an internet connection.

Specified by:
getSecretWord in interface I_WordSource
Returns:
String the word which the player tries to guess. Word contains only alphabetic characters and no blanks. If error occurs getting the word, an empty string is returned.

main

public static void main(java.lang.String[] args)
a local main for unit testing