gpt4 book ai didi

com.zsmartsystems.zigbee.ZigBeeGroupAddress.getGroupId()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 11:39:31 26 4
gpt4 key购买 nike

本文整理了Java中com.zsmartsystems.zigbee.ZigBeeGroupAddress.getGroupId()方法的一些代码示例,展示了ZigBeeGroupAddress.getGroupId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZigBeeGroupAddress.getGroupId()方法的具体详情如下:
包路径:com.zsmartsystems.zigbee.ZigBeeGroupAddress
类名称:ZigBeeGroupAddress
方法名:getGroupId

ZigBeeGroupAddress.getGroupId介绍

[英]Gets group ID.
[中]获取组ID。

代码示例

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Override
public int compareTo(ZigBeeAddress that) {
  if (this == that) {
    return 0;
  }
  ZigBeeGroupAddress thatAddr = (ZigBeeGroupAddress) that;
  if (thatAddr.getGroupId() == getGroupId()) {
    return 0;
  }
  return (thatAddr.getGroupId() < getGroupId()) ? -1 : 1;
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Override
public int getAddress() {
  return getGroupId();
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Override
public boolean equals(Object obj) {
  if (obj == null) {
    return false;
  }
  if (!ZigBeeGroupAddress.class.isAssignableFrom(obj.getClass())) {
    return false;
  }
  final ZigBeeGroupAddress other = (ZigBeeGroupAddress) obj;
  return other.getGroupId() == getGroupId();
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

public void addGroup(final ZigBeeGroupAddress group) {
  synchronized (networkGroups) {
    networkGroups.put(group.getGroupId(), group);
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

public void updateGroup(ZigBeeGroupAddress group) {
  synchronized (networkGroups) {
    networkGroups.put(group.getGroupId(), group);
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
   * {@inheritDoc}
   */
  @Override
  public boolean process(final ZigBeeApi zigbeeApi, final String[] args, PrintStream out) throws Exception {
    if (args.length != 2) {
      return false;
    }
    final ZigBeeAddress destination = getDestination(zigbeeApi, args[1], out);
    if (destination == null) {
      return false;
    }
    if (!(destination instanceof ZigBeeGroupAddress)) {
      return false;
    }
    final ZigBeeGroupAddress group = (ZigBeeGroupAddress) destination;
    networkManager.removeGroup(group.getGroupId());
    return true;
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

/**
   * {@inheritDoc}
   */
  @Override
  public boolean process(final ZigBeeApi zigbeeApi, final String[] args, PrintStream out) {
    final List<ZigBeeGroupAddress> groups = zigbeeApi.getGroups();
    for (final ZigBeeGroupAddress group : groups) {
      print(StringUtils.leftPad(Integer.toString(group.getGroupId()), 10) + "      " + group.getLabel(), out);
    }
    return true;
  }
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
public void testAddRemoveGroup() {
  ZigBeeNetworkManager networkManager = mockZigBeeNetworkManager();
  networkManager.addGroup(new ZigBeeGroupAddress(1));
  assertEquals(1, networkManager.getGroups().size());
  networkManager.addGroup(new ZigBeeGroupAddress(1));
  assertEquals(1, networkManager.getGroups().size());
  networkManager.addGroup(new ZigBeeGroupAddress(2));
  assertEquals(2, networkManager.getGroups().size());
  networkManager.removeGroup(2);
  assertEquals(1, networkManager.getGroups().size());
  assertNull(networkManager.getGroup(1).getLabel());
  ZigBeeGroupAddress group = networkManager.getGroup(1);
  assertEquals(1, group.getGroupId());
  group.setLabel("Group Label");
  networkManager.updateGroup(group);
  assertEquals(1, networkManager.getGroups().size());
  assertEquals("Group Label", networkManager.getGroup(1).getLabel());
}

代码示例来源:origin: zsmartsystems/com.zsmartsystems.zigbee

@Test
  public void testGroupAddress() {
    ZigBeeGroupAddress group1 = new ZigBeeGroupAddress(1);
    assertTrue(group1.isGroup());

    ZigBeeGroupAddress group2 = new ZigBeeGroupAddress(1);
    assertTrue(group1.equals(group2));
    assertEquals(0, group1.compareTo(group2));
    assertEquals(1, group1.getGroupId());

    // Test that label doesn't matter
    group2 = new ZigBeeGroupAddress(1, "Test Label");
    assertTrue(group1.equals(group2));
    assertEquals("Test Label", group2.getLabel());

    group2 = new ZigBeeGroupAddress();
    group2.setGroupId(1);
    assertEquals(1, group1.getGroupId());
    group2.setLabel("Test Label");
    assertEquals("Test Label", group2.getLabel());

    group2.setGroupId(2);
    assertEquals(1, group1.compareTo(group2));

    System.out.println(group2);
  }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com