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 27e2831 commit 2608276
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions IPAddress/src/inet.ipaddr/inet/ipaddr/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,29 @@ public void getSegments(int start, int end, AddressSegment segs[], int index) {

@Override
public abstract Address getUpper();


/**
* Returns whether this address represents more than a single individual address, whether it is a subnet.
*
* Such addresses include CIDR/IP addresses (eg 1.2.3.0/25) or wildcard addresses (eg 1.2.*.4) or range addresses (eg 1.2.3-4.5)
*
* @return whether this address represents more than one address.
*/
@Override
public boolean isMultiple() {
return getSection().isMultiple();
}

/**
* Returns whether this address has an associated prefix length
*
* @return whether this address has an associated prefix length
*/
@Override
public boolean isPrefixed() {
return getSection().isPrefixed();
}

/**
* Returns whether this address is an IP address
*
Expand All @@ -242,7 +264,7 @@ public void getSegments(int start, int end, AddressSegment segs[], int index) {
public boolean isIPAddress() {
return false;
}

/**
* Returns whether this address is a MAC address
*
Expand All @@ -251,7 +273,7 @@ public boolean isIPAddress() {
public boolean isMACAddress() {
return false;
}

/**
* If this address is an IP address, returns that {@link IPAddress}. Otherwise, returns null.
*
Expand All @@ -260,7 +282,7 @@ public boolean isMACAddress() {
public IPAddress toIPAddress() {
return null;
}

/**
* If this address is a MAC address, returns that {@link MACAddress}. Otherwise, returns null.
*
Expand All @@ -269,37 +291,15 @@ public IPAddress toIPAddress() {
public MACAddress toMACAddress() {
return null;
}

/**
* Returns whether this address represents more than a single individual address, whether it is a subnet.
*
* Such addresses include CIDR/IP addresses (eg 1.2.3.0/25) or wildcard addresses (eg 1.2.*.4) or range addresses (eg 1.2.3-4.5)
*
* @return whether this address represents more than one address.
*/
@Override
public boolean isMultiple() {
return getSection().isMultiple();
}

/**
* Returns whether this address has an associated prefix length
*
* @return whether this address has an associated prefix length
*/
@Override
public boolean isPrefixed() {
return getSection().isPrefixed();
}

/**
* the largest number of high bits for which this address represents all addresses with the same set of high bits
*/
@Override
public Integer getPrefixLength() {
return getSection().getPrefixLength();
}

/**
* Returns the smallest prefix length possible such that this includes the block of addresses for that prefix.
* <p>
Expand Down Expand Up @@ -474,7 +474,7 @@ public int hashCode() {
public boolean isSameAddress(Address other) {
return other == this || getSection().equals(other.getSection());
}

/**
* Two Address objects are equal if they represent the same set of addresses.
*/
Expand All @@ -492,14 +492,14 @@ public boolean equals(Object o) {
}
return false;
}

public boolean prefixEquals(Address other) {
if(other == this) {
return true;
}
return getSection().prefixEquals(other.getSection());
}

/**
* Returns whether this is same type and version of the given address and whether it overlaps with the values in the given address or subnet
*
Expand All @@ -512,7 +512,7 @@ public boolean overlaps(Address other) {
}
return getSection().overlaps(other.getSection());
}

/**
* Returns whether this is same type and version of the given address and whether it contains all values in the given address or subnet
*
Expand All @@ -525,7 +525,7 @@ public boolean contains(Address other) {
}
return getSection().contains(other.getSection());
}

/**
* Indicates where an address sits relative to the subnet ordering.
* <p>
Expand Down

0 comments on commit 2608276

Please sign in to comment.