View Javadoc

1   /*
2   @See License.txt@
3    */
4   
5   package spellcast.net;
6   
7   import java.io.*;
8   
9   /***
10   * This class contains the status of the server for new connections.
11   * The server can be in one of the following states for new connections:
12   * <ul>
13   *   <li> ACCEPTING
14   *   <li> OBSERVERS_ONLY
15   *   <li> CLOSED
16   * </ul>
17   *
18   * @author Barrie Treloar
19   */
20  public class ConnectionStatus
21      implements Serializable
22  {
23      public final static ConnectionStatus ACCEPTING = new ConnectionStatus( "Accepting" );
24      public final static ConnectionStatus OBSERVERS_ONLY = new ConnectionStatus( "Observers Only" );
25      public final static ConnectionStatus CLOSED = new ConnectionStatus( "Closed" );
26  
27      private String status;
28      
29      private ConnectionStatus( String status )
30      {
31          this.status = status;
32      }
33  
34      public String toString()
35      {
36          return status;
37      }
38  
39      public boolean equals( Object obj )
40      {
41          boolean result = false;
42  
43          if ( obj instanceof ConnectionStatus )
44          {
45              ConnectionStatus other = (ConnectionStatus)obj;
46              if ( status.equals( other.status ) )
47              {
48                  result = true;
49              }
50          }
51  
52          return result;
53      }
54  }