forked from KNEMC/KLALB
优化代码,性能暴涨
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package org.kne.cloud.network;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class PortPair {
|
||||
private int sport;
|
||||
private int dport;
|
||||
@Override
|
||||
public String toString() {
|
||||
return sport+"->"+dport;
|
||||
}
|
||||
public PortPair(int sport, int dport) {
|
||||
super();
|
||||
this.sport = sport;
|
||||
this.dport = dport;
|
||||
}
|
||||
public int getSport() {
|
||||
return sport;
|
||||
}
|
||||
public int getDport() {
|
||||
return dport;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(dport, sport);
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
PortPair other = (PortPair) obj;
|
||||
return dport == other.dport && sport == other.sport;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user