Methods Summary |
---|
public void | addMergedEntry(org.gudy.azureus2.core3.ipfilter.IpRange e2)
if (my_merged_entries == null) {
my_merged_entries = new IpRange[] { e2 };
} else {
IpRange[] x = new IpRange[my_merged_entries.length + 1];
System.arraycopy(my_merged_entries, 0, x, 0, my_merged_entries.length);
x[x.length - 1] = e2;
my_merged_entries = x;
}
|
public void | checkValid()
((IpFilterImpl) IpFilterImpl.getInstance()).setValidOrNot(this, isValid());
|
public int | compareDescription(org.gudy.azureus2.core3.ipfilter.IpRange other)
return getDescription().compareTo(other.getDescription());
|
public int | compareEndIpTo(org.gudy.azureus2.core3.ipfilter.IpRange other)
long l = getEndIpLong() - ((IpRangeImpl) other).getEndIpLong();
if (l < 0) {
return (-1);
} else if (l > 0) {
return (1);
}
return (0);
|
public int | compareStartIpTo(org.gudy.azureus2.core3.ipfilter.IpRange other)
long l = getStartIpLong() - ((IpRangeImpl) other).getStartIpLong();
if (l < 0) {
return (-1);
} else if (l > 0) {
return (1);
} else {
return (0);
}
|
public boolean | getAddedToRangeList()
return (flags & FLAG_ADDED_TO_RANGE_LIST) != 0;
|
protected java.lang.Object | getDescRef()
return descRef;
|
public java.lang.String | getDescription()
return new String(IpFilterManagerFactory.getSingleton().getDescription(
descRef));
|
public java.lang.String | getEndIp()
return (flags & FLAG_INVALID_END) > 0 ? "" : PRHelpers.intToAddress(ipEnd);
|
public long | getEndIpLong()
if ((flags & FLAG_INVALID_END) > 0) {
return -1;
}
long val = ipEnd;
if (val < 0) {
val += 0x100000000L;
}
return (val);
|
public boolean | getMerged()
return (flags & FLAG_MERGED) != 0;
|
public long | getMergedEndLong()
return (merged_end < 0 ? (merged_end + 0x100000000L) : merged_end);
|
public org.gudy.azureus2.core3.ipfilter.IpRange[] | getMergedEntries()
return (my_merged_entries);
|
public java.lang.String | getStartIp()
return (flags & FLAG_INVALID_START) > 0 ? ""
: PRHelpers.intToAddress(ipStart);
|
public long | getStartIpLong()
if ((flags & FLAG_INVALID_START) > 0) {
return -1;
}
long val = ipStart;
if (val < 0) {
val += 0x100000000L;
}
return (val);
|
public boolean | isInRange(java.lang.String ipAddress)
if (!isValid()) {
return false;
}
try {
long int_address = PRHelpers.addressToInt(ipAddress);
if (int_address < 0) {
int_address += 0x100000000L;
}
long start_address = ipStart;
long end_address = ipEnd;
if (start_address < 0) {
start_address += 0x100000000L;
}
if (end_address < 0) {
end_address += 0x100000000L;
}
return (int_address >= start_address && int_address <= end_address);
} catch (UnknownHostException e) {
return (false);
}
|
public boolean | isSessionOnly()
return (flags & FLAG_SESSION_ONLY) != 0;
|
public boolean | isValid()
if ((flags & FLAG_INVALID) > 0) {
return false;
}
long start_address = ipStart;
long end_address = ipEnd;
if (start_address < 0) {
start_address += 0x100000000L;
}
if (end_address < 0) {
end_address += 0x100000000L;
}
return (end_address >= start_address);
|
public void | resetMergeInfo()
flags &= ~FLAG_MERGED;
if ((flags & FLAG_INVALID_END) == 0) {
merged_end = ipEnd;
}
|
protected void | setAddedToRangeList(boolean b)
if (b) {
flags |= FLAG_ADDED_TO_RANGE_LIST;
} else {
flags &= ~FLAG_ADDED_TO_RANGE_LIST;
}
|
protected void | setDescRef(java.lang.Object descRef)
this.descRef = descRef;
|
public void | setDescription(java.lang.String str)
descRef = IpFilterManagerFactory.getSingleton().addDescription(this,
str.getBytes());
|
public void | setEndIp(java.lang.String str)
if (str == null) {
throw (new RuntimeException("Invalid end value - null not supported"));
}
if (str.equals(getEndIp())) {
return;
}
flags &= ~FLAG_INVALID_END;
try {
ipEnd = PRHelpers.addressToInt(str);
} catch (UnknownHostException e) {
flags |= FLAG_INVALID_END;
}
if ((flags & FLAG_INVALID) == 0) {
checkValid();
}
|
public void | setMerged()
flags |= FLAG_MERGED;
|
public void | setMergedEnd(long endIpLong)
merged_end = (int) (endIpLong >= 0x100000000L ? endIpLong - 0x100000000L
: endIpLong);
|
public void | setSessionOnly(boolean _sessionOnly)
if (_sessionOnly) {
flags |= FLAG_SESSION_ONLY;
} else {
flags &= ~FLAG_SESSION_ONLY;
}
|
public void | setStartIp(java.lang.String str)
if (str == null) {
throw (new RuntimeException("Invalid start value - null not supported"));
}
if (str.equals(getStartIp())) {
return;
}
flags &= ~FLAG_INVALID_START;
try {
ipStart = PRHelpers.addressToInt(str);
} catch (UnknownHostException e) {
flags |= FLAG_INVALID_START;
}
if ((flags & FLAG_INVALID) == 0) {
checkValid();
}
|
public java.lang.String | toString()
return getDescription() + " : " + getStartIp() + " - " + getEndIp();
|