Logging and adding .equals() methods to MulticastGroup and VirtualNetworkCofnig

This commit is contained in:
Grant Limberg 2015-06-09 19:38:05 -07:00
parent 7cc64c5cb6
commit ced040c503
4 changed files with 54 additions and 10 deletions

View file

@ -33,6 +33,10 @@ public final class MulticastGroup {
private long mac;
private long adi;
public boolean equals(MulticastGroup other) {
return mac == other.mac && adi == other.adi;
}
/**
* MAC address (least significant 48 bits)
*/

View file

@ -54,6 +54,44 @@ public final class VirtualNetworkConfig {
}
public boolean equals(VirtualNetworkConfig cfg) {
boolean mcgEqual = true;
if(multicastSubscriptions.length == cfg.multicastSubscriptions.length) {
for(int i = 0; i < multicastSubscriptions.length; ++i) {
if(!multicastSubscriptions[i].equals(cfg.multicastSubscriptions[i]))
{
return false;
}
}
} else {
mcgEqual = false;
}
boolean aaEqual = true;
if(assignedAddresses.length == cfg.assignedAddresses.length) {
for(int i = 0; i < assignedAddresses.length; ++i) {
if(!assignedAddresses[i].equals(cfg.assignedAddresses[i])) {
return false;
}
}
} else {
aaEqual = false;
}
return nwid == cfg.nwid &&
mac == cfg.mac &&
name.equals(cfg.name) &&
status.equals(cfg.status) &&
type.equals(cfg.type) &&
mtu == cfg.mtu &&
dhcp == cfg.dhcp &&
bridge == cfg.bridge &&
broadcastEnabled == cfg.broadcastEnabled &&
portError == cfg.portError &&
enabled == cfg.enabled &&
mcgEqual && aaEqual;
}
/**
* 64-bit ZeroTier network ID
*/