wyvern.common.net
Class RPCVersion

java.lang.Object
  extended bywyvern.common.net.RPCVersion

public class RPCVersion
extends java.lang.Object

Class for keeping track of the RPC protocol version for a given client. The RPCVersion is different from the client or server version, since the client or server may add features that don't require a protocol change.

Version:
1.0, Aug 23, 2003
Author:
Ron

Field Summary
 int a_
           
 int b_
           
 int c_
           
static RPCVersion DEFAULT_VERSION
           
static RPCVersion TERRAIN_OPTIMIZATION
           
static RPCVersion USE_ZLIB
           
 
Constructor Summary
RPCVersion(int a, int b, int c)
          Constructs a new RPCVersion
RPCVersion(RPCVersion v)
          Constructs a new RPCVersion by copying the values from another version.
RPCVersion(java.lang.String version)
          Constructs a new RPCVersion
 
Method Summary
 boolean equals(RPCVersion x)
          Returns true if these two RPCVersions are equal.
static RPCVersion extractVersion(java.lang.String version)
          Retrieves the RPC protocol version from the passed version string.
 int getMajor()
           
 int getMinor()
           
 int getRelease()
           
 boolean greaterThanOrEqual(RPCVersion lhs)
           
 int hashCode()
          If you override equals(), you have to override hashCode().
 boolean lessThan(RPCVersion lhs)
           
static void main(java.lang.String[] args)
          Testing function.
static RPCVersion parseVersion(java.lang.String version)
          Sets the version from a version string.
 java.lang.String toString()
          Returns string representation of this version: "a.b.c"
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_VERSION

public static final RPCVersion DEFAULT_VERSION

TERRAIN_OPTIMIZATION

public static final RPCVersion TERRAIN_OPTIMIZATION

USE_ZLIB

public static final RPCVersion USE_ZLIB

a_

public int a_

b_

public int b_

c_

public int c_
Constructor Detail

RPCVersion

public RPCVersion(java.lang.String version)
Constructs a new RPCVersion

Parameters:
version - a version string like "2.14.123"

RPCVersion

public RPCVersion(int a,
                  int b,
                  int c)
Constructs a new RPCVersion

Parameters:
a - major
b - minor
c - release

RPCVersion

public RPCVersion(RPCVersion v)
Constructs a new RPCVersion by copying the values from another version.

Method Detail

extractVersion

public static RPCVersion extractVersion(java.lang.String version)
Retrieves the RPC protocol version from the passed version string.

Parameters:
version - the string passed from the client
Returns:
the RPCVersion for this client, or the default version if we couldn't parse it

parseVersion

public static RPCVersion parseVersion(java.lang.String version)
Sets the version from a version string.


toString

public java.lang.String toString()
Returns string representation of this version: "a.b.c"


getMajor

public int getMajor()

getMinor

public int getMinor()

getRelease

public int getRelease()

equals

public boolean equals(RPCVersion x)
Returns true if these two RPCVersions are equal.


hashCode

public int hashCode()
If you override equals(), you have to override hashCode().

Returns:
the hashcode of this object.

greaterThanOrEqual

public boolean greaterThanOrEqual(RPCVersion lhs)

lessThan

public boolean lessThan(RPCVersion lhs)

main

public static void main(java.lang.String[] args)
Testing function.