List of usage examples for com.google.common.base Predicates or
public static <T> Predicate<T> or(Predicate<? super T> first, Predicate<? super T> second)
From source file:alien4cloud.webconfiguration.RestDocumentationConfig.java
@Bean public Docket adminUserApiDocket() { Predicate predicate = Predicates.or( PathSelectors.regex("/rest/" + PREFIXED_CURRENT_API_VERSION + "/users.*"), PathSelectors.regex("/rest/" + PREFIXED_CURRENT_API_VERSION + "/groups.*")); predicates.add(predicate);// ww w. j a va2s . c o m return new Docket(DocumentationType.SWAGGER_2).groupName("admin-user-api").select().paths(predicate).build() .apiInfo(apiInfo()); }
From source file:hellfirepvp.astralsorcery.common.entities.EntityCrystalTool.java
private void increaseSize() { world.setBlockToAir(getPosition());/*w w w . jav a 2s . c om*/ List<Entity> foundItems = world.getEntitiesInAABBexcluding(this, boxCraft.offset(posX, posY, posZ).grow(0.1), Predicates.or(EntityUtils.selectItemClassInstaceof(ItemCrystalToolBase.class), EntityUtils.selectItemClassInstaceof(ItemCrystalSword.class))); if (foundItems.size() <= 0) { CrystalProperties prop = getProperties(); if (prop != null) { int max = getMaxSize(); int grow = rand.nextInt(250) + 100; max = Math.min(prop.getSize() + grow, max); int cut = Math.max(0, prop.getCollectiveCapability() - (rand.nextInt(10) + 10)); applyProperties(new ToolCrystalProperties(max, prop.getPurity(), cut)); } } }
From source file:org.eclipse.sirius.diagram.editor.properties.sections.tool.createview.CreateViewMappingPropertySection.java
/** * Fetches the list of available values for the feature. * //w w w .j av a2 s .co m * @return The list of available values for the feature. */ protected List<?> getChoiceOfValues() { List<?> values = Collections.emptyList(); List<IItemPropertyDescriptor> propertyDescriptors = getDescriptors(); for (Iterator<IItemPropertyDescriptor> iterator = propertyDescriptors.iterator(); iterator.hasNext();) { IItemPropertyDescriptor propertyDescriptor = iterator.next(); if (((EStructuralFeature) propertyDescriptor.getFeature(eObject)) == getFeature()) values = new ArrayList<Object>(propertyDescriptor.getChoiceOfValues(eObject)); } // Start of user code choice of values if (!values.isEmpty()) { Predicate<Object> predicate = Predicates.or(Predicates.instanceOf(EdgeMapping.class), Predicates.instanceOf(EdgeMappingImport.class)); if (eObject instanceof CreateEdgeView) { values = Lists.newArrayList(Iterables.filter(values, predicate)); } else if (eObject instanceof CreateView) { values = Lists.newArrayList(Iterables.filter(values, Predicates.not(predicate))); } } // End of user code choice of values return values; }
From source file:org.eclipse.sirius.diagram.sequence.internal.tool.command.builders.FrameCreationCommandBuilder.java
/** * {@inheritDoc}/*from w w w . j a v a 2 s. c o m*/ */ @Override protected DCommand createEnclosingCommand() { Predicate<DDiagramElement> shouldFlag = Predicates.or(CombinedFragment.viewpointElementPredicate(), InteractionUse.viewpointElementPredicate()); return new SequenceCreatedEventsFlaggingSiriusCommand(editingDomain, getEnclosingCommandLabel(), diagram, shouldFlag); }
From source file:org.eclipse.sirius.diagram.sequence.ui.tool.internal.edit.validator.AbstractInteractionFrameValidator.java
/** * Constructor./*from w ww. ja v a2 s . c o m*/ * * @param frame * the interaction use or combined fragment which will be * resized. * @param requestQuery * a query on the request targeting the execution. */ public AbstractInteractionFrameValidator(AbstractFrame frame, RequestQuery requestQuery) { this.frame = frame; this.requestQuery = requestQuery; this.valid = false; this.invalidParents = Predicates.or(Predicates.instanceOf(AbstractFrame.class), Predicates.instanceOf(State.class)); }
From source file:com.takin.emmet.concurrent.retry.RetryerBuilder.java
/** * Configures the retryer to retry if an exception (i.e. any <code>Exception</code> or subclass * of <code>Exception</code>) is thrown by the call. * * @return <code>this</code> *///from ww w .jav a 2 s. co m public RetryerBuilder<V> retryIfException() { rejectionPredicate = Predicates.or(rejectionPredicate, new ExceptionClassPredicate<V>(Exception.class)); return this; }
From source file:com.eucalyptus.util.Exceptions.java
private static Predicate<String> makeSteFilter(final List<String> patterns) { Predicate<String> filter = Predicates.alwaysTrue(); for (String f : patterns) { filter = Predicates.or(filter, Predicates.containsPattern(f)); }/*from w ww.j av a 2s . c om*/ return filter; }
From source file:com.takin.emmet.concurrent.retry.RetryerBuilder.java
/** * Configures the retryer to retry if a runtime exception (i.e. any <code>RuntimeException</code> or subclass * of <code>RuntimeException</code>) is thrown by the call. * * @return <code>this</code> *//*from w w w.j a v a2 s . co m*/ public RetryerBuilder<V> retryIfRuntimeException() { rejectionPredicate = Predicates.or(rejectionPredicate, new ExceptionClassPredicate<V>(RuntimeException.class)); return this; }
From source file:com.google.template.soy.shared.internal.AbstractGenerateSoyEscapingDirectiveCode.java
/** * Called reflectively when Ant sees {@code <libdefined>}. *///from w w w . j a v a 2 s. c o m public void addConfiguredLibdefined(FunctionNamePredicate p) { final Pattern namePattern = p.namePattern; if (namePattern == null) { throw new IllegalStateException("Please specify a pattern attribute for <libdefined>"); } availableIdentifiers = Predicates.or(availableIdentifiers, new Predicate<String>() { @Override public boolean apply(String identifierName) { return namePattern.matcher(identifierName).matches(); } }); }
From source file:com.takin.emmet.concurrent.retry.RetryerBuilder.java
/** * Configures the retryer to retry if an exception of the given class (or subclass of the given class) is * thrown by the call./*w w w .ja v a 2 s . c o m*/ * * @param exceptionClass the type of the exception which should cause the retryer to retry * @return <code>this</code> */ public RetryerBuilder<V> retryIfExceptionOfType(@Nonnull Class<? extends Throwable> exceptionClass) { Preconditions.checkNotNull(exceptionClass, "exceptionClass may not be null"); rejectionPredicate = Predicates.or(rejectionPredicate, new ExceptionClassPredicate<V>(exceptionClass)); return this; }