Example usage for com.google.common.collect SetMultimap keySet

List of usage examples for com.google.common.collect SetMultimap keySet

Introduction

In this page you can find the example usage for com.google.common.collect SetMultimap keySet.

Prototype

Set<K> keySet();

Source Link

Document

Returns a view collection of all distinct keys contained in this multimap.

Usage

From source file:org.robotframework.ide.eclipse.main.plugin.model.locators.KeywordDefinitionLocator.java

private ContinueDecision locateInLibraries(final RobotSuiteFile file, final KeywordDetector detector) {
    final SetMultimap<LibrarySpecification, String> librariesMap = file.getImportedLibraries();
    for (final LibrarySpecification libSpec : librariesMap.keySet()) {
        final List<KeywordSpecification> keywords = libSpec.getKeywords();
        for (final KeywordSpecification kwSpec : keywords) {
            final ContinueDecision shouldContinue = detector.libraryKeywordDetected(libSpec, kwSpec,
                    librariesMap.get(libSpec), file);
            if (shouldContinue == ContinueDecision.STOP) {
                return ContinueDecision.STOP;
            }/*  w  w w . j  av  a 2 s  . c o m*/
        }
    }
    return ContinueDecision.CONTINUE;
}

From source file:org.eclipse.gef4.zest.fx.policies.HoverFirstAnchorageOnHoverPolicy.java

@Override
public void hover(MouseEvent e) {
    SetMultimap<IVisualPart<Node, ? extends Node>, String> anchorages = getHost().getAnchorages();
    if (anchorages == null || anchorages.isEmpty()) {
        return;/* w  ww .j  av  a2 s .  co  m*/
    }
    getHost().getRoot().getViewer().<HoverModel<Node>>getAdapter(HoverModel.class)
            .setHover(anchorages.keySet().iterator().next());
}

From source file:org.eclipse.gef4.zest.fx.parts.ZestFxHidingHandlePart.java

protected void onClicked(MouseEvent event) {
    SetMultimap<IVisualPart<Node, ? extends Node>, String> anchorages = getAnchorages();
    if (anchorages == null || anchorages.isEmpty()) {
        return;/*from  w w  w  . j  a v  a  2s  . c  o m*/
    }
    IVisualPart<Node, ? extends Node> anchorage = anchorages.keySet().iterator().next();
    HideNodePolicy hideNodePolicy = anchorage.getAdapter(HideNodePolicy.class);
    hideNodePolicy.hide();
}

From source file:org.gradle.internal.component.external.model.ivy.RealisedIvyModuleResolveMetadataSerializationHelper.java

private void writeDependencyConfigurationMapping(Encoder encoder, IvyDependencyDescriptor dep)
        throws IOException {
    SetMultimap<String, String> confMappings = dep.getConfMappings();
    encoder.writeSmallInt(confMappings.keySet().size());
    for (String conf : confMappings.keySet()) {
        encoder.writeString(conf);//from   w ww  .j  ava2 s . c  om
        writeStringSet(encoder, confMappings.get(conf));
    }
}

From source file:brooklyn.event.feed.function.FunctionFeed.java

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override//from  ww  w.ja  v  a2s . c  om
protected void preStart() {
    SetMultimap<FunctionPollIdentifier, FunctionPollConfig<?, ?>> polls = getConfig(POLLS);
    for (final FunctionPollIdentifier pollInfo : polls.keySet()) {
        Set<FunctionPollConfig<?, ?>> configs = polls.get(pollInfo);
        long minPeriod = Integer.MAX_VALUE;
        Set<AttributePollHandler<?>> handlers = Sets.newLinkedHashSet();

        for (FunctionPollConfig<?, ?> config : configs) {
            handlers.add(new AttributePollHandler(config, entity, this));
            if (config.getPeriod() > 0)
                minPeriod = Math.min(minPeriod, config.getPeriod());
        }

        getPoller().scheduleAtFixedRate((Callable) pollInfo.job, new DelegatingPollHandler(handlers),
                minPeriod);
    }
}

From source file:de.fau.osr.core.db.DataSource.java

/**
 * default implementation for retrieving all requirements.
 * {@link DataSource#getAllReqCommitRelations()} is used
 * @return requirement data objects//w w  w  . j av a 2 s .com
 * @throws IOException
 */
protected Set<Requirement> doGetAllRequirements() throws IOException {
    SetMultimap<String, String> allRelations = getAllReqCommitRelations();

    Set<String> reqIds = allRelations.keySet();
    Set<Requirement> result = new HashSet<>();

    for (String reqId : reqIds) {
        Set<String> commits = getCommitRelationByReq(reqId);
        result.add(new Requirement(reqId, null, null, commits, 0));
    }

    return result;
}

From source file:org.n52.iceland.convert.RequestResponseModifierRepository.java

@Override
public void init() {
    RequestResponseModifierRepository.instance = this;
    SetMultimap<RequestResponseModifierKey, Producer<RequestResponseModifier>> implementations = getProviders(
            this.components, this.componentFactories);
    this.requestResponseModifier.clear();
    for (RequestResponseModifierKey key : implementations.keySet()) {
        requestResponseModifier.putAll(key, implementations.get(key));
    }/*ww w . jav  a2s .  com*/
}

From source file:org.jboss.errai.validation.rebind.GwtValidatorGenerator.java

public ClassStructureBuilder<?> generate(final GeneratorContext context) {
    if (globalConstraints == null) {
        globalConstraints = new HashSet<MetaClass>();
        for (Class<?> clazz : new ContraintScanner().getTypesAnnotatedWith(Constraint.class)) {
            globalConstraints.add(MetaClassFactory.get(clazz));
        }/*from   www . j  a v a 2 s .c  om*/
    }

    Collection<MetaClass> constraints = ClassScanner.getTypesAnnotatedWith(Constraint.class, context);
    Set<MetaClass> allConstraints = new HashSet<MetaClass>();
    allConstraints.addAll(globalConstraints);
    allConstraints.addAll(constraints);

    final SetMultimap<MetaClass, Annotation> validationConfig = getValidationConfig(allConstraints, context);
    final Set<Class<?>> beans = extractValidatableBeans(validationConfig.keySet(), context);
    final Set<Class<?>> groups = extractValidationGroups(validationConfig);

    final Set<Class<?>> filteredBeans = new HashSet<Class<?>>();
    SimplePackageFilter filter = new SimplePackageFilter(
            PropertiesUtil.getPropertyValues(BLACKLIST_PROPERTY, " "));
    for (Class<?> bean : beans) {
        if (!filter.apply(bean.getName())) {
            filteredBeans.add(bean);
        }
    }

    if (filteredBeans.isEmpty() || groups.isEmpty()) {
        // Nothing to validate
        return null;
    }

    ClassStructureBuilder<?> builder = ClassBuilder.define("Gwt" + Validator.class.getSimpleName())
            .publicScope().interfaceDefinition().implementsInterface(Validator.class).body();

    builder.getClassDefinition().addAnnotation(new GwtValidation() {
        @Override
        public Class<?>[] value() {
            return filteredBeans.toArray(new Class<?>[filteredBeans.size()]);
        }

        @Override
        public Class<?>[] groups() {
            return groups.toArray(new Class<?>[groups.size()]);
        }

        @Override
        public Class<? extends Annotation> annotationType() {
            return GwtValidation.class;
        }
    });

    return builder;
}

From source file:org.apache.brooklyn.feed.AbstractCommandFeed.java

@Override
protected void preStart() {
    SetMultimap<CommandPollIdentifier, CommandPollConfig<?>> polls = config().get(POLLS);

    for (final CommandPollIdentifier pollInfo : polls.keySet()) {
        Set<CommandPollConfig<?>> configs = polls.get(pollInfo);
        long minPeriod = Integer.MAX_VALUE;
        Set<AttributePollHandler<? super SshPollValue>> handlers = Sets.newLinkedHashSet();

        for (CommandPollConfig<?> config : configs) {
            handlers.add(new AttributePollHandler<SshPollValue>(config, entity, this));
            if (config.getPeriod() > 0)
                minPeriod = Math.min(minPeriod, config.getPeriod());
        }/*from  w w  w .j  av a2 s  . c om*/

        getPoller().scheduleAtFixedRate(new Callable<SshPollValue>() {
            @Override
            public SshPollValue call() throws Exception {
                return exec(pollInfo.command.get(), pollInfo.env.get());
            }
        }, new DelegatingPollHandler<SshPollValue>(handlers), minPeriod);
    }
}

From source file:org.apache.brooklyn.feed.shell.ShellFeed.java

@Override
protected void preStart() {
    SetMultimap<ShellPollIdentifier, ShellPollConfig<?>> polls = getConfig(POLLS);

    for (final ShellPollIdentifier pollInfo : polls.keySet()) {
        Set<ShellPollConfig<?>> configs = polls.get(pollInfo);
        long minPeriod = Integer.MAX_VALUE;
        Set<AttributePollHandler<? super SshPollValue>> handlers = Sets.newLinkedHashSet();

        for (ShellPollConfig<?> config : configs) {
            handlers.add(new AttributePollHandler<SshPollValue>(config, entity, this));
            if (config.getPeriod() > 0)
                minPeriod = Math.min(minPeriod, config.getPeriod());
        }//from w  w w  .ja  v  a2  s .  com

        final ProcessTaskFactory<?> taskFactory = newTaskFactory(pollInfo.command, pollInfo.env, pollInfo.dir,
                pollInfo.input, pollInfo.context, pollInfo.timeout);
        final ExecutionContext executionContext = ((EntityInternal) entity).getManagementSupport()
                .getExecutionContext();

        getPoller().scheduleAtFixedRate(new Callable<SshPollValue>() {
            @Override
            public SshPollValue call() throws Exception {
                ProcessTaskWrapper<?> taskWrapper = taskFactory.newTask();
                executionContext.submit(taskWrapper);
                taskWrapper.block();
                Optional<Integer> exitCode = Optional.fromNullable(taskWrapper.getExitCode());
                return new SshPollValue(null, exitCode.or(-1), taskWrapper.getStdout(),
                        taskWrapper.getStderr());
            }
        }, new DelegatingPollHandler<SshPollValue>(handlers), minPeriod);
    }
}