Example usage for com.google.common.collect Multimap isEmpty

List of usage examples for com.google.common.collect Multimap isEmpty

Introduction

In this page you can find the example usage for com.google.common.collect Multimap isEmpty.

Prototype

boolean isEmpty();

Source Link

Document

Returns true if this multimap contains no key-value pairs.

Usage

From source file:com.isotrol.impe3.freemarker.wrap.URIBuilderModel.java

private Multimap<String, String> merge(List<String> args) {
    Multimap<String, String> extra = buildURIQueryParameters(args, 0);
    if (extra.isEmpty()) {
        return parameters;
    }/*from  www.  j  a  v  a2s.c o  m*/
    Multimap<String, String> total = LinkedListMultimap.create(parameters);
    total.putAll(extra);
    return total;
}

From source file:fr.jcgay.maven.plugin.buildplan.ListPluginMojo.java

public void execute() throws MojoExecutionException, MojoFailureException {

    Multimap<String, MojoExecution> plan = Groups.ByPlugin.of(calculateExecutionPlan().getMojoExecutions(),
            plugin);//from www  .  ja v a2 s . c o  m

    if (plan.isEmpty()) {
        getLog().warn("No plugin found with artifactId: " + plugin);
    } else {
        TableDescriptor descriptor = ListPluginTableDescriptor.of(plan.values());
        for (Map.Entry<String, Collection<MojoExecution>> executions : plan.asMap().entrySet()) {
            getLog().info(pluginTitleLine(descriptor, executions.getKey()));
            for (MojoExecution execution : executions.getValue()) {
                getLog().info(line(descriptor.rowFormat(), execution));
            }
        }
    }
}

From source file:fr.jcgay.maven.plugin.buildplan.ListPhaseMojo.java

public void execute() throws MojoExecutionException, MojoFailureException {

    Multimap<String, MojoExecution> phases = Groups.ByPhase.of(calculateExecutionPlan().getMojoExecutions(),
            phase);/*from   ww w. jav  a  2 s .  com*/

    if (!phases.isEmpty()) {
        TableDescriptor descriptor = ListPhaseTableDescriptor.of(phases.values());
        for (Map.Entry<String, Collection<MojoExecution>> currentPhase : phases.asMap().entrySet()) {
            getLog().info(phaseTitleLine(descriptor, currentPhase.getKey()));
            for (MojoExecution execution : currentPhase.getValue()) {
                getLog().info(line(descriptor.rowFormat(), execution));
            }
        }
    } else {
        getLog().warn("No plugin execution found within phase: " + phase);
    }
}

From source file:org.seedstack.business.internal.event.EventServiceInternal.java

@Override
public <E extends Event> void fire(E event) {
    LOGGER.debug("Synchronously fired {}", event.getClass().getName());
    for (Class<? extends Event> eventClass : eventHandlerClassesByEvent.keys().elementSet()) {
        if (eventClass.isAssignableFrom(event.getClass())) {
            checkCyclicCall(eventClass, event);
            Multimap<Class<? extends Event>, Event> currentEventClasses = context.get();

            boolean isFirstCall = currentEventClasses.isEmpty();

            context.get().put(eventClass, event);
            try {
                notifyHandlers(eventClass, event);
            } catch (Exception e) {
                throw SeedException.wrap(e, EventErrorCodes.HANDLER_EXECUTION_FAILED).put("event", eventClass);
            } finally {
                if (isFirstCall) {
                    context.remove();/*  w  w w  .ja  v a2  s.  com*/
                }
            }
        }
    }
}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRDFS10.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long subClassOf = AbstractDictionary.subClassOf;
    final long type = AbstractDictionary.type;
    final long clazz = AbstractDictionary.classRdfs;

    int loops = 0;

    final Multimap<Long, Long> typeMultimap = ts1.getMultiMapForPredicate(type);
    if (typeMultimap != null && !typeMultimap.isEmpty()) {
        for (final Long subject : typeMultimap.keySet()) {
            if (typeMultimap.get(subject).contains(clazz)) {
                loops++;/*from w w  w .j a  v  a 2s . c o  m*/
                final Triple result = new ImmutableTriple(subject, subClassOf, subject);
                outputTriples.add(result);
            }
        }
    }

    return loops;

}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRDFS6.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long subPropertyOf = AbstractDictionary.subPropertyOf;
    final long type = AbstractDictionary.type;
    final long property = AbstractDictionary.property;

    int loops = 0;

    final Multimap<Long, Long> typeMultimap = ts1.getMultiMapForPredicate(type);
    if (typeMultimap != null && !typeMultimap.isEmpty()) {
        for (final Long subject : typeMultimap.keySet()) {
            if (typeMultimap.get(subject).contains(property)) {
                loops++;/*from   ww w. ja v  a2 s  . c  o m*/
                final Triple result = new ImmutableTriple(subject, subPropertyOf, subject);
                outputTriples.add(result);
            }
        }
    }

    return loops;

}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRDFS8.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long clazz = AbstractDictionary.classRdfs;
    final long type = AbstractDictionary.type;
    final long ressource = AbstractDictionary.ressource;

    int loops = 0;

    final Multimap<Long, Long> typeMultimap = ts1.getMultiMapForPredicate(type);
    if (typeMultimap != null && !typeMultimap.isEmpty()) {
        for (final Long subject : typeMultimap.keySet()) {
            if (typeMultimap.get(subject).contains(clazz)) {
                loops++;/*from  w  w w .j av  a 2 s  .c o m*/
                final Triple result = new ImmutableTriple(subject, type, ressource);
                outputTriples.add(result);
            }
        }
    }

    return loops;

}

From source file:com.netflix.simianarmy.client.aws.chaos.TagsChaosCrawler.java

@Override
public List<InstanceGroup> groups(String... names) {
    Multimap<String, Instance> instances = getInstancesGroupedByTags(tags);

    if (instances.isEmpty()) {
        return ImmutableList.of();
    }//  ww  w. j a  v a 2 s .co m

    List<InstanceGroup> result = new ArrayList<>(instances.size());
    for (Map.Entry<String, Collection<Instance>> group : instances.asMap().entrySet()) {
        if (names != null && indexOf(names, group.getKey()) < 0)
            continue;
        InstanceGroup instanceGroup = new BasicInstanceGroup(group.getKey(), Type.TAGGED_EC2,
                awsClient.region());
        result.add(instanceGroup);
        for (Instance instance : group.getValue()) {
            instanceGroup.addInstance(instance.getInstanceId());
        }
    }
    return result;
}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRDFS13.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long datatype = AbstractDictionary.datatype;
    final long type = AbstractDictionary.type;
    final long subClassOf = AbstractDictionary.subClassOf;
    final long literal = AbstractDictionary.literal;

    int loops = 0;

    final Multimap<Long, Long> typeMultimap = ts1.getMultiMapForPredicate(type);
    if (typeMultimap != null && !typeMultimap.isEmpty()) {
        for (final Long subject : typeMultimap.keySet()) {
            if (typeMultimap.get(subject).contains(datatype)) {
                loops++;/*from   w w  w.j a v  a2  s.com*/
                final Triple result = new ImmutableTriple(subject, subClassOf, literal);
                outputTriples.add(result);
            }
        }
    }

    return loops;

}

From source file:fr.ujm.tse.lt2c.satin.rules.run.RunRDFS12.java

@Override
protected int process(final TripleStore ts1, final TripleStore ts2, final Collection<Triple> outputTriples) {

    final long containerMembershipProperty = AbstractDictionary.containerMembershipProperty;
    final long type = AbstractDictionary.type;
    final long subPropertyOf = AbstractDictionary.subPropertyOf;
    final long member = AbstractDictionary.member;

    int loops = 0;

    final Multimap<Long, Long> typeMultimap = ts1.getMultiMapForPredicate(type);
    if (typeMultimap != null && !typeMultimap.isEmpty()) {
        for (final Long subject : typeMultimap.keySet()) {
            if (typeMultimap.get(subject).contains(containerMembershipProperty)) {
                loops++;/*from   w  w w. j  av  a  2 s.  c  om*/
                final Triple result = new ImmutableTriple(subject, subPropertyOf, member);
                outputTriples.add(result);
            }
        }
    }

    return loops;

}