use of cbit.vcell.model.RbmObservable in project vcell by virtualcell.
the class EventPanel method filterEventAssignmentVariables.
public static ArrayList<String> filterEventAssignmentVariables(SimulationContext simContext) {
// fill comboboxmodel with possible variables from simContext (symboltable entries) list
Map<String, SymbolTableEntry> entryMap = new HashMap<String, SymbolTableEntry>();
simContext.getEntries(entryMap);
ArrayList<String> varNameList = new ArrayList<String>();
for (String varName : entryMap.keySet()) {
SymbolTableEntry symbolTableEntry = entryMap.get(varName);
if (/*bExcludeFuncAndReserved && */
(symbolTableEntry instanceof SymbolTableFunctionEntry || symbolTableEntry instanceof Structure.StructureSize || symbolTableEntry instanceof Model.ReservedSymbol || symbolTableEntry instanceof RbmObservable)) {
continue;
}
if (simContext.getAssignmentRule(symbolTableEntry) != null) {
// we don't allow assignment rule variables, they'll become functions in the math
continue;
}
if (symbolTableEntry instanceof Model.ModelParameter) {
// exclude global parameters that are rate or assignment rule variables
if (simContext.getRateRule(symbolTableEntry) != null) {
// it's a rate rule variable, we can use it
;
} else {
Model.ModelParameter mp = (Model.ModelParameter) symbolTableEntry;
Expression exp = mp.getExpression();
try {
boolean isConstant = BioEvent.isConstantExpression(simContext, exp);
if (!isConstant) {
// System.out.println(mp.getName() + " - NO"); // skip this
continue;
}
// System.out.println(mp.getName() + " - yes: ");
} catch (ExpressionException e) {
// System.out.println(mp.getName() + " - NO"); // skip this
continue;
}
}
}
varNameList.add(varName);
}
Collections.sort(varNameList);
return varNameList;
}
Aggregations