use of cbit.vcell.parser.SymbolTableEntry in project vcell by virtualcell.
the class PostProcessingBlock method getEntry.
public SymbolTableEntry getEntry(String id) {
SymbolTableEntry entry = null;
entry = ReservedMathSymbolEntries.getEntry(id, true);
if (entry != null) {
return entry;
}
entry = getMathDescription().getEntry(id);
if (entry != null) {
return entry;
}
entry = dataGeneratorHashMap.get(id);
if (entry != null) {
return entry;
}
return null;
}
use of cbit.vcell.parser.SymbolTableEntry in project vcell by virtualcell.
the class BioModelParametersTableModel method getApplicationEditableSymbolTableEntryList.
private List<EditableSymbolTableEntry> getApplicationEditableSymbolTableEntryList(SimulationContext simulationContext) {
ArrayList<EditableSymbolTableEntry> parameterList = new ArrayList<EditableSymbolTableEntry>();
Map<String, SymbolTableEntry> entryMap = new HashMap<String, SymbolTableEntry>();
simulationContext.getEntries(entryMap);
for (SymbolTableEntry ste : entryMap.values()) {
if (ste instanceof EditableSymbolTableEntry && ste.getNameScope() == simulationContext.getNameScope()) {
parameterList.add((EditableSymbolTableEntry) ste);
}
}
for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
parameterList.addAll(mapping.computeApplicableParameterList());
}
for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
parameterList.addAll(spec.computeApplicableParameterList());
}
for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
parameterList.addAll(Arrays.asList(elect.getParameters()));
}
for (SpatialProcess sp : simulationContext.getSpatialProcesses()) {
parameterList.addAll(Arrays.asList(sp.getParameters()));
}
return parameterList;
}
use of cbit.vcell.parser.SymbolTableEntry in project vcell by virtualcell.
the class EventPanel method addEventAssignment.
private void addEventAssignment() {
populateVariableComboBoxModel(getVarNameComboBoxModel(), getSimulationContext());
JPanel eventAssignmentPanel = getEventAssignmentPanel();
getEventAssignVarNameComboBox().setModel(getVarNameComboBoxModel());
getEventAssignExpressionTextField().setText("0.0");
Set<String> autoCompList = getAutoCompleteList();
getEventAssignExpressionTextField().setAutoCompletionWords(autoCompList);
getEventAssignExpressionTextField().setAutoCompleteSymbolFilter(getAutoCompleteFilter());
//
// If the OK option is chosen, get the var name and expression and create a new
// event assignment, add it to the list of event assignments in bioEvent
// Else, pop-up an error dialog indicating that event assignment cannot be added.
//
int ok = JOptionPane.showOptionDialog(this, eventAssignmentPanel, "New Action Event", 0, JOptionPane.PLAIN_MESSAGE, null, new String[] { "OK", "Cancel" }, null);
if (ok == javax.swing.JOptionPane.OK_OPTION) {
String varName = (String) getEventAssignVarNameComboBox().getSelectedItem();
EventAssignment newEventAssignment = null;
try {
SymbolTableEntry ste = fieldSimContext.getEntry(varName);
Expression eventAssgnExp = new Expression(getEventAssignExpressionTextField().getText());
newEventAssignment = fieldBioEvent.new EventAssignment(ste, eventAssgnExp);
fieldBioEvent.addEventAssignment(newEventAssignment);
} catch (ExpressionException e) {
e.printStackTrace(System.out);
} catch (PropertyVetoException e1) {
e1.printStackTrace(System.out);
String targetName = (newEventAssignment != null) ? (newEventAssignment.getTarget().getName()) : ("null");
DialogUtils.showErrorDialog(this, "Event Assignment '" + targetName + "' cannot be added." + e1.getMessage());
}
}
enableDeleteEventAssgnButton();
}
use of cbit.vcell.parser.SymbolTableEntry in project vcell by virtualcell.
the class EventPanel method populateVariableComboBoxModel.
public static void populateVariableComboBoxModel(DefaultComboBoxModel<String> defaultComboBoxModel, SimulationContext simContext) /*,boolean bExcludeFuncAndReserved*/
{
// fill comboboxmodel with possible variables from simContext (symboltable entries) list
defaultComboBoxModel.removeAllElements();
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 Model.ReservedSymbol)) {
continue;
}
varNameList.add(varName);
}
Collections.sort(varNameList);
for (String varName : varNameList) {
defaultComboBoxModel.addElement(varName);
}
}
use of cbit.vcell.parser.SymbolTableEntry in project vcell by virtualcell.
the class KymographPanel method configurePlotData.
/**
* Insert the method's description here.
* Creation date: (12/16/2004 10:46:05 AM)
* @param imgX int
* @param imgY int
*/
private void configurePlotData(int imgX, int imgY) {
//
// TimeScan Data
//
double[][] timeData = new double[2][currentTimes.length];
timeData[0] = currentTimes;
timeData[1] = new double[currentTimes.length];
for (int i = 0; i < currentTimes.length; i += 1) {
// timeData[1][i] = timeSeriesDataOrig[1+imgX][i];
timeData[1][i] = rawValues[imgX + (i * RESAMP_SIZE)];
}
;
localTimeDataMMMH = calcMMM(timeData[1]);
final int MAX_TITLE_VAL_LENGTH = 9;
DecimalFormat nf = new DecimalFormat();
String valS = null;
valS = currentDistances[imgX] + "";
if (valS.length() > MAX_TITLE_VAL_LENGTH) {
nf.applyPattern("#.###E0");
valS = nf.format(currentDistances[imgX]);
}
currentTimeSeriesPlot2D = new SingleXPlot2D(new SymbolTableEntry[] { currentSymbolTablEntry }, multiTimePlotHelper.getDataSymbolMetadataResolver(), "Time", new String[] { currentDataIdentifier.getName() }, timeData, new String[] { "Time Series (d=" + valS + ") Vert", "Time", /*"Time (s)"*/
"Value" });
getPlotPaneTimeSeries().setPlot2D(currentTimeSeriesPlot2D);
//
// LineScan Data
//
double[] lineData = new double[timeSeriesDataOrig.length - 1];
for (int i = 1; i < timeSeriesDataOrig.length; i += 1) {
lineData[i - 1] = timeSeriesDataOrig[i][imgY];
}
double[] lineScanDistances = accumDistancesDataOrig;
localDistDataMMMH = calcMMM(lineData);
PlotData plotData = new PlotData(lineScanDistances, lineData);
valS = currentTimes[imgY] + "";
if (valS.length() > MAX_TITLE_VAL_LENGTH) {
valS = nf.format(currentTimes[imgY]);
}
currentLineScanPlot2D = new Plot2D(new SymbolTableEntry[] { currentSymbolTablEntry }, multiTimePlotHelper.getDataSymbolMetadataResolver(), new String[] { currentDataIdentifier.getName() }, new PlotData[] { plotData }, new String[] { "Line Scan (t=" + valS + ") Horz", "Distance", /*"Distance (\u00b5m)"*/
"Value" });
getPlotPaneLineScan().setPlot2D(currentLineScanPlot2D);
Range xRangeTime = new Range(currentTimes[0], currentTimes[currentTimes.length - 1]);
Range xRangeDist = new Range(lineScanDistances[0], lineScanDistances[lineScanDistances.length - 1]);
Range yRangeTime = (allDataMMMH != null ? allDataMMMH.getRange() : null);
Range yRangeDist = yRangeTime;
if (bLocalScaling) {
yRangeTime = (localTimeDataMMMH != null ? localTimeDataMMMH.getRange() : null);
yRangeDist = (localDistDataMMMH != null ? localDistDataMMMH.getRange() : null);
}
getPlotPaneTimeSeries().forceXYRange(xRangeTime, yRangeTime);
getPlotPaneLineScan().forceXYRange(xRangeDist, yRangeDist);
configureMinMax();
getimagePaneView1().repaint();
}
Aggregations