public void delete(CommodityPO po) { Iterator<CommodityPO> iterator = set.iterator(); while (iterator.hasNext()) { if (iterator.next().getId().equals(po.getId())) { iterator.remove(); break; } } }
public CommodityPO findCommodityInID(String id) { Iterator<CommodityPO> iterator = set.iterator(); CommodityPO po = null; while (iterator.hasNext()) { po = iterator.next(); if (po.getId().equals(id)) { return po; } } return null; }
public boolean containInType(String id) { Iterator<CommodityPO> iterator = set.iterator(); CommodityPO po = null; while (iterator.hasNext()) { po = iterator.next(); if (po.getId().substring(0, 11).equals(id)) { return true; } } return false; }
public Iterator<CommodityPO> findCommoditiesInType(String id) { ArrayList<CommodityPO> list = new ArrayList<CommodityPO>(); Iterator<CommodityPO> iterator = set.iterator(); CommodityPO po = null; while (iterator.hasNext()) { po = iterator.next(); if (po.getId().substring(0, 11).equals(id)) { list.add(po); } } return list.iterator(); }
public boolean containInKeyword(String key) { Iterator<CommodityPO> iterator = set.iterator(); CommodityPO po = null; while (iterator.hasNext()) { po = iterator.next(); if (po.getId().contains(key) || po.getName().contains(key)) { return true; } else { Iterator<CommodityPO.CommodityModelPO> it = po.getList().iterator(); while (it.hasNext()) { if (it.next().getName().contains(key) || it.next().getStorehouse().contains(key)) { return true; } } } } return false; }
public Iterator<CommodityPO> findCommoditiesInKeyword(String key) { ArrayList<CommodityPO> output = new ArrayList<CommodityPO>(); Iterator<CommodityPO> iterator = set.iterator(); CommodityPO po = null; while (iterator.hasNext()) { po = iterator.next(); if (po.getId().contains(key) || po.getName().contains(key)) { output.add(po); } else { Iterator<CommodityPO.CommodityModelPO> it = po.getList().iterator(); while (it.hasNext()) { if (it.next().getName().contains(key) || it.next().getStorehouse().contains(key)) { output.add(po); } } } } return output.iterator(); }