Search in sources :

Example 86 with SymbolTableEntry

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;
}
Also used : SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry)

Example 87 with SymbolTableEntry

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;
}
Also used : ElectricalStimulus(cbit.vcell.mapping.ElectricalStimulus) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry) HashMap(java.util.HashMap) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) ArrayList(java.util.ArrayList) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) StructureMapping(cbit.vcell.mapping.StructureMapping) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 88 with SymbolTableEntry

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();
}
Also used : PropertyVetoException(java.beans.PropertyVetoException) JPanel(javax.swing.JPanel) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) EventAssignment(cbit.vcell.mapping.BioEvent.EventAssignment) Expression(cbit.vcell.parser.Expression) ExpressionException(cbit.vcell.parser.ExpressionException)

Example 89 with SymbolTableEntry

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);
    }
}
Also used : SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) SymbolTableFunctionEntry(cbit.vcell.parser.SymbolTableFunctionEntry)

Example 90 with SymbolTableEntry

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();
}
Also used : PlotData(cbit.plot.PlotData) SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) DecimalFormat(java.text.DecimalFormat) SingleXPlot2D(cbit.plot.SingleXPlot2D) Plot2D(cbit.plot.Plot2D) Range(org.vcell.util.Range) Point(java.awt.Point) SingleXPlot2D(cbit.plot.SingleXPlot2D)

Aggregations

SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)115 Expression (cbit.vcell.parser.Expression)50 ExpressionException (cbit.vcell.parser.ExpressionException)20 Vector (java.util.Vector)20 ArrayList (java.util.ArrayList)19 SpeciesContext (cbit.vcell.model.SpeciesContext)18 ModelParameter (cbit.vcell.model.Model.ModelParameter)14 PropertyVetoException (java.beans.PropertyVetoException)14 VCUnitDefinition (cbit.vcell.units.VCUnitDefinition)13 Model (cbit.vcell.model.Model)12 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)11 HashMap (java.util.HashMap)11 SimulationContext (cbit.vcell.mapping.SimulationContext)10 Variable (cbit.vcell.math.Variable)10 LocalParameter (cbit.vcell.mapping.ParameterContext.LocalParameter)9 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)9 Parameter (cbit.vcell.model.Parameter)9 SingleXPlot2D (cbit.plot.SingleXPlot2D)8 MathException (cbit.vcell.math.MathException)8 ReservedVariable (cbit.vcell.math.ReservedVariable)8