private UiLinkId(ElementId a, PortNumber pa, ElementId b, PortNumber pb) {
        elementA = a;
        portA = pa;
        elementB = b;
        portB = pb;

        regionA = null;
        regionB = null;

        boolean isEdgeLink = (a instanceof HostId);

        // NOTE: for edgelinks, hosts are always element A
        idA = isEdgeLink ? a.toString() : a + ID_PORT_DELIMITER + pa;
        idB = b + ID_PORT_DELIMITER + pb;
        idStr = idA + CP_DELIMITER + idB;

        type = isEdgeLink ? Type.HOST_DEVICE : Type.DEVICE_DEVICE;
    }
@Test
    public void fromLinkKey() {
        title("fromLinkKey");

        LinkKey lk1 = LinkKey.linkKey(CP_X1, CP_Y2);
        print("link-key-1: %s", lk1);
        LinkKey lk2 = LinkKey.linkKey(CP_Y2, CP_X1);
        print("link-key-2: %s", lk2);

        UiLinkId id1 = UiLinkId.uiLinkId(lk1);
        print("identifier-1: %s", id1);
        UiLinkId id2 = UiLinkId.uiLinkId(lk2);
        print("identifier-2: %s", id2);

        assertEquals("unequal canon-ids", id1, id2);
    }