added Comparable interface to VirtualNetworkConfig so we can sort arrays containing it.

This commit is contained in:
Grant Limberg 2015-06-23 23:03:02 -07:00
parent adf89901c4
commit 759d71037e

View File

@ -27,11 +27,13 @@
package com.zerotier.sdk;
import java.lang.Comparable;
import java.lang.Override;
import java.lang.String;
import java.util.ArrayList;
import java.net.InetSocketAddress;
public final class VirtualNetworkConfig {
public final class VirtualNetworkConfig implements Comparable<VirtualNetworkConfig> {
public static final int MAX_MULTICAST_SUBSCRIPTIONS = 4096;
public static final int ZT1_MAX_ZT_ASSIGNED_ADDRESSES = 16;
@ -80,6 +82,14 @@ public final class VirtualNetworkConfig {
aaEqual;
}
public int compareTo(VirtualNetworkConfig cfg) {
if(cfg.nwid == this.nwid) {
return 0;
} else {
return this.nwid > cfg.nwid ? 1 : -1;
}
}
/**
* 64-bit ZeroTier network ID
*/