public boolean hasSpecialFilterValue() { // We want values that ARE special return CollectionUtils.exists(filterValues, getPredicateForSpecialValues(true)); }
public void testExists() { List list = new ArrayList(); assertEquals(false, CollectionUtils.exists(null, null)); assertEquals(false, CollectionUtils.exists(list, null)); assertEquals(false, CollectionUtils.exists(null, EQUALS_TWO)); assertEquals(false, CollectionUtils.exists(list, EQUALS_TWO)); list.add("One"); list.add("Three"); list.add("Four"); assertEquals(false, CollectionUtils.exists(list, EQUALS_TWO)); list.add("Two"); assertEquals(true, CollectionUtils.exists(list, EQUALS_TWO)); }
@SuppressWarnings("unchecked") public boolean evaluate(Object o) { return !exists((List<Member>) o, memberInaccessible); }}; }
private boolean needsFiltering(TupleList tupleList) { return tupleList.size() > 0 && exists(tupleList.get(0), needsFilterPredicate()); }
private boolean equalsIgnoredProperty(final String outboundProperty) { return CollectionUtils.exists(ignoredProperties, new Predicate() { @Override public boolean evaluate(Object propertyName) { return outboundProperty.equalsIgnoreCase((String) propertyName); } }); }
/** * Returns true if a predicate is true for at least one element of a collection. <p/>A null collection or predicate * returns false. * @param collection * @param predicate * @return CollectionUtils.exists(collection, predicate) */ public static boolean exists( final Collection collection, final Predicate predicate) { return CollectionUtils.exists(collection, predicate); }
private boolean containsConfig(List<ModuleConfig> configuration, final String name) { return CollectionUtils.exists(configuration, new Predicate() { @Override public boolean evaluate(Object object) { boolean match = object instanceof ModuleConfig; if (match) { ModuleConfig config = (ModuleConfig) object; match = equalsIgnoreCase(name, config.getName()); } return match; } }); }
private boolean evalEq(final List<?> fieldValues, final Object criteriaValue) { Predicate eqPre = new Predicate() { @Override public boolean evaluate(Object object) { if (criteriaValue instanceof Long && object instanceof Integer) { Long value = Long.valueOf((Integer) object); return criteriaValue.equals(value); } else { return criteriaValue.equals(object); } } }; return CollectionUtils.exists(fieldValues, eqPre); }
private boolean evalNotEq(final List<?> fieldValues, final Object criteriaValue) { if (fieldValues == null || fieldValues.isEmpty()) { return true; } Predicate notEqPre = new Predicate() { @Override public boolean evaluate(Object object) { if (criteriaValue instanceof Long && object instanceof Integer) { Long value = Long.valueOf((Integer) object); return !criteriaValue.equals(value); } else { return !criteriaValue.equals(object); } } }; return CollectionUtils.exists(fieldValues, notEqPre); }
/** * Determines whether provided <code>list</code> contains item * of a given type <code>klass</code> * * @param list {@link List} to process * @param klass item type to look for * @return <code>true</code> in case there is an existent item of a given type within * provided list, <code>false</code> - otherwise */ protected boolean isListHasItemOfType(final List<?> list, final Class<?> klass) { return CollectionUtils.exists(list, InstanceofPredicate.getInstance(klass)); }
protected Double calculateScalar(Interval interval, DataProperty property, ScalarFunction function) { Collection values = interval.getValues(property); if (!CollectionUtils.exists(values, NON_NULL_ELEMENTS)) { return new Double(0); } else { double value = function.scalar(values); // Check constraints every time an scalar calculation is carried out. ProfilerHelper.checkRuntimeConstraints(); return new Double(value); } }
public void addColumn(Column column) { if (!CollectionUtils.exists(columnNames, new FindColumnPredicate(column.getColumnName()))) { boolean added = columns.add(column); if (added) { columnNames.add(column.getColumnName()); } } }
public boolean containsStyle(String selector) { Validate.notEmpty(selector); return CollectionUtils.exists(styles, new SelectorEqualsPredicate(selector)); }
protected Double calculateScalar(int column, String functionCode) { DataSet dataSet = columnIndex.getDataSetIndex().dataSet; List targetValues = new ArrayList(); List columnValues = dataSet.getValuesAt(column); for (Integer targetRow : rows) { targetValues.add(columnValues.get(targetRow)); } ScalarFunctionManager scalarFunctionManager = DataProviderServices.lookup().getScalarFunctionManager(); ScalarFunction function = scalarFunctionManager.getScalarFunctionByCode(functionCode); if (!CollectionUtils.exists(targetValues, NON_NULL_ELEMENTS)) { return new Double(0); } else { double value = function.scalar(targetValues); return new Double(value); } }
if(!CollectionUtils.exists(uriTemplates, new Predicate() { @Override public boolean evaluate(Object o) {
@Deprecated private boolean validate(final Task task) { if (CollectionUtils.exists( CollectionUtils.getCardinalityMap( CollectionUtils.collect(Arrays.asList(task.getOut()), new Transformer() { @Override public Object transform(final Object input) { return FilenameUtils.getExtension(input.toString()); } })).values(), new Predicate() { @Override public boolean evaluate(final Object object) { return ((Integer) object).intValue() > 1; } })) { throw new SmallerException("Each output type must exist only once"); } final String[] processors = task.getProcessor().toLowerCase().split(","); boolean cssembedFound = false; for (final String processor : processors) { if (processor.equals("cssembed")) { cssembedFound = true; } else if (processor.equals("yuicompressor") && cssembedFound) { throw new SmallerException("yuiCompressor must run before cssembed"); } } return true; }
BloomDataMapWriter(String tablePath, String dataMapName, List<CarbonColumn> indexColumns, Segment segment, String shardName, SegmentProperties segmentProperties, int bloomFilterSize, double bloomFilterFpp, boolean compressBloom) throws IOException { super(tablePath, dataMapName, indexColumns, segment, shardName, segmentProperties, bloomFilterSize, bloomFilterFpp, compressBloom); columnarSplitter = segmentProperties.getFixedLengthKeySplitter(); this.indexCol2MdkIdx = new HashMap<>(); int idx = 0; for (final CarbonDimension dimension : segmentProperties.getDimensions()) { if (!dimension.isGlobalDictionaryEncoding() && !dimension.isDirectDictionaryEncoding()) { continue; } boolean isExistInIndex = CollectionUtils.exists(indexColumns, new Predicate() { @Override public boolean evaluate(Object object) { return ((CarbonColumn) object).getColName().equalsIgnoreCase(dimension.getColName()); } }); if (isExistInIndex) { this.indexCol2MdkIdx.put(dimension.getColName(), idx); } idx++; } }
public boolean isProcessingRepositoryTask( String repositoryId ) throws ArchivaException { List<? extends Task> queue = null; try { queue = repositoryScanningQueue.getQueueSnapshot(); } catch ( TaskQueueException e ) { throw new ArchivaException( "Unable to get repository scanning queue:" + e.getMessage(), e ); } return CollectionUtils.exists( queue, new RepositoryTaskSelectionPredicate( repositoryId ) ); }
@Override protected void doValidation() { super.doValidation(); if (CollectionUtils.exists(issueTypeSchemeManager.getAllSchemes(), new FieldConfigPredicate(getSchemeId(), getName()))) { addError("name", getText("admin.errors.issuetypes.duplicate.name")); } if ((getSelectedOptions() != null) && (getSelectedOptions().length > 0)) { boolean hasNormalIssueType = false; for (int i = 0; i < getSelectedOptions().length; i++) { final String id = getSelectedOptions()[i]; final IssueType issueType = constantsManager.getIssueTypeObject(id); if (!issueType.isSubTask()) { hasNormalIssueType = true; break; } } if (!hasNormalIssueType) { addErrorMessage(getText("admin.errors.issuetypes.must.select.standard.issue.type")); } } }