java.lang.Object
com.github.rvesse.airline.restrictions.common.PortRangeImpl
All Implemented Interfaces:
PortRange, Comparable<PortRange>

public class PortRangeImpl extends Object implements PortRange, Comparable<PortRange>
Concrete implementation of a port range
  • Field Details

    • min

      private final int min
    • max

      private final int max
  • Constructor Details

    • PortRangeImpl

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

    • 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 String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(PortRange other)
      Specified by:
      compareTo in interface Comparable<PortRange>