com.threerings.presents.net
Class Transport

java.lang.Object
  extended by com.threerings.presents.net.Transport

public class Transport
extends Object

Message transport parameters. These include the type of transport and the channel (used to define independent streams for ordered transport), and may eventually include message priority, etc.


Nested Class Summary
static class Transport.Type
          The available types of transport.
 
Field Summary
protected  int _channel
          The transport channel.
protected static HashIntMap<Transport>[] _ordered
          Ordered instances mapped by type and channel.
protected  Transport.Type _type
          The type of transport.
protected static Transport[] _unordered
          Unordered instances mapped by type (would use EnumMap, but it doesn't work with Retroweaver).
static Transport DEFAULT
          The default mode of transport.
static Transport RELIABLE_ORDERED
          The reliable/ordered mode on the default channel.
static Transport RELIABLE_UNORDERED
          The reliable/unordered mode.
static Transport UNRELIABLE_ORDERED
          The unreliable/ordered mode on the default channel.
static Transport UNRELIABLE_UNORDERED
          The unreliable/unordered mode of transport.
 
Constructor Summary
protected Transport(Transport.Type type)
           
protected Transport(Transport.Type type, int channel)
           
 
Method Summary
 Transport combine(Transport other)
          Returns a transport that satisfies the requirements of this and the specified other transport.
 boolean equals(Object other)
           
 int getChannel()
          Returns the transport channel.
static Transport getInstance(Transport.Type type)
          Returns the shared instance with the specified parameters.
static Transport getInstance(Transport.Type type, int channel)
          Returns the shared instance with the specified parameters.
 Transport.Type getType()
          Returns the type of transport.
 int hashCode()
           
 boolean isOrdered()
          Checks whether this transport guarantees that messages will be received in the order in which they were sent, if they are received at all.
 boolean isReliable()
          Checks whether this transport guarantees that messages will be delivered.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

UNRELIABLE_UNORDERED

public static final Transport UNRELIABLE_UNORDERED
The unreliable/unordered mode of transport.


UNRELIABLE_ORDERED

public static final Transport UNRELIABLE_ORDERED
The unreliable/ordered mode on the default channel.


RELIABLE_UNORDERED

public static final Transport RELIABLE_UNORDERED
The reliable/unordered mode.


RELIABLE_ORDERED

public static final Transport RELIABLE_ORDERED
The reliable/ordered mode on the default channel.


DEFAULT

public static final Transport DEFAULT
The default mode of transport.


_type

protected Transport.Type _type
The type of transport.


_channel

protected int _channel
The transport channel.


_unordered

protected static Transport[] _unordered
Unordered instances mapped by type (would use EnumMap, but it doesn't work with Retroweaver).


_ordered

protected static HashIntMap<Transport>[] _ordered
Ordered instances mapped by type and channel.

Constructor Detail

Transport

protected Transport(Transport.Type type)

Transport

protected Transport(Transport.Type type,
                    int channel)
Method Detail

getInstance

public static Transport getInstance(Transport.Type type)
Returns the shared instance with the specified parameters.


getInstance

public static Transport getInstance(Transport.Type type,
                                    int channel)
Returns the shared instance with the specified parameters.


getType

public Transport.Type getType()
Returns the type of transport.


getChannel

public int getChannel()
Returns the transport channel.


isReliable

public boolean isReliable()
Checks whether this transport guarantees that messages will be delivered.


isOrdered

public boolean isOrdered()
Checks whether this transport guarantees that messages will be received in the order in which they were sent, if they are received at all.


combine

public Transport combine(Transport other)
Returns a transport that satisfies the requirements of this and the specified other transport.


hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object