public final class TcpUdpPortPair extends CacheableDataType implements Comparable<TcpUdpPortPair>
IpAddress and
TcpUdpPort and a destination IpAddress and
TcpUdpPort.
All constructors for this class are private. Creating instances of
TcpUdpPortPair is done via the static valueOf(com.h3c.util.ip.IpAddress, com.h3c.util.ip.TcpUdpPort, com.h3c.util.ip.IpAddress, com.h3c.util.ip.TcpUdpPort) methods
on the class.
Instances of this class are immutable, making them inherently thread-safe.
This class overrides equals(java.lang.Object) and hashCode() so that instances
play nicely with the Collection classes.
This class implements the Comparable interface to ensure that
a sorted list of pairs is presented in an intuitive order.
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(TcpUdpPortPair o)
This implementation of the
Comparable interface sorts by
source IP/port first, then destination IP/port. |
boolean |
equals(Object o) |
IpAddress |
getDestinationIp()
Returns the IP address of the destination.
|
TcpUdpPort |
getDestinationPort()
Returns the port of the destination.
|
IpAddress |
getSourceIp()
Returns the IP address of the source.
|
TcpUdpPort |
getSourcePort()
Returns the port of the source.
|
int |
hashCode() |
String |
toShortString()
Returns the string representation of this port pair, without including
the well-known names of the ports.
|
String |
toString()
Returns the string representation of this port pair, including the
well-known names of the ports.
|
static TcpUdpPortPair |
valueOf(IpAddress sourceIp,
TcpUdpPort sourcePort,
IpAddress destIp,
TcpUdpPort destPort)
Returns a
TcpUdpPortPair object that represents the source and
destination ports specified by the given IP addresses and TCP/UDP ports. |
getRefQ, keyFromBytespublic IpAddress getSourceIp()
public TcpUdpPort getSourcePort()
public IpAddress getDestinationIp()
public TcpUdpPort getDestinationPort()
public String toString()
toString in class ObjecttoShortString()public String toShortString()
toString()public int compareTo(TcpUdpPortPair o)
Comparable interface sorts by
source IP/port first, then destination IP/port.compareTo in interface Comparable<TcpUdpPortPair>o - the other pairpublic static TcpUdpPortPair valueOf(IpAddress sourceIp, TcpUdpPort sourcePort, IpAddress destIp, TcpUdpPort destPort)
TcpUdpPortPair object that represents the source and
destination ports specified by the given IP addresses and TCP/UDP ports.sourceIp - the IP address of the sourcesourcePort - the TCP/UDP port of the sourcedestIp - the IP address of the destinationdestPort - the TCP/UDP port of the destinationNullPointerException - if any of the parameters are nullIllegalArgumentException - if the port protocols don't matchCopyright © 2014. All Rights Reserved.