Class PortRangeImpl

  • All Implemented Interfaces:
    PortRange, java.lang.Comparable<PortRange>

    public class PortRangeImpl
    extends java.lang.Object
    implements PortRange, java.lang.Comparable<PortRange>
    Concrete implementation of a port range
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int max  
      private int min  
    • Constructor Summary

      Constructors 
      Constructor Description
      PortRangeImpl​(int min, int max)
      Creates a new port range
    • Field Detail

      • min

        private final int min
      • max

        private final int max
    • Constructor Detail

      • PortRangeImpl

        public PortRangeImpl​(int min,
                             int max)
        Creates a new port range
        Parameters:
        min - Minimum
        max - Maximum
    • Method Detail

      • getMinimumPort

        public int getMinimumPort()
        Description copied from interface: PortRange
        Gets the minimum port
        Specified by:
        getMinimumPort in interface PortRange
        Returns:
        Minimum port
      • getMaximumPort

        public int getMaximumPort()
        Description copied from interface: PortRange
        Gets the maximum port
        Specified by:
        getMaximumPort in interface PortRange
        Returns:
        Maximum port
      • inRange

        public boolean inRange​(int port)
        Description copied from interface: PortRange
        Gets whether a port falls within the range
        Specified by:
        inRange in interface PortRange
        Parameters:
        port - Port
        Returns:
        True if in range, false otherwise
      • contains

        public boolean contains​(PortRange other)
        Description copied from interface: PortRange
        Gets whether the port range contains another port range i.e. does this cover at least the same range of ports as the other
        Specified by:
        contains in interface PortRange
        Parameters:
        other - Other port type
        Returns:
        True if this covers at least the same range of ports as the other, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • compareTo

        public int compareTo​(PortRange other)
        Specified by:
        compareTo in interface java.lang.Comparable<PortRange>