/** * * @param _ * @param _rawItems * @return */ protected IVItem[] filterItems(IOut _, IVItem[] _rawItems) { if (_rawItems == null) { return new IVItem[0]; } if (comparator != null) { Arrays.sort(_rawItems, comparator); } int count = 0; int len = _rawItems.length; IVItem[] filteredItems = new IVItem[len]; Pattern pattern = null; String regx = ""; if (filter != null) { regx = filter.toString(); } if (regx.length() > 0) { try { pattern = Pattern.compile(regx); } catch (Exception x) { if (_ != null) { _.out(x); } } } for (int i = 0; i < len; i++) { if (_ != null) { _.out(i, len); } IVItem next = _rawItems[i]; IVItem filtered = filter(next, pattern); if (filtered == null) { continue; } filteredItems[count++] = filtered; } if (count < len) { filteredItems = (IVItem[]) UArray.trim(filteredItems, new IVItem[count]); } else if (count == 0) { filteredItems = new IVItem[0]; } return filteredItems; }