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;
}
Aggregations