Example usage for java.util Collections EMPTY_SET

List of usage examples for java.util Collections EMPTY_SET

Introduction

In this page you can find the example usage for java.util Collections EMPTY_SET.

Prototype

Set EMPTY_SET

To view the source code for java.util Collections EMPTY_SET.

Click Source Link

Document

The empty set (immutable).

Usage

From source file:com.phoenixst.plexus.DefaultGraph.java

public Collection adjacentNodes(Object node, Predicate traverserPredicate) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(instanceString + ".adjacentNodes( " + node + ", " + traverserPredicate + " )");
    }//from  ww w  .  j a  v a  2s . c  o  m
    AdjacencyList adj = checkNode(node);
    CursorFilter filter = createCursorFilter(traverserPredicate);
    if (filter == FALSE_CURSOR_FILTER) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("  " + instanceString + ".adjacentNodes() returning empty set");
        }
        return Collections.EMPTY_SET;
    }
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("  " + instanceString + ".adjacentNodes() returning filtered collection");
    }
    return new AdjNodeCollection(adj, filter);
}

From source file:com.phoenixst.plexus.DefaultGraph.java

public Collection incidentEdges(Object node, Predicate traverserPredicate) {
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug(instanceString + ".incidentEdges( " + node + ", " + traverserPredicate + " )");
    }//w w w  . j a v a 2  s  . c  om
    AdjacencyList adj = checkNode(node);
    CursorFilter filter = createCursorFilter(traverserPredicate);
    if (filter == FALSE_CURSOR_FILTER) {
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("  " + instanceString + ".incidentEdges() returning empty set");
        }
        return Collections.EMPTY_SET;
    }
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("  " + instanceString + ".incidentEdges() returning filtered collection");
    }
    return new IncEdgeCollection(adj, filter);
}

From source file:com.tesora.dve.sql.schema.PETable.java

public Set<PETrigger> getAllTriggers(SchemaContext sc) {
    if (hasTriggers()) {
        final Set<PETrigger> allTriggers = new LinkedHashSet<PETrigger>();
        for (final TriggerEvent e : TriggerEvent.values()) {
            final PETableTriggerEventInfo trigger = triggers.get(e);
            if (trigger != null) {
                allTriggers.addAll(trigger.get());
            }/*from   w  w  w.j  a  v  a 2 s.  com*/
        }
    }

    return Collections.EMPTY_SET;
}

From source file:com.tesora.dve.tools.aitemplatebuilder.CorpusStats.java

private Set<Set<ExpressionNode>> decomposeIntoIndependentConditions(final ExpressionNode expr,
        final Set<EngineToken> acceptedOperators) {
    if (expr instanceof FunctionCall) {
        final FunctionCall func = (FunctionCall) expr;
        for (final EngineToken operator : acceptedOperators) {
            if (EngineConstant.FUNCTION.has(func, operator)) {
                return Collections.singleton(Collections.singleton(expr));
            }/* w w  w.j  av a 2s .  c o  m*/
        }

        final List<ExpressionNode> pars = func.getParameters();

        // Only binary functions - not foo(column).
        if (pars.size() == 2) {
            final Set<Set<ExpressionNode>> left = decomposeIntoIndependentConditions(pars.get(0),
                    acceptedOperators);
            final Set<Set<ExpressionNode>> right = decomposeIntoIndependentConditions(pars.get(1),
                    acceptedOperators);
            final Set<Set<ExpressionNode>> decomposed = new LinkedHashSet<Set<ExpressionNode>>();

            if (EngineConstant.FUNCTION.has(func, EngineConstant.OR)) {
                decomposed.addAll(left);
                decomposed.addAll(right);
            } else if (EngineConstant.FUNCTION.has(func, EngineConstant.AND)) {
                for (final Set<ExpressionNode> ln : left) {
                    for (final Set<ExpressionNode> rn : right) {
                        final Set<ExpressionNode> row = new LinkedHashSet<ExpressionNode>();
                        row.addAll(ln);
                        row.addAll(rn);
                        decomposed.add(row);
                    }
                }
            }

            return decomposed;
        }
    }

    return Collections.EMPTY_SET;
}

From source file:org.mindswap.pellet.KnowledgeBase.java

/**
 * Returns the (named) superclasses of class c. Depending onthe second parameter the resulting
 * list will include etiher all or only the direct superclasses.
 * /*from www .  ja  va  2s.co m*/
 * A class d is a direct superclass of c iff
 * <ol>
 *   <li> d is superclass of c </li> 
 *   <li> there is no other class x such that x is superclass of c and d is superclass of x </li>
 * </ol>
 * The class c itself is not included in the list but all the other classes that
 * are sameAs c are put into the list. Also note that the returned
 * list will always have at least one element. The list will either include one other
 * concept from the hierachy or the TOP concept if no other class subsumes c. By definition
 * TOP concept is superclass of every concept. 
 * 
 * <p>*** This function will first classify the whole ontology ***</p>
 * 
 * @param c class whose superclasses are returned
 * @return A set of sets, where each set in the collection represents an equivalence 
 * class. The elements of the inner class are ATermAppl objects. 
 */
public Set getSuperClasses(ATermAppl c, boolean direct) {
    c = ATermUtils.normalize(c);

    if (!isClass(c)) {
        if (PelletOptions.SILENT_UNDEFINED_ENTITY_HANDLING)
            return Collections.EMPTY_SET;
        else
            throw new UnsupportedFeatureException(c + " is not a class!");
    }

    classify();

    if (!taxonomy.contains(c))
        builder.classify(c);

    return taxonomy.getSupers(c, direct);
}

From source file:org.cloudfoundry.identity.uaa.scim.endpoints.ScimGroupEndpointsMockMvcTests.java

@Test
public void add_member_to_group() throws Exception {
    ScimUser user = createUserAndAddToGroups(IdentityZone.getUaa(), Collections.EMPTY_SET);
    String groupId = getGroupId("scim.read");
    ScimGroupMember scimGroupMember = new ScimGroupMember(user.getId(), ScimGroupMember.Type.USER,
            Arrays.asList(ScimGroupMember.Role.MEMBER, ScimGroupMember.Role.READER));
    MockHttpServletRequestBuilder post = post("/Groups/" + groupId + "/members")
            .header("Authorization", "Bearer " + scimWriteToken).header("Content-Type", APPLICATION_JSON_VALUE)
            .content(JsonUtils.writeValueAsString(scimGroupMember));
    String responseBody = getMockMvc().perform(post).andExpect(status().isCreated()).andReturn().getResponse()
            .getContentAsString();//from w w  w  .j  a  v a2  s  .  c o  m
    assertEquals(JsonUtils.writeValueAsString(scimGroupMember), responseBody);
}

From source file:org.mindswap.pellet.KnowledgeBase.java

public Set getDisjoints(ATermAppl c) {
    if (!isClass(c)) {
        if (PelletOptions.SILENT_UNDEFINED_ENTITY_HANDLING)
            return Collections.EMPTY_SET;
        else/*  www  . jav  a 2  s  .  c  o  m*/
            throw new UnsupportedFeatureException(c + " is not a class!");
    }

    ATermAppl notC = ATermUtils.normalize(ATermUtils.makeNot(c));
    Set disjoints = getSubClasses(notC);

    if (tbox.getAllClasses().contains(notC))
        disjoints.add(getAllEquivalentClasses(notC));

    return disjoints;
}

From source file:org.cloudfoundry.identity.uaa.scim.endpoints.ScimGroupEndpointsMockMvcTests.java

@Test
public void add_member_to_group_twice() throws Exception {
    ScimUser user = createUserAndAddToGroups(IdentityZone.getUaa(), Collections.EMPTY_SET);
    String groupId = getGroupId("scim.read");
    ScimGroupMember scimGroupMember = new ScimGroupMember(user.getId(), ScimGroupMember.Type.USER,
            Arrays.asList(ScimGroupMember.Role.MEMBER, ScimGroupMember.Role.READER));
    getMockMvc().perform(post("/Groups/" + groupId + "/members")
            .header("Authorization", "Bearer " + scimWriteToken).header("Content-Type", APPLICATION_JSON_VALUE)
            .content(JsonUtils.writeValueAsString(scimGroupMember))).andExpect(status().isCreated());

    scimGroupMember.setRoles(Arrays.asList(ScimGroupMember.Role.WRITER));
    getMockMvc().perform(post("/Groups/" + groupId + "/members")
            .header("Authorization", "Bearer " + scimWriteToken).header("Content-Type", APPLICATION_JSON_VALUE)
            .content(JsonUtils.writeValueAsString(scimGroupMember))).andExpect(status().isConflict());
}

From source file:org.mindswap.pellet.KnowledgeBase.java

public Set getComplements(ATermAppl c) {
    if (!isClass(c)) {
        if (PelletOptions.SILENT_UNDEFINED_ENTITY_HANDLING)
            return Collections.EMPTY_SET;
        else/* ww w .  j  a v  a2 s  . c o m*/
            throw new UnsupportedFeatureException(c + " is not a class!");
    }

    ATermAppl notC = ATermUtils.normalize(ATermUtils.makeNot(c));
    Set complements = getEquivalentClasses(notC);

    if (tbox.getAllClasses().contains(notC))
        complements.add(notC);

    return complements;
}

From source file:org.matonto.ontology.rest.impl.OntologyRestImplTest.java

@Test
public void testGetAnnotationsInOntologyWhenNoAnnotations() {
    when(ontology.getAllAnnotationProperties()).thenReturn(Collections.EMPTY_SET);
    when(ontology.getAllAnnotations()).thenReturn(Collections.EMPTY_SET);

    Response response = target().path("ontologies/" + encode(ontologyIRI.stringValue()) + "/annotations")
            .queryParam("branchId", branchId.stringValue()).queryParam("commitId", commitId.stringValue())
            .request().get();//  w w  w  .j av  a 2  s. c  om

    assertEquals(response.getStatus(), 200);
    verify(ontologyManager).retrieveOntology(any(Resource.class), any(Resource.class), any(Resource.class));
    assertGetOntology(true);
    assertAnnotations(getResponse(response), Collections.EMPTY_SET, Collections.EMPTY_SET);
}