org.jdesktop.wonderland.common.comms
Class DefaultProtocolVersion

java.lang.Object
  extended by org.jdesktop.wonderland.common.comms.DefaultProtocolVersion
All Implemented Interfaces:
java.io.Serializable, ProtocolVersion
Direct Known Subclasses:
WonderlandProtocolVersion

public class DefaultProtocolVersion
extends java.lang.Object
implements ProtocolVersion, java.io.Serializable

A default implementation of ProtocolVersion. Two ProtocolVersions of this type are compatible if the major and minor numbers are the same, and the sub-version is less than or equal to the current version.

Author:
jkaplan
See Also:
Serialized Form

Constructor Summary
DefaultProtocolVersion(int majorVersion, int minorVersion, int subVersion)
          Create a new DefaultProtocolVersion with the given major, minor and sub version numbers
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int getMajorVersion()
          Get the major version
 int getMinorVersion()
          Get the minor version
 int getSubVersion()
          Get the sub version
 int hashCode()
           
 boolean isCompatible(ProtocolVersion version)
          Determine if this version is compatible with the given protocol version
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultProtocolVersion

public DefaultProtocolVersion(int majorVersion,
                              int minorVersion,
                              int subVersion)
Create a new DefaultProtocolVersion with the given major, minor and sub version numbers

Parameters:
majorVersion - the major version number
minorVersion - the minor version number
subVersion - the sub version number
Method Detail

getMajorVersion

public int getMajorVersion()
Get the major version

Returns:
the major version

getMinorVersion

public int getMinorVersion()
Get the minor version

Returns:
the minor version

getSubVersion

public int getSubVersion()
Get the sub version

Returns:
the sub version

isCompatible

public boolean isCompatible(ProtocolVersion version)
Determine if this version is compatible with the given protocol version

Specified by:
isCompatible in interface ProtocolVersion
Parameters:
version - the version to compare to
Returns:
true if the versions are compatible, and false if not.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Open Wonderland - http://openwonderland.org