Skip to content

Commit

Permalink
clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Foley committed Mar 3, 2024
1 parent a95390e commit 808fc2f
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ public boolean prefixContains(IPAddressSegment other, int prefixLength) {
protected boolean containsSeg(AddressSegment other) {
return other.getSegmentValue() >= getSegmentValue() && other.getUpperSegmentValue() <= getUpperSegmentValue();
}

/**
*
* @param other
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,8 @@ public byte[] getUpperBytes(byte bytes[]) {
* @return the number of digits for the maximum possible value of the division when using the default radix
*/
protected abstract int getMaxDigitCount();


// Returns the maximum number of digits required for the given bit-count and radix.
// The supplied maximum value can be null, in which case it will be calculated if needed,
// otherwise it must correspond to the largest unsigned integer corresponding to the given bit-count.
Expand Down Expand Up @@ -423,7 +423,7 @@ protected static int getMaxDigitCount(int radix, int bitCount, long maxValue) {
}
result++;
}

@SuppressWarnings("unchecked")
TreeMap<Long, Integer> newMaxDigitMap = (TreeMap<Long, Integer>) maxDigitMap.clone();
newMaxDigitMap.put(key, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public interface IPAddressRange extends AddressComponentRange {
* @return
*/
boolean contains(IPAddress other);

/**
* Returns whether this range overlaps with the given sequential range
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ private OpResult(E addr, Operation op, boolean floor, boolean exclusive) {
this.nearestFloor = floor;
this.nearExclusive = exclusive;
}

// do not use with Operation.NEAR, INSERT, REMAP, INSERTED_DELETE, SUBTREE_DELETE
OpResult<E> reset(E addr, Operation op) {
this.addr = addr;
Expand Down Expand Up @@ -1019,7 +1019,6 @@ public Spliterator<E> descendingSpliterator() {
return new KeySpliterator<E>(nodeSpliterator(false, true), reverseComparator());
}


@Override
public boolean contains(E addr) {
return doLookup(addr).exists;
Expand Down Expand Up @@ -1140,7 +1139,6 @@ void matchBitsFromIndex(int bitIndex, OpResult<E> result) {
// reached the end of the line
break;
}

// Matched a sub-node.
// The sub-node was chosen according to the next bit.
// That bit is therefore now a match,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ default TrieNode<E> getAddedNode(E addr) {
* @return
*/
E longestPrefixMatch(E addr);

/**
* Finds the containing subnet or address in the trie with the largest subnet size,
* which is equivalent to finding the subnet or address with the shortest matching prefix.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public AssociativeTrieNode<K,V> getParent() {
return (AssociativeTrieNode<K,V>) super.getParent();
}

@SuppressWarnings("unchecked")
@SuppressWarnings("unchecked")
@Override
public V get(K addr) {
AssociativeTrieNode<K,V> node = (AssociativeTrieNode<K,V>) doLookup(addr).existingNode;
Expand Down Expand Up @@ -516,11 +516,11 @@ protected void contructAssociativeAddedTree(AssociativeAddressTrie<K, SubNodesMa
emptyTrie.containingFirstAllNodeIterator(true);

Iterator<? extends AssociativeTrieNode<K, V>> thisIterator = containingFirstAllNodeIterator(true);

while(cachingIterator.hasNext()) {
AssociativeTrieNode<K, SubNodesMappingAssociative<K, V>> newNext = cachingIterator.next(), parent;
AssociativeTrieNode<K, V> thisNext = thisIterator.next();

SubNodesMappingAssociative<K,V> mapping = new SubNodesMappingAssociative<K,V>();
mapping.value = thisNext.getValue();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ protected boolean containsNonZeroHostsImpl(IPAddressSection other, int otherPref
}
return false;
}

static BigInteger enumerate(IPv4AddressSection addr, AddressSection other) {
return enumerateBig(addr, other);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2433,7 +2433,7 @@ public boolean contains(Address other) {
}
return false;
}

@Override
public BigInteger enumerate(Address other) {
if(other instanceof IPv6Address) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3126,7 +3126,7 @@ boolean compressMixed(IPv6AddressSection addressSection) {

//options for addresses with an ipv4 section
public final MixedCompressionOptions compressMixedOptions;

public CompressOptions(boolean compressSingle, CompressionChoiceOptions rangeSelection) {
this(compressSingle, rangeSelection, MixedCompressionOptions.YES);
}
Expand Down Expand Up @@ -3243,7 +3243,7 @@ public static IPv6StringOptions from(IPStringOptions opts) {
public static class Builder extends IPStringOptions.Builder {
private boolean makeMixed;
private IPStringOptions ipv4Options;

//default is null, which means no compression
private CompressOptions compressOptions;

Expand Down Expand Up @@ -3746,7 +3746,7 @@ public StringBuilder append(StringBuilder builder, IPv6v4MixedAddressSection add
builder.append(ipv6Params.getTrailingSegmentSeparator());
}
ipv4Params.appendSegments(builder, addr.ipv4Section);

/*
* rfc 4038: for bracketed addresses, zone is inside and prefix outside, putting prefix after zone.
*
Expand Down
2 changes: 1 addition & 1 deletion IPAddress/src/inet.ipaddr/inet/ipaddr/mac/MACAddress.java
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ public MACAddress toEUI64(boolean asMAC) {
public MACAddress replace(int startIndex, int endIndex, MACAddress replacement, int replacementIndex) {
return checkIdentity(getSection().replace(startIndex, endIndex, replacement.getSection(), replacementIndex, replacementIndex + (endIndex - startIndex)));
}

/**
* Replaces segments starting from startIndex with as many segments as possible from the replacement section
*
Expand Down
2 changes: 1 addition & 1 deletion IPAddress/src/inet.ipaddr/inet/ipaddr/test/TrieTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ <E extends Address> void testRemove(AddressTrie<E> tree, int count, List<E> addr

incrementTestCount();
}

static <E extends Address> List<E> collect(String addrs[], Function<String, E> converter) {
ArrayList<E> list = new ArrayList<>(addrs.length);
HashSet<E> dupChecker = new HashSet<>();
Expand Down

0 comments on commit 808fc2f

Please sign in to comment.