All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class scrobble.square.Square

java.lang.Object
   |
   +----scrobble.square.Square

public class Square
extends Object
implements Serializable
Square.java The Square class represents a square in the Board of Scrabble. It contains Letter objects. It is the root class of a wide hierarchy of other squares class.

See Also:
Board, Letter

Variable Index

 o generalId
The identity of the last Square created.
 o iconName
 o id
the identity of this square.
 o letter
Letter that is contained by the Square
 o o
Square must be Observable by the Square of the Client.
 o RQ_SQUAREEMPTY
The request which indicates that the Square becomes empty.
 o RQ_SQUAREGETLETTER
The request which indicates that the Square received a letter.
 o SQUARE_GROUP
Frame group : for communication between Square objects
 o squareLabel
The Panel which represents the DoubleLetterSquare.

Constructor Index

 o Square()
Creates a new Square

Method Index

 o addObserver(Observer)
Adds an observer to the set of observers for this object.
 o checkComponent(String)
Helper for the representation of the Square.
 o countObservers()
Returns the number of observers of this object.
 o createLinkframe(int, Object, int)
Creates a new LinkFrame, which concerns only one Square.
 o deleteObserver(Observer)
Deletes an observer to the set of observers for this object.
 o deleteObservers()
Clears the observerlist so that this object no longer has any observers.
 o frameReceived(Object, LinkFrame)
Invoked when a new data frame is received.
 o getComponent()
Returns a GUI representation of the Square.
 o getId()
Return the Square's identity
 o getLetter()
Returns the letter that is contained by the Square
 o getNewId()
This method is called when a Square is created.
 o isEmpty()
Indicates if a Square is empty or not
 o notifyObservers(LinkFrame)
Notifies all the observers of this Square that it has changed and indicates this changement by a frame.
 o putLetter(Letter)
Puts a letter in the Square
 o setEmpty()
Empties the Square
 o toString()
Returns a string representation of the object.

Variables

 o letter
 transient Letter letter
Letter that is contained by the Square

 o generalId
 static int generalId
The identity of the last Square created.

 o id
 int id
the identity of this square.

 o iconName
 String iconName
 o o
 protected transient Observable o
Square must be Observable by the Square of the Client. So needs the object o to have the methods addObserver(), deleteObserver() and notifyObserver().

 o RQ_SQUAREEMPTY
 public static final int RQ_SQUAREEMPTY
The request which indicates that the Square becomes empty.

 o RQ_SQUAREGETLETTER
 public static final int RQ_SQUAREGETLETTER
The request which indicates that the Square received a letter.

 o SQUARE_GROUP
 public static final int SQUARE_GROUP
Frame group : for communication between Square objects

 o squareLabel
 JLabel squareLabel
The Panel which represents the DoubleLetterSquare.

Constructors

 o Square
 public Square()
Creates a new Square

Methods

 o createLinkframe
 public LinkFrame createLinkframe(int request,
                                  Object data,
                                  int squareid)
Creates a new LinkFrame, which concerns only one Square.

Parameters:
request - the request of the frame.
data - the data of the frame (The Letter in the Square of nothing if the Square becomes Empty).
squareid - the identity of the Square which is concerned by the request.
 o frameReceived
 public void frameReceived(Object link,
                           LinkFrame frame)
Invoked when a new data frame is received.

Parameters:
frame - the frame that has just been received.
 o addObserver
 public void addObserver(Observer obs)
Adds an observer to the set of observers for this object.

Parameters:
obs - an observer to be added.
 o deleteObserver
 public void deleteObserver(Observer obs)
Deletes an observer to the set of observers for this object.

Parameters:
obs - the observer to be deleted
 o deleteObservers
 public void deleteObservers()
Clears the observerlist so that this object no longer has any observers.

 o notifyObservers
 public void notifyObservers(LinkFrame frame)
Notifies all the observers of this Square that it has changed and indicates this changement by a frame.

Parameters:
frame - the Linkframe that indicates the changement.
 o countObservers
 public int countObservers()
Returns the number of observers of this object.

Returns:
the number of observers of this object.
 o getNewId
 public synchronized int getNewId()
This method is called when a Square is created. It gives to this new Square his identity.

Returns:
the Square's new identity;
 o getId
 public int getId()
Return the Square's identity

Returns:
the Square's identity
 o putLetter
 public void putLetter(Letter newletter)
Puts a letter in the Square

Parameters:
newletter - the new letter contained by the Square
 o getLetter
 public Letter getLetter()
Returns the letter that is contained by the Square

Returns:
the letter
 o setEmpty
 public void setEmpty()
Empties the Square

 o isEmpty
 public boolean isEmpty()
Indicates if a Square is empty or not

Returns:
true if the Square is empty, false otherwise
 o toString
 public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
 o getComponent
 public Component getComponent()
Returns a GUI representation of the Square.

 o checkComponent
 public void checkComponent(String iconName)
Helper for the representation of the Square.


All Packages  Class Hierarchy  This Package  Previous  Next  Index