NetDragons Beck Posters | Free Stock Charts
Games | Free Web Hosting | DVD | Books | Shop | Posters
Google
Name
Password
Save Password?



[-]NetDragons.com
[-]Games
 | [-]24 Hour Games
 |  | [+]Nelzan
 |  | [+]Space Frag I
 |  | [-]GNet Server
 |  |  | [+]Commands
 |  |  | [+]Forum
 |  |  | [+]Protocol
 |  |  | [-]Source
 |  | [+]About
 |  | [+]Forum
 |  | [+]License
 | [+]Cards of Tridala
 | [+]Flash Games
 | [+]Vagabond's Quest+
 | [+]Vagabond's Quest v.2
 | [+]Projects
[+]NetDragons.com Live!
[+]Reward Center
[+]Software Center
[+]Company Information
[+]Personal Services
[+]Member Directory
[+]Free E-mail
[+]Buy Cool Stuff
[+]Posters
[+]Your Privacy

Class Group


[ Source | Index | Back to GNS ]

public class Group
extends Object
Group - Stores group data and provides fast, easy data exchange between all members.

A vector of users is kept for each group and users can join or leave any group that matches their client/gameID.


Variable Index

 o gameID
The client/game ID that can connect to this group.
 o id
The groups ID.
 o mode
Information about the state or other group wide information.
 o server
An instance of the primary server.
 o title
The title or topic of the group.
 o toAll
Determins if data should be sent back to the client it came from.
 o useName
 o users
The Users that are in the group.

Constructor Index

 o Group(int, int, String, String, gnsd)
Creats and instance of a new group with all the required information.

Method Index

 o addUser(User)
Adds a user to the group.
 o checkGameID(int)
Checks to see if the passed ID is equal to the channel gameID.
 o checkID(int)
Checks to see if the passed ID is equal to the channel ID.
 o getID()
Gets the group ID.
 o getListData()
Gets that data that is sent to the client for the list.
 o getMode()
Gets the group's mode.
 o getTitle()
Gets the group's title/topic.
 o getUserList()
Displays the name of all the users that are in the group.
 o removeUser(User)
Removes a user from the group.
 o sendAll(String, int)
Transmits data to all members of the group.
 o sendPriv(String, String)
Sends a private message to only one user of the group.
 o setBroadcastType(boolean)
Sets the broadcast type.

Variables

 o users
 private Vector users
The Users that are in the group. This allows the server to send them data when require, to remove them from the group, and to keep an accurate user count for this channel.

 o server
 private gnsd server
An instance of the primary server. This is used to perform server level function, such as the removal of groups from the server.

 o id
 private int id
The groups ID.

 o gameID
 private int gameID
The client/game ID that can connect to this group.

 o title
 private String title
The title or topic of the group.

 o mode
 private String mode
Information about the state or other group wide information.

 o toAll
 private boolean toAll
Determins if data should be sent back to the client it came from.

 o useName
 public boolean useName

Constructors

 o Group
 public Group(int id,
              int gID,
              String t,
              String m,
              gnsd s)
Creats and instance of a new group with all the required information. The group starts out empty, and no information is sent to the client about a new group being formed.

Parameters:
id - the group id
gID - the Client/Game ID that can use this group
t - the group title/topic.
m - the group mode
s - Instance of the server.

Methods

 o checkID
 public boolean checkID(int cID)
Checks to see if the passed ID is equal to the channel ID. This is used by the server when checking if a channel with a given ID exists.

Parameters:
cID - the group ID to check
Returns:
true if cID == id, false otherwise.
See Also:
id
 o checkGameID
 public boolean checkGameID(int gID)
Checks to see if the passed ID is equal to the channel gameID. This is used when the server lists channels. If the game ID's don't match, the channel is not listed.

Parameters:
gID - the game ID to check
Returns:
true if gID == gameID, false otherwise.
See Also:
gameID
 o setBroadcastType
 public void setBroadcastType(boolean b)
Sets the broadcast type. This allows the client to either request data it sends back, or not.

Parameters:
b - do we want data back?
See Also:
toAll
 o addUser
 public void addUser(User u)
Adds a user to the group. This also sends the join command back to all clients that are in the group.

Parameters:
u - the user to add
 o removeUser
 public void removeUser(User u)
Removes a user from the group. This also sends the part command back to all the clients taht are in the group.

Parameters:
u - the user to remove.
 o getID
 public int getID()
Gets the group ID.

Returns:
the group ID.
See Also:
id
 o getTitle
 public String getTitle()
Gets the group's title/topic.

Returns:
the group's title.
See Also:
title
 o getMode
 public String getMode()
Gets the group's mode.

Returns:
the group's mode.
See Also:
mode
 o getUserList
 public String getUserList()
Displays the name of all the users that are in the group. They are seperated by a "," so the client can easily pick them appart.

Returns:
a string that list all the users.
 o getListData
 public String getListData()
Gets that data that is sent to the client for the list. Data is "id`title`mode`userCount".

See Also:
id, title, mode
 o sendAll
 public synchronized void sendAll(String data,
                                  int uID)
Transmits data to all members of the group. If toAll is set to fall the person who sends the data does not get a copy back.

Parameters:
data - the message to send
uID - the user who sent it.
See Also:
toAll
 o sendPriv
 public synchronized void sendPriv(String who,
                                   String data)
Sends a private message to only one user of the group. No Data is ever sent back to the originating client.

Parameters:
who - the person who is going to get the private message.
data - the private message
ND: VQ+, Mail, Shop, Free Web Hosting Free Stock Screener

Actor and Actress Posters
Copyrighted �, 2000, 2001 by NetDragons.com
Last Updated Sunday, March 21, 1999 - 23:55 EST