Search in sources :

Example 6 with ModelCategoryType

use of cbit.vcell.solver.SimulationModelInfo.ModelCategoryType in project vcell by virtualcell.

the class DefaultDataIdentifierFilter method accept.

public ArrayList<DataIdentifier> accept(String filterSetName, List<AnnotatedFunction> functionList, DataIdentifier[] filterTheseDataIdentifiers) {
    // 
    if (dataSymbolMetadataResolver != null) {
        ArrayList<String> allFilterNames = new ArrayList<String>();
        if (this.dataSymbolMetadataResolver != null) {
            ModelCategoryType[] uniqueCategories = dataSymbolMetadataResolver.getUniqueFilterCategories();
            for (ModelCategoryType catType : uniqueCategories) {
                allFilterNames.add(catType.getName());
            }
        }
        if (allFilterNames.contains(filterSetName)) {
            ArrayList<DataIdentifier> acceptedDataIdentifiers = new ArrayList<DataIdentifier>();
            for (DataIdentifier dataID : filterTheseDataIdentifiers) {
                DataSymbolMetadata metadata = dataSymbolMetadataResolver.getDataSymbolMetadata(dataID.getName());
                if (metadata != null && metadata.filterCategory.getName().equals(filterSetName)) {
                    String varName = dataID.getName();
                    if (varName.startsWith(MathFunctionDefinitions.Function_regionVolume_current.getFunctionName())) {
                        continue;
                    }
                    if (varName.startsWith(MathFunctionDefinitions.Function_regionArea_current.getFunctionName())) {
                        continue;
                    }
                    acceptedDataIdentifiers.add(dataID);
                }
            }
            return acceptedDataIdentifiers;
        }
    }
    ArrayList<DataIdentifier> acceptedDataIdentifiers = new ArrayList<DataIdentifier>();
    for (int i = 0; i < filterTheseDataIdentifiers.length; i++) {
        if (bPostProcessingMode && filterTheseDataIdentifiers[i].getVariableType().equals(VariableType.POSTPROCESSING)) {
            acceptedDataIdentifiers.add(filterTheseDataIdentifiers[i]);
            continue;
        }
        if (bPostProcessingMode && !filterTheseDataIdentifiers[i].getVariableType().equals(VariableType.POSTPROCESSING)) {
            continue;
        }
        if (!bPostProcessingMode && filterTheseDataIdentifiers[i].getVariableType().equals(VariableType.POSTPROCESSING)) {
            continue;
        }
        String varName = filterTheseDataIdentifiers[i].getName();
        if (varName.startsWith(MathFunctionDefinitions.Function_regionVolume_current.getFunctionName())) {
            continue;
        }
        if (varName.startsWith(MathFunctionDefinitions.Function_regionArea_current.getFunctionName())) {
            continue;
        }
        boolean bSizeVar = varName.startsWith(DiffEquMathMapping.PARAMETER_SIZE_FUNCTION_PREFIX);
        if (filterSetName.equals(REGION_SIZE_FILTER_SET) && bSizeVar) {
            acceptedDataIdentifiers.add(filterTheseDataIdentifiers[i]);
            continue;
        }
        if (!filterSetName.equals(REGION_SIZE_FILTER_SET) && bSizeVar) {
            continue;
        }
        if (filterSetName.equals(ALL)) {
            acceptedDataIdentifiers.add(filterTheseDataIdentifiers[i]);
        } else if (filterSetName.equals(VOLUME_FILTER_SET) && filterTheseDataIdentifiers[i].getVariableType().getVariableDomain().equals(VariableDomain.VARIABLEDOMAIN_VOLUME)) {
            acceptedDataIdentifiers.add(filterTheseDataIdentifiers[i]);
        } else if (filterSetName.equals(MEMBRANE_FILTER_SET) && filterTheseDataIdentifiers[i].getVariableType().getVariableDomain().equals(VariableDomain.VARIABLEDOMAIN_MEMBRANE)) {
            acceptedDataIdentifiers.add(filterTheseDataIdentifiers[i]);
        } else if (filterSetName.equals(USER_DEFINED_FILTER_SET)) {
            if (functionList != null) {
                for (AnnotatedFunction f : functionList) {
                    if (!f.isPredefined() && f.getName().equals(varName)) {
                        acceptedDataIdentifiers.add(filterTheseDataIdentifiers[i]);
                        break;
                    }
                }
            }
        }
    }
    if (acceptedDataIdentifiers.size() > 0) {
        return acceptedDataIdentifiers;
    }
    return null;
}
Also used : DataIdentifier(cbit.vcell.simdata.DataIdentifier) ModelCategoryType(cbit.vcell.solver.SimulationModelInfo.ModelCategoryType) ArrayList(java.util.ArrayList) DataSymbolMetadata(cbit.vcell.solver.DataSymbolMetadata) AnnotatedFunction(cbit.vcell.solver.AnnotatedFunction)

Aggregations

ModelCategoryType (cbit.vcell.solver.SimulationModelInfo.ModelCategoryType)6 ArrayList (java.util.ArrayList)4 JCheckBox (javax.swing.JCheckBox)3 DataSymbolMetadata (cbit.vcell.solver.DataSymbolMetadata)2 FunctionColumnDescription (cbit.vcell.math.FunctionColumnDescription)1 DataIdentifier (cbit.vcell.simdata.DataIdentifier)1 AnnotatedFunction (cbit.vcell.solver.AnnotatedFunction)1 ColumnDescription (cbit.vcell.util.ColumnDescription)1 BorderLayout (java.awt.BorderLayout)1 Dimension (java.awt.Dimension)1 BoxLayout (javax.swing.BoxLayout)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1