示例#1
0
 protected boolean containsCharacteristic(Characteristic<?> characteristic) {
   if (mCharacteristics != null) {
     for (Characteristic<?> charac : mCharacteristics) {
       if (charac.equals(characteristic)) {
         return true;
       }
     }
   }
   return false;
 }
示例#2
0
  public Characteristic<?> getCharacteristics(String name) {

    if (mCharacteristics != null) {
      for (Characteristic<?> characteristic : mCharacteristics) {
        if (characteristic.getName().equals(name)) {
          return characteristic;
        }
      }
    }

    return null;
  }
示例#3
0
  public void addCharacteristic(Characteristic<?> characteristic) {

    if (mCharacteristics == null) {
      mCharacteristics = new ArrayList<Characteristic<?>>(1);
    }

    if (containsCharacteristic(characteristic)
        || (mExtendEntity != null && mExtendEntity.containsCharacteristic(characteristic))) {
      System.out.println(
          ">> WARNING: Duplicate "
              + characteristic.getClass().getSimpleName()
              + ": "
              + characteristic);
      return;
    }

    mCharacteristics.add(characteristic);
  }