Example usage for org.apache.commons.collections Predicate Predicate

List of usage examples for org.apache.commons.collections Predicate Predicate

Introduction

In this page you can find the example usage for org.apache.commons.collections Predicate Predicate.

Prototype

Predicate

Source Link

Usage

From source file:net.sourceforge.fenixedu.dataTransferObject.guide.reimbursementGuide.InfoReimbursementGuide.java

/**
 * @return/*www  .  ja va  2 s. c o  m*/
 */
public InfoReimbursementGuideSituation getActiveInfoReimbursementGuideSituation() {
    return (InfoReimbursementGuideSituation) CollectionUtils.find(getInfoReimbursementGuideSituations(),
            new Predicate() {
                @Override
                public boolean evaluate(Object obj) {
                    InfoReimbursementGuideSituation situation = (InfoReimbursementGuideSituation) obj;
                    return situation.getState().getState().intValue() == State.ACTIVE;
                }
            });
}

From source file:gov.nih.nci.caarray.domain.permissions.SecurityLevel.java

/**
 * @return the list of SecurityLevels that are available to the group access profile
 *//*  w  w  w .ja  va 2 s. com*/
public static List<SecurityLevel> collaboratorGroupLevels() {
    return valuesSubset(new Predicate() {
        public boolean evaluate(Object o) {
            return ((SecurityLevel) o).isAvailableToGroups();
        }
    });
}

From source file:de.softwareforge.pgpsigner.key.PublicKeyRing.java

public PublicKeyRing getMailedKeys() {

    return processMap(new Predicate() {
        public boolean evaluate(Object o) {
            return ((PublicKey) o).isMailed();
        }/*from ww  w.j av  a  2s  .  c o  m*/
    });
}

From source file:edu.kit.dama.mdm.dataorganization.impl.staging.CollectionNodeImpl.java

/**
 * Add a new child to this node.//  w w w .j  a  va 2 s. c o m
 *
 * @param child The new child.
 * @param pOverwrite Overwrite the child if it already exists.
 */
public final void addChild(final IDataOrganizationNode child, boolean pOverwrite) {
    IDataOrganizationNode result;

    if (pOverwrite) {
        result = (IDataOrganizationNode) CollectionUtils.find(children, new Predicate() {
            @Override
            public boolean evaluate(Object o) {
                IDataOrganizationNode node = (IDataOrganizationNode) o;
                if (o instanceof ICollectionNode && child instanceof IFileNode) {
                    return false;
                } else if (o instanceof IFileNode && child instanceof ICollectionNode) {
                    return false;
                } else {//node types are equal...check them
                    if (node.getName() != null) {
                        return node.getName().equals(child.getName());
                    } else if (child.getName() != null) {
                        return child.getName().equals(node.getName());
                    }
                    //both are null
                    return true;
                }
            }
        });
        if (children == null) {
            children = new ArrayList<>();
        }
        children.remove(result);
    }

    addChild(child);
}

From source file:bard.pubchem.model.PCAssayPanel.java

public XRef getGene() {
    List<PCAssayXRef> list = new ArrayList<PCAssayXRef>();
    CollectionUtils.select(assay.getAssayXRefs(), new Predicate() {
        public boolean evaluate(Object object) {
            PCAssayXRef xref = (PCAssayXRef) object;
            if (xref.getPanel() != null)
                if (xref.getPanel().getPanelNumber() == getPanelNumber() && xref.getXRef() != null
                        && "gene".equals(xref.getXRef().getDatabase()))
                    return true;
            return false;
        }/*  w w  w  . j  a v  a2  s. c om*/
    }, list);
    return list.size() > 0 ? list.get(0).getXRef() : null;
}

From source file:com.architexa.store.StoreUtil.java

public static Predicate filterSubjectResPred(final ReloRdfRepository repo, final URI p, final Resource o) {
    return new Predicate() {
        public boolean evaluate(Object arg0) {
            return repo.hasStatement((Resource) arg0, p, o);
        }/*www .  java 2  s  .  c  o  m*/
    };
}

From source file:gov.nih.nci.caarray.domain.protocol.ProtocolApplication.java

/**
 * Return the parameter value for the parameter with given name in this protocol application. 
 * If there is none, return null./*from   w ww  .jav  a 2s .com*/
 * @param parameterName name of parameter for which to find a value.
 * @return the parameter value for parameter with given name or null if there is none.
 */
public AbstractParameterValue getValue(final String parameterName) {
    return (AbstractParameterValue) CollectionUtils.find(getValues(), new Predicate() {
        public boolean evaluate(Object o) {
            AbstractParameterValue fv = (AbstractParameterValue) o;
            return parameterName.equals(fv.getParameter().getName());
        }
    });
}

From source file:gov.nih.nci.ncicb.tcga.dcc.datareports.service.AliquotIdBreakdownReportServiceImpl.java

private Predicate processAliquotIdBreakdownPredicates(final String getter, final String filter,
        final String emptyValueFilter) {
    final Class bbClass = AliquotIdBreakdown.class;
    return new Predicate() {
        public boolean evaluate(Object o) {
            if (filter == null || emptyValueFilter.equals(filter)) {
                return true;
            }//from www.j ava2 s. c o  m
            try {
                return GetterMethod.getGetter(bbClass, getter).invoke(o).toString().startsWith(filter);
            } catch (Exception e) {
                logger.debug(FancyExceptionLogger.printException(e));
                return true;
            }
        }
    };
}

From source file:edu.kit.sharing.test.SharingTestService.java

@Override
public IEntityWrapper<? extends IDefaultReferenceId> getReferences(String pDomain, String pDomainUniqueId,
        String pGroupId, HttpContext hc) {
    final GroupId gid = new GroupId(pGroupId);

    Collection rs = CollectionUtils.select(references, new Predicate() {

        @Override//from ww  w. j  ava2 s .com
        public boolean evaluate(Object o) {
            return ((ReferenceId) o).getGroupId().equals(gid);
        }
    });

    List<ReferenceId> referenceIds = new LinkedList<>();
    for (Object r : rs) {
        referenceIds.add(((ReferenceId) r));
    }
    return new ReferenceIdWrapper(referenceIds);
}

From source file:de.softwareforge.pgpsigner.key.PublicKeyRing.java

public PublicKeyRing getUploadedKeys() {

    return processMap(new Predicate() {
        public boolean evaluate(Object o) {
            return ((PublicKey) o).isUploaded();
        }/*  ww w.  j a v  a 2 s.  c o  m*/
    });
}