Package org.batfish.datamodel
Class Ip
java.lang.Object
org.batfish.datamodel.Ip
- All Implemented Interfaces:
Serializable,Comparable<Ip>
An IPv4 address
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionlongasLong()intstatic Ipcreate(long ipAsLong) booleanstatic booleangetBitAtPosition(long bits, int position) Return the boolean value of a bit at the given position.static booleangetBitAtPosition(Ip ip, int position) intReturns the size of an IPv4 network in IPv4 Address Class of thisIp.getNetworkAddress(int subnetBits) inthashCode()inverted()intstatic IpnumSubnetBitsToSubnetMask(int numBits) static IptoPrefix()toString()booleanvalid()
-
Field Details
-
AUTO
-
FIRST_CLASS_A_PRIVATE_IP
-
FIRST_CLASS_B_PRIVATE_IP
-
FIRST_CLASS_C_PRIVATE_IP
-
FIRST_CLASS_E_EXPERIMENTAL_IP
-
FIRST_MULTICAST_IP
-
MAX
-
ZERO
-
-
Method Details
-
getBitAtPosition
SeegetBitAtPosition(long, int). Equivalent togetBitAtPosition(ip.asLong(), position) -
getBitAtPosition
public static boolean getBitAtPosition(long bits, int position) Return the boolean value of a bit at the given position.- Parameters:
bits- the representation of an IP address as a longposition- bit position (0 means most significant, 31 least significant)- Returns:
- a boolean representation of the bit value
-
numSubnetBitsToSubnetMask
-
tryParse
-
parse
-
create
-
asLong
public long asLong() -
compareTo
- Specified by:
compareToin interfaceComparable<Ip>
-
equals
-
getClassMask
-
getClassNetworkSize
public int getClassNetworkSize()Returns the size of an IPv4 network in IPv4 Address Class of thisIp. Returns-1if the class does not have a defined subnet size, e.g. the experimental subnet. -
getNetworkAddress
-
hashCode
public int hashCode() -
inverted
-
numSubnetBits
public int numSubnetBits() -
toString
-
valid
public boolean valid() -
toPrefix
-