List of usage examples for com.google.common.collect Iterators contains
public static boolean contains(Iterator<?> iterator, @Nullable Object element)
From source file:org.apache.jackrabbit.oak.security.user.MembershipProvider.java
/** * Tests if the membership of the specified {@code authorizableTree} * contains the given target group as defined by {@code groupTree}. * * @param authorizableTree The tree of the authorizable for which to resolve the membership. * @param groupPath The path of the group which needs to be tested. * @return {@code true} if the group is contained in the membership of the specified authorizable. *//*from w w w . j ava2s . co m*/ private boolean hasMembership(@Nonnull Tree authorizableTree, @Nonnull String groupPath) { return Iterators.contains(getMembership(authorizableTree, true), groupPath); }
From source file:org.tzi.use.uml.mm.MClassifierImpl.java
@Override public boolean isSubClassOf(MClassifier otherClassifier, boolean excludeThis) { return Iterators.contains(this.generalizationHierachie(!excludeThis).iterator(), otherClassifier); }
From source file:org.apache.jackrabbit.oak.security.user.MembershipProvider.java
/** * Returns {@code true} if the given {@code groupTree} contains a member with the given {@code authorizableTree} * * @param groupTree The new member to be tested for cyclic membership. * @param authorizableTree The authorizable to check * * @return true if the group has given member. */// w w w . j a v a 2 s .com boolean isMember(@Nonnull Tree groupTree, @Nonnull Tree authorizableTree) { if (!hasMembers(groupTree)) { return false; } if (pendingChanges(groupTree)) { return Iterators.contains(getMembers(groupTree, AuthorizableType.AUTHORIZABLE, true), authorizableTree.getPath()); } else { return hasMembership(authorizableTree, groupTree.getPath()); } }
From source file:org.apache.jackrabbit.oak.security.user.MembershipProvider.java
boolean isDeclaredMember(@Nonnull Tree groupTree, @Nonnull Tree authorizableTree) { if (!hasMembers(groupTree)) { return false; }// w ww. j a v a 2 s. co m String contentId = getContentID(authorizableTree); MemberReferenceIterator refs = new MemberReferenceIterator(groupTree) { @Override protected boolean hasProcessedReference(@Nonnull String value) { return true; } }; return Iterators.contains(refs, contentId); }
From source file:com.netxforge.netxstudio.screens.f3.charts.ChartScreen.java
/** * The selection should be objects of the type {@link EObject} and not be * already the currently injected objects in the {@link IScreen}. * /*from ww w. j a v a2s.co m*/ * @param selection * @return */ private boolean validSelection(Object[] selection) { // Check if we are the same as previously injected. // Same length, same objects. if (injectedObjects != null && (selection.length == injectedObjects.length)) { boolean allEqual = false; final Iterator<Object> currentObjects = Lists.newArrayList(injectedObjects).iterator(); for (Object o : selection) { allEqual |= Iterators.contains(currentObjects, o); } if (allEqual) { return false; } } for (Object o : selection) { if (o instanceof EObject) { continue; } else { return false; } } return true; }
From source file:com.netxforge.netxstudio.screens.f3.charts.ChartScreen.java
public void callBackEvent(MonitoringStateEvent event) { // We are called back for monitoring events. Object result = event.getResult(); boolean shouldRefresh = false; if (result instanceof IMonitoringSummary) { Notifier target = ((IMonitoringSummary) result).getTarget(); final Iterator<Object> currentObjects = Lists.newArrayList(getInjectedObjects()).iterator(); if (Iterators.contains(currentObjects, target)) { shouldRefresh = true;/* w ww .jav a 2 s . c o m*/ } } if (shouldRefresh) { // The mode is depending on how it was initially requested. // It would be better to embed the model in the adapter, so // it always stays with the object to be processed. // for now, use a default, which is reinit the chart model. refreshSummary(MODE_REINIT_MODEL); } monitoringState.deActivate(jobCallBack); }