Class UiLinkId


  • public final class UiLinkId
    extends java.lang.Object
    A canonical representation of an identifier for UiLinks.
    • Method Detail

      • toString

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

        public java.lang.String idA()
        String representation of endpoint A.
        Returns:
        string rep of endpoint A
      • idB

        public java.lang.String idB()
        String representation of endpoint B.
        Returns:
        string rep of endpoint B
      • elementA

        public ElementId elementA()
        Returns the identifier of the first element. Note that the returned value will be null if this identifier is for a region-region link.
        Returns:
        first element identity
      • portA

        public PortNumber portA()
        Returns the port of the first element. Note that the returned value will be null if this identifier is for a region-region link.
        Returns:
        first element port
      • elementB

        public ElementId elementB()
        Returns the identifier of the second element. Note that the returned value will be null if this identifier is for a region-region link.
        Returns:
        second element identity
      • portB

        public PortNumber portB()
        Returns the port of the second element. Note that the returned value will be null if this identifier is for a region-region link.
        Returns:
        second element port
      • regionA

        public RegionId regionA()
        Returns the identity of the first region. Note that the returned value will be null if this identifier is for a device-device or device-host link.
        Returns:
        first region ID
      • regionB

        public RegionId regionB()
        Returns the identity of the second region. Note that the returned value will be null if this identifier is for a device-device or device-host link.
        Returns:
        second region ID
      • type

        public UiLinkId.Type type()
        Returns the type of link this identifier represents.
        Returns:
        the link identifier type
      • isRegionRegion

        public boolean isRegionRegion()
        Returns true if this identifier represents a region-region link.
        Returns:
        true if region-region link identifier; false otherwise
      • isRegionDevice

        public boolean isRegionDevice()
        Returns true if this identifier represents a region-device link.
        Returns:
        true if region-device link identifier; false otherwise
      • isDeviceDevice

        public boolean isDeviceDevice()
        Returns true if this identifier represents a device-device (infrastructure) link.
        Returns:
        true if device-device link identifier; false otherwise
      • isHostDevice

        public boolean isHostDevice()
        Returns true if this identifier represents a host-device (edge) link.
        Returns:
        true if host-device link identifier; false otherwise
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • uiLinkId

        public static UiLinkId uiLinkId​(Link link)
        Generates the canonical link identifier for the given link.
        Parameters:
        link - link for which the identifier is required
        Returns:
        link identifier
        Throws:
        java.lang.NullPointerException - if src or dst connect point is null
      • uiLinkId

        public static UiLinkId uiLinkId​(LinkKey lk)
        Creates the canonical link identifier from the given link key.
        Parameters:
        lk - link key
        Returns:
        equivalent link identifier
        Throws:
        java.lang.NullPointerException - if src or dst connect point is null
      • uiLinkId

        public static UiLinkId uiLinkId​(RegionId one,
                                        RegionId two)
        Generates the canonical link identifier for a link between the specified region nodes.
        Parameters:
        one - the first region ID
        two - the second region ID
        Returns:
        link identifier
        Throws:
        java.lang.NullPointerException - if any of the required fields are null
        java.lang.IllegalArgumentException - if the identifiers are identical
      • uiLinkId

        public static UiLinkId uiLinkId​(RegionId regionId,
                                        DeviceId deviceId,
                                        PortNumber portNumber)
        Generates the canonical link identifier for a link between the specified region and device/port.
        Parameters:
        regionId - region ID
        deviceId - device ID
        portNumber - port number
        Returns:
        link identifier
        Throws:
        java.lang.NullPointerException - if any of the required fields are null
      • uiLinkId

        public static UiLinkId uiLinkId​(DeviceId a,
                                        PortNumber pa,
                                        DeviceId b,
                                        PortNumber pb)
        Generates an identifier for a link between two devices.
        Parameters:
        a - device A
        pa - port A
        b - device B
        pb - port B
        Returns:
        link identifier
        Throws:
        java.lang.NullPointerException - if any of the required fields are null
      • uiLinkId

        public static UiLinkId uiLinkId​(HostId h,
                                        DeviceId d,
                                        PortNumber p)
        Generates an identifier for an edge link. Note that host is always element A.
        Parameters:
        h - host
        d - device
        p - port
        Returns:
        link identifier
        Throws:
        java.lang.NullPointerException - if any of the required fields are null