/** Returns the iterable scoped to the reachable elements. */ public <E extends ProtoElement> Iterable<E> reachable(Iterable<E> elems) { return scoper.filter(elems); }
private <E extends ProtoElement> void acceptElems(Iterable<E> elems) { for (E elem : elems) { if (!scoper.isReachable(elem)) { continue; } visit(elem); } }
/** * Scopes down a model based on a specified endpoint name. */ public static void scopeModel(final Model model, @Nullable String endpoint) { model.establishStage(Merged.KEY); endpoint = Strings.isNullOrEmpty(endpoint) ? model.getServiceConfig().getName() : endpoint; if (endpoint == null) { // If the endpoint is still null, that means the service config has no name, which means it // is a test config, and we should do nothing. return; } validateEndpoint(model, endpoint); model.putAttribute(ENDPOINT_FILTER_KEY, endpoint); model.setScoper(model.getScoper().restrict(new Predicate<ProtoElement>() { @Override public boolean apply(ProtoElement element) { return inEndpoint(model, element); } }, "")); }
/** * Scopes down a model based on a specified endpoint name. */ public static void scopeModel(final Model model, @Nullable String endpoint) { model.establishStage(Merged.KEY); endpoint = Strings.isNullOrEmpty(endpoint) ? model.getServiceConfig().getName() : endpoint; if (endpoint == null) { // If the endpoint is still null, that means the service config has no name, which means it // is a test config, and we should do nothing. return; } validateEndpoint(model, endpoint); model.putAttribute(ENDPOINT_FILTER_KEY, endpoint); model.setScoper(model.getScoper().restrict(new Predicate<ProtoElement>() { @Override public boolean apply(ProtoElement element) { return inEndpoint(model, element); } }, "")); }
private <E extends ProtoElement> void acceptElems(Iterable<E> elems) { for (E elem : elems) { if (!scoper.isReachable(elem)) { continue; } visit(elem); } }
/** Returns the iterable scoped to the reachable elements. */ public <E extends ProtoElement> Iterable<E> reachable(Iterable<E> elems) { return scoper.filter(elems); }
/** Return true if the element is reachable with the current scoper. */ public boolean isReachable() { return getModel().getScoper().isReachable(this); }
private void acceptMessages(Iterable<MessageType> messages) { for (MessageType message : messages) { if (ignoreMapEntry && message.isMapEntry() || !scoper.isReachable(message)) { continue; } visit(message); } }
private void acceptMessages(Iterable<MessageType> messages) { for (MessageType message : messages) { if (ignoreMapEntry && message.isMapEntry() || !scoper.isReachable(message)) { continue; } visit(message); } }
/** Return true if the element is reachable with the current scoper. */ public boolean isReachable() { return getModel().getScoper().isReachable(this); }