Example usage for org.apache.commons.collections.list GrowthList decorate

List of usage examples for org.apache.commons.collections.list GrowthList decorate

Introduction

In this page you can find the example usage for org.apache.commons.collections.list GrowthList decorate.

Prototype

public static List decorate(List list) 

Source Link

Document

Factory method to create a growth list.

Usage

From source file:edu.scripps.fl.hibernate.DoubleListStringType.java

public List<Double> newList(int initialCapacity) {
    return (List<Double>) GrowthList.decorate(new ArrayList<Double>(initialCapacity));
}

From source file:edu.scripps.fl.hibernate.BooleanListStringType.java

public List<Boolean> newList(int initialCapacity) {
    return (List<Boolean>) GrowthList.decorate(new ArrayList<Boolean>(initialCapacity));
}

From source file:edu.scripps.fl.hibernate.StringListStringType.java

public List<String> newList(int initialCapacity) {
    return (List<String>) GrowthList.decorate(new ArrayList<String>(initialCapacity));
}

From source file:edu.scripps.fl.pubchem.PubChemXMLParserFactory.java

protected void populateAssayResultsFromXML(PCAssay assay, Node assayDescriptionNode) throws Exception {
    List<PCAssayResult> results = null;
    List<Node> assayResultNodes = assayDescriptionNode
            .selectNodes("../../../PC-AssaySubmit_data/PC-AssayResults");
    if (assayResultNodes.size() == 0)
        return;/*from   w  w  w  . ja  va  2  s .  co m*/
    else
        results = new ArrayList<PCAssayResult>(assayResultNodes.size());

    List<PCAssayColumn> testedCols = assay.getTestedColumns();
    PCAssayColumn activeColumn = assay.getActiveColumn();

    for (Node resultNode : assayResultNodes) {
        PCAssayResult result = new PCAssayResult();

        String val = resultNode.selectSingleNode("PC-AssayResults_sid").valueOf("text()");
        result.setSID(Long.parseLong(val));

        val = resultNode.selectSingleNode("PC-AssayResults_outcome").valueOf("@value");
        val = val.substring(0, 1).toUpperCase() + val.substring(1);
        result.setOutcome(val);

        val = resultNode.selectSingleNode("PC-AssayResults_rank").valueOf("text()");
        result.setRankScore(Integer.parseInt(val));

        List<Node> assayDataNodes = resultNode.selectNodes("PC-AssayResults_data/PC-AssayData");

        List<String> all = GrowthList.decorate(new ArrayList(assay.getColumns().size() - 2));
        result.setAllValues(all);
        for (Node node : assayDataNodes) {
            val = node.valueOf("PC-AssayData_tid/text()");
            int index = Integer.parseInt(val) - 1;
            val = node.selectSingleNode(".//*[starts-with(name(),'PC-AssayData_value_')]").getText();
            all.set(index, val);
        }

        // if a dose response assay with a marked activeConcentration
        if ("confirmatory".equals(assay.getActivityOutcomeMethod()) && activeColumn != null) {
            String actConc = all.get(activeColumn.getTID() - 1);
            if (null != actConc && !"".equals(actConc)) {
                result.setPrimaryValue(Double.valueOf(actConc));
                result.setPrimaryColumn(activeColumn);

                PCAssayColumn qualCol = assay.getQualifierColumn();
                if (qualCol != null) {
                    String qual = all.get(qualCol.getTID() - 1);
                    if (!"".equals(qual))
                        result.setQualifier(qual);
                }
            }

        } else if ("screening".equals(assay.getActivityOutcomeMethod()) && testedCols.size() > 0) {
            PCAssayColumn testedCol = testedCols.get(0);
            String value = all.get(testedCol.getTID() - 1);
            result.setPrimaryColumn(testedCol);
            if (null != value && !"".equals(value))
                if ("float".equals(testedCol.getType()) || "int".equals(testedCol.getType()))
                    result.setPrimaryValue(Double.parseDouble(value));
                else
                    result.setPrimaryValueAsString(value);
        }

        // put all testedConcentration columns into an ordered array. Interested in numbers here only.
        result.getTestedValues().clear();
        for (int ii = 0; ii < testedCols.size(); ii++) {
            PCAssayColumn testedCol = testedCols.get(ii);
            String value = all.get(testedCol.getTID() - 1);
            if (null != value && !"".equals(value)) {
                try {
                    Double dbl = Double.parseDouble(value);
                    result.getTestedValues().set(ii, dbl);
                } catch (NumberFormatException ex) {
                    // if not a number then don't worry about it.
                }
            }
        }
        assay.getResults().add(result);
    }

}

From source file:bard.pubchem.xml.PubChemXMLParserFactory.java

protected void populateAssayResultsFromXML(PCAssay assay, Node assayDescriptionNode) {
    List<Node> assayResultNodes = assayDescriptionNode
            .selectNodes("../../../PC-AssaySubmit_data/PC-AssayResults");
    if (assayResultNodes.size() == 0)
        return;/*from  w  w w .  j av a2 s .  c o  m*/

    for (Node resultNode : assayResultNodes) {
        PCAssayResult result = new PCAssayResult();

        String val = resultNode.selectSingleNode("PC-AssayResults_sid").valueOf("text()");
        result.setSID(Long.parseLong(val));

        val = resultNode.selectSingleNode("PC-AssayResults_outcome").valueOf("@value");
        val = val.substring(0, 1).toUpperCase() + val.substring(1);
        result.setOutcome(val);

        val = resultNode.selectSingleNode("PC-AssayResults_rank").valueOf("text()");
        result.setRankScore(Integer.parseInt(val));

        List<Node> assayDataNodes = resultNode.selectNodes("PC-AssayResults_data/PC-AssayData");

        List<String> all = GrowthList.decorate(new ArrayList<String>(assay.getColumns().size() - 2));
        result.setAllValues(all);
        for (Node node : assayDataNodes) {
            val = node.valueOf("PC-AssayData_tid/text()");
            int index = Integer.parseInt(val) - 1;
            val = node.selectSingleNode(".//*[starts-with(name(),'PC-AssayData_value_')]").getText();
            all.set(index, val);
        }
        assay.getResults().add(result);
    }

}

From source file:org.agnitas.web.RecipientForm.java

public RecipientForm() {
    updateButton = new ImageButton();
    deleteButton = new ImageButton();
    targetAddButton = new ImageButton();

    targetRemoveList = (List<ImageButton>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<ImageButton>(), imageButtonFactory));
    columnAndTypeList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    chainOperatorList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    parenthesisOpenedList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    primaryOperatorList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    primaryValueList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    parenthesisClosedList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    dateFormatList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    secondaryOperatorList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    secondaryValueList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    validTargetOperatorsList = (List<TargetOperator[]>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<TargetOperator[]>(), nullFactory));
    columnNameList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    columnTypeList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    advancedSearchVisible = false;/*from ww  w.j  av a  2  s. c  o m*/
    selectedFields = DEFAULT_FIELDS;
    selectedFieldsOld = DEFAULT_FIELDS;
}

From source file:org.agnitas.web.TargetForm.java

public TargetForm() {
    columnAndTypeList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    chainOperatorList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    parenthesisOpenedList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    primaryOperatorList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    primaryValueList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    parenthesisClosedList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    dateFormatList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    secondaryOperatorList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
    secondaryValueList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    validTargetOperatorsList = (List<TargetOperator[]>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<TargetOperator[]>(), nullFactory));
    columnNameList = (List<String>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<String>(), emptyStringFactory));
    columnTypeList = (List<Integer>) GrowthList
            .decorate(LazyList.decorate(new ArrayList<Integer>(), zeroIntegerFactory));
}

From source file:org.diffkit.diff.sns.DKPoiSheet.java

@SuppressWarnings("unchecked")
private List<Type> discoverColumnTypes(List<Row> rows_) {
    if (CollectionUtils.isEmpty(rows_))
        return null;
    List<Type> columnTypes = GrowthList
            .decorate(LazyList.decorate(new ArrayList<Type>(), FactoryUtils.nullFactory()));
    int start = this.hasHeader() ? 1 : 0;
    for (int i = start; i < rows_.size(); i++) {
        Row aRow = rows_.get(i);/*from   w ww.j  av a2s . c  o  m*/
        int width = aRow.getLastCellNum();
        for (int j = 0; j < width; j++) {
            Cell cell = aRow.getCell(j);
            if (cell == null)
                continue;
            if (_isDebugEnabled) {
                _log.debug(String.format("cell->%s formatString->%s format->%s", cell.getColumnIndex(),
                        cell.getCellStyle().getDataFormatString(), cell.getCellStyle().getDataFormat()));
            }
            Type cellType = mapColumnType(cell);
            Type columnType = columnTypes.get(j);
            if (_isDebugEnabled)
                _log.debug("cellType->{} columnType->{}", cellType, columnType);
            if (columnType == null)
                columnTypes.set(j, cellType);
            else if (columnType != cellType)
                columnTypes.set(j, Type.MIXED);
        }
    }
    return columnTypes;
}

From source file:uk.co.certait.htmlexporter.ss.CellRangeRow.java

@SuppressWarnings("unchecked")
protected CellRangeRow(int index) {
    this.index = index;
    cells = GrowthList.decorate(new ArrayList<TableCellReference>());
}