org.fourthline.cling.model.meta.Device.hasEmbeddedDevices()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(178)

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

Device.hasEmbeddedDevices介绍

暂无

代码示例

代码示例来源:origin: 4thline/cling

protected Collection<D> findEmbeddedDevices(D current) {
  Collection<D> devices = new HashSet<>();
  if (!current.isRoot() && current.getIdentity().getUdn() != null)
    devices.add(current);
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(findEmbeddedDevices(embeddedDevice));
    }
  }
  return devices;
}

代码示例来源:origin: 4thline/cling

protected void generateDeviceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement, RemoteClientInfo info) {
  if (!deviceModel.hasEmbeddedDevices()) return;
  Element deviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.deviceList);
  for (Device device : deviceModel.getEmbeddedDevices()) {
    generateDevice(namespace, device, descriptor, deviceListElement, info);
  }
}

代码示例来源:origin: 4thline/cling

protected Collection<D> find(DeviceType deviceType, D current) {
  Collection<D> devices = new HashSet<>();
  // Type might be null if we just discovered the device and it hasn't yet been hydrated
  if (current.getType() != null && current.getType().implementsVersion(deviceType)) {
    devices.add(current);
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(find(deviceType, embeddedDevice));
    }
  }
  return devices;
}

代码示例来源:origin: 4thline/cling

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList<>();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    
    if(getIdentity() != null) {
      errors.addAll(getIdentity().validate());
    }
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

代码示例来源:origin: 4thline/cling

protected D find(UDN udn, D current) {
  if (current.getIdentity() != null && current.getIdentity().getUdn() != null) {
    if (current.getIdentity().getUdn().equals(udn)) return current;
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      D match;
      if ((match = find(udn, embeddedDevice)) != null) return match;
    }
  }
  return null;
}

代码示例来源:origin: kingthy/TVRemoteIME

protected Collection<D> findEmbeddedDevices(D current) {
  Collection<D> devices = new HashSet();
  if (!current.isRoot()) {
    devices.add(current);
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(findEmbeddedDevices(embeddedDevice));
    }
  }
  return devices;
}

代码示例来源:origin: 4thline/cling

if (device.hasEmbeddedDevices()) {
  for (Device embedded : device.getEmbeddedDevices()) {
    createNodes(deviceNode, namespace, embedded);

代码示例来源:origin: kingthy/TVRemoteIME

protected Collection<D> find(DeviceType deviceType, D current) {
  Collection<D> devices = new HashSet();
  // Type might be null if we just discovered the device and it hasn't yet been hydrated
  if (current.getType() != null && current.getType().implementsVersion(deviceType)) {
    devices.add(current);
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(find(deviceType, embeddedDevice));
    }
  }
  return devices;
}

代码示例来源:origin: kingthy/TVRemoteIME

protected void generateDeviceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement, RemoteClientInfo info) {
  if (!deviceModel.hasEmbeddedDevices()) return;
  Element deviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.deviceList);
  for (Device device : deviceModel.getEmbeddedDevices()) {
    generateDevice(namespace, device, descriptor, deviceListElement, info);
  }
}

代码示例来源:origin: kingthy/TVRemoteIME

protected D find(UDN udn, D current) {
  if (current.getIdentity().getUdn().equals(udn)) return current;
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      D match;
      if ((match = find(udn, embeddedDevice)) != null) return match;
    }
  }
  return null;
}

代码示例来源:origin: kingthy/TVRemoteIME

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

代码示例来源:origin: org.fourthline.cling/cling-core

protected Collection<D> findEmbeddedDevices(D current) {
  Collection<D> devices = new HashSet<>();
  if (!current.isRoot() && current.getIdentity().getUdn() != null)
    devices.add(current);
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(findEmbeddedDevices(embeddedDevice));
    }
  }
  return devices;
}

代码示例来源:origin: org.fourthline.cling/cling-core

protected Collection<D> find(DeviceType deviceType, D current) {
  Collection<D> devices = new HashSet<>();
  // Type might be null if we just discovered the device and it hasn't yet been hydrated
  if (current.getType() != null && current.getType().implementsVersion(deviceType)) {
    devices.add(current);
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      devices.addAll(find(deviceType, embeddedDevice));
    }
  }
  return devices;
}

代码示例来源:origin: org.fourthline.cling/cling-core

protected void generateDeviceList(Namespace namespace, Device deviceModel, Document descriptor, Element deviceElement, RemoteClientInfo info) {
  if (!deviceModel.hasEmbeddedDevices()) return;
  Element deviceListElement = appendNewElement(descriptor, deviceElement, ELEMENT.deviceList);
  for (Device device : deviceModel.getEmbeddedDevices()) {
    generateDevice(namespace, device, descriptor, deviceListElement, info);
  }
}

代码示例来源:origin: org.fourthline.cling/cling-core

public List<ValidationError> validate() {
  List<ValidationError> errors = new ArrayList<>();
  if (getType() != null) {
    // Only validate the graph if we have a device type - that means we validate only if there
    // actually is a fully hydrated graph, not just a discovered device of which we haven't even
    // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device
    // type. Now that is a risky assumption...
    errors.addAll(getVersion().validate());
    
    if(getIdentity() != null) {
      errors.addAll(getIdentity().validate());
    }
    if (getDetails() != null) {
      errors.addAll(getDetails().validate());
    }
    if (hasServices()) {
      for (Service service : getServices()) {
        if (service != null)
          errors.addAll(service.validate());
      }
    }
    if (hasEmbeddedDevices()) {
      for (Device embeddedDevice : getEmbeddedDevices()) {
        if (embeddedDevice != null)
          errors.addAll(embeddedDevice.validate());
      }
    }
  }
  return errors;
}

代码示例来源:origin: org.fourthline.cling/cling-core

protected D find(UDN udn, D current) {
  if (current.getIdentity() != null && current.getIdentity().getUdn() != null) {
    if (current.getIdentity().getUdn().equals(udn)) return current;
  }
  if (current.hasEmbeddedDevices()) {
    for (D embeddedDevice : (D[]) current.getEmbeddedDevices()) {
      D match;
      if ((match = find(udn, embeddedDevice)) != null) return match;
    }
  }
  return null;
}

相关文章