Example usage for org.apache.commons.collections15 PredicateUtils notNullPredicate

List of usage examples for org.apache.commons.collections15 PredicateUtils notNullPredicate

Introduction

In this page you can find the example usage for org.apache.commons.collections15 PredicateUtils notNullPredicate.

Prototype

public static <T> Predicate<T> notNullPredicate() 

Source Link

Document

Gets a Predicate that checks if the input object passed in is not null.

Usage

From source file:org.drugis.addis.imports.ClinicaltrialsImporter.java

private static String createCentersNote(ClinicalStudy studyImport) {
    StringBuilder noteBuilder = new StringBuilder();
    for (LocationStruct l : studyImport.getLocation()) {
        FacilityStruct f = l.getFacility();
        AddressStruct a = f.getAddress();
        List<String> fields = new ArrayList<String>(Arrays
                .asList(new String[] { f.getName(), a.getZip(), a.getCity(), a.getState(), a.getCountry() }));
        CollectionUtils.filter(fields, PredicateUtils.notNullPredicate());
        noteBuilder.append(StringUtils.join(fields, ", "));
        noteBuilder.append('\n');
    }/*from ww w .j a v  a  2  s  . c  o m*/
    return noteBuilder.toString();
}

From source file:org.drugis.mtc.jags.JagsSyntaxModel.java

private String getDerivations() {
    Collection<String> lines = NetworkModel.transformTreatmentPairs(d_network,
            new Transformer<Pair<Treatment>, String>() {
                public String transform(Pair<Treatment> input) {
                    Treatment ti = input.getFirst();
                    Treatment tj = input.getSecond();
                    BasicParameter p = new BasicParameter(ti, tj);
                    BasicParameter q = new BasicParameter(tj, ti);
                    if (!d_pmtz.getParameters().contains(p) && !d_pmtz.getParameters().contains(q)) {
                        String e = expressRelativeEffect(ti, tj, s_rTransform);
                        return "\t`" + p + "` = function(x) { " + e + " }";
                    }/*from  ww  w. ja va2 s . com*/
                    return null;
                }
            });
    CollectionUtils.filter(lines, PredicateUtils.notNullPredicate());
    return StringUtils.join(lines, ",\n");
}