Пример #1
0
  /**
   * get the detected type from response, set as all if null
   *
   * @param detectedTypes
   * @return
   */
  public static ProductType getSelectedProductType(List<ProductType> detectedTypes) {
    ProductType selectedType;

    if (detectedTypes.size() > 0) {
      selectedType = detectedTypes.get(0);
    } else {
      selectedType = new ProductType();
      selectedType.setType("other");
    }

    return selectedType;
  }
Пример #2
0
  public static List<String> getSupportedTypeList(
      List<ProductType> supportedTypeList, String detectedType) {
    List<String> productList = new ArrayList<>();
    if (detectedType != null) {
      productList.add(detectedType);
    }

    for (ProductType productType : supportedTypeList) {
      if (!productType.getType().equals(detectedType)) {
        productList.add(productType.getType());
      }
    }

    return productList;
  }
Пример #3
0
  public static List<ProductType> copyProductTypeList(List<ProductType> productTypeList) {
    List<ProductType> newProductList = new ArrayList<>();
    for (ProductType p : productTypeList) {
      ProductType newP = new ProductType();
      newP.setType(p.getType());
      newP.setBox(p.getBox());
      newP.setScore(p.getScore());

      newProductList.add(p);
    }

    return newProductList;
  }