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
-
generalId
- The identity of the last Square created.
-
iconName
-
-
id
-
the identity of this square.
-
letter
- Letter that is contained by the Square
-
o
- Square must be Observable by the Square of the Client.
-
RQ_SQUAREEMPTY
- The request which indicates that the Square becomes empty.
-
RQ_SQUAREGETLETTER
- The request which indicates that the Square received a letter.
-
SQUARE_GROUP
-
Frame group : for communication between Square objects
-
squareLabel
- The Panel which represents the DoubleLetterSquare.
-
Square()
- Creates a new Square
-
addObserver(Observer)
- Adds an observer to the set of observers for this object.
-
checkComponent(String)
- Helper for the representation of the Square.
-
countObservers()
- Returns the number of observers of this object.
-
createLinkframe(int, Object, int)
- Creates a new LinkFrame, which concerns only one Square.
-
deleteObserver(Observer)
- Deletes an observer to the set of observers for this object.
-
deleteObservers()
- Clears the observerlist so that this object no longer has any observers.
-
frameReceived(Object, LinkFrame)
- Invoked when a new data frame is received.
-
getComponent()
- Returns a GUI representation of the Square.
-
getId()
- Return the Square's identity
-
getLetter()
- Returns the letter that is contained by the Square
-
getNewId()
- This method is called when a Square is created.
-
isEmpty()
- Indicates if a Square is empty or not
-
notifyObservers(LinkFrame)
- Notifies all the observers of this Square that it has changed and indicates this
changement by a frame.
-
putLetter(Letter)
- Puts a letter in the Square
-
setEmpty()
- Empties the Square
-
toString()
- Returns a string representation of the object.
letter
transient Letter letter
- Letter that is contained by the Square
generalId
static int generalId
- The identity of the last Square created.
id
int id
- the identity of this square.
iconName
String iconName
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().
RQ_SQUAREEMPTY
public static final int RQ_SQUAREEMPTY
- The request which indicates that the Square becomes empty.
RQ_SQUAREGETLETTER
public static final int RQ_SQUAREGETLETTER
- The request which indicates that the Square received a letter.
SQUARE_GROUP
public static final int SQUARE_GROUP
- Frame group : for communication between Square objects
squareLabel
JLabel squareLabel
- The Panel which represents the DoubleLetterSquare.
Square
public Square()
- Creates a new Square
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.
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.
addObserver
public void addObserver(Observer obs)
- Adds an observer to the set of observers for this object.
- Parameters:
- obs - an observer to be added.
deleteObserver
public void deleteObserver(Observer obs)
- Deletes an observer to the set of observers for this object.
- Parameters:
- obs - the observer to be deleted
deleteObservers
public void deleteObservers()
- Clears the observerlist so that this object no longer has any observers.
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.
countObservers
public int countObservers()
- Returns the number of observers of this object.
- Returns:
- the number of observers of this object.
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;
getId
public int getId()
- Return the Square's identity
- Returns:
- the Square's identity
putLetter
public void putLetter(Letter newletter)
- Puts a letter in the Square
- Parameters:
- newletter - the new letter contained by the Square
getLetter
public Letter getLetter()
- Returns the letter that is contained by the Square
- Returns:
- the letter
setEmpty
public void setEmpty()
- Empties the Square
isEmpty
public boolean isEmpty()
- Indicates if a Square is empty or not
- Returns:
- true if the Square is empty, false otherwise
toString
public String toString()
- Returns a string representation of the object.
- Overrides:
- toString in class Object
getComponent
public Component getComponent()
- Returns a GUI representation of the Square.
checkComponent
public void checkComponent(String iconName)
- Helper for the representation of the Square.
All Packages Class Hierarchy This Package Previous Next Index