Search in sources :

Example 1 with EditableSymbolTableEntry

use of cbit.vcell.model.EditableSymbolTableEntry in project vcell by virtualcell.

the class BioModelParametersPanel method tableSelectionChanged.

protected void tableSelectionChanged() {
    setSelectedObjectsFromTable(parametersFunctionsTable, parametersFunctionsTableModel);
    int[] rows = parametersFunctionsTable.getSelectedRows();
    if (rows == null) {
        return;
    }
    for (int r : rows) {
        if (r < parametersFunctionsTableModel.getRowCount()) {
            EditableSymbolTableEntry parameter = parametersFunctionsTableModel.getValueAt(r);
            if (parameter instanceof ModelParameter || parameter instanceof SimulationContextParameter) {
                deleteButton.setEnabled(true);
                return;
            }
        }
    }
    deleteButton.setEnabled(false);
}
Also used : ModelParameter(cbit.vcell.model.Model.ModelParameter) SimulationContextParameter(cbit.vcell.mapping.SimulationContext.SimulationContextParameter) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 2 with EditableSymbolTableEntry

use of cbit.vcell.model.EditableSymbolTableEntry in project vcell by virtualcell.

the class BioModelParametersTableModel method computeData.

/**
 * Insert the method's description here.
 * Creation date: (9/23/2003 1:24:52 PM)
 * @return cbit.vcell.model.EditableSymbolTableEntry
 * @param row int
 */
protected List<EditableSymbolTableEntry> computeData() {
    ArrayList<EditableSymbolTableEntry> allEditableSymbolTableEntryList = new ArrayList<EditableSymbolTableEntry>();
    if (bioModel == null) {
        return null;
    }
    if (bGlobal) {
        Map<String, SymbolTableEntry> entryMap = new HashMap<String, SymbolTableEntry>();
        bioModel.getModel().getEntries(entryMap);
        for (SymbolTableEntry ste : entryMap.values()) {
            if (ste instanceof EditableSymbolTableEntry && !(ste instanceof ReservedSymbol)) {
                allEditableSymbolTableEntryList.add((EditableSymbolTableEntry) ste);
            }
        }
    }
    if (bReactions) {
        for (ReactionStep reactionStep : bioModel.getModel().getReactionSteps()) {
            allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionStep.getKinetics().getUnresolvedParameters()));
            allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionStep.getKinetics().getKineticsParameters()));
        }
        if (!bioModel.getModel().getRbmModelContainer().isEmpty()) {
            for (ReactionRule reactionRule : bioModel.getModel().getRbmModelContainer().getReactionRuleList()) {
                allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionRule.getKineticLaw().getLocalParameters()));
                allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionRule.getKineticLaw().getProxyParameters()));
                allEditableSymbolTableEntryList.addAll(Arrays.asList(reactionRule.getKineticLaw().getUnresolvedParameters()));
            }
        }
    }
    if (bApplications) {
        for (SimulationContext simContext : bioModel.getSimulationContexts()) {
            if (applicationSelection != null && (applicationSelection.isAll() || applicationSelection.getSimulationContext() == simContext)) {
                allEditableSymbolTableEntryList.addAll(getApplicationEditableSymbolTableEntryList(simContext));
            }
        }
    }
    boolean bSearchInactive = searchText == null || searchText.length() == 0;
    String lowerCaseSearchText = bSearchInactive ? null : searchText.toLowerCase();
    ArrayList<EditableSymbolTableEntry> parameterList = new ArrayList<EditableSymbolTableEntry>();
    for (EditableSymbolTableEntry parameter : allEditableSymbolTableEntryList) {
        boolean bNumeric = parameter.getExpression() == null || parameter.getExpression().isNumeric();
        if (bConstants && bNumeric || bFunctions && !bNumeric) {
            if (bSearchInactive || parameter.getNameScope().getPathDescription().toLowerCase().contains(lowerCaseSearchText) || parameter.getName().toLowerCase().contains(lowerCaseSearchText) || parameter.getExpression() != null && parameter.getExpression().infix().toLowerCase().contains(lowerCaseSearchText) || parameter.getDescription().toLowerCase().contains(lowerCaseSearchText)) {
                parameterList.add(parameter);
            }
        }
    }
    return parameterList;
}
Also used : SymbolTableEntry(cbit.vcell.parser.SymbolTableEntry) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry) ReactionRule(cbit.vcell.model.ReactionRule) HashMap(java.util.HashMap) ReservedSymbol(cbit.vcell.model.Model.ReservedSymbol) ReactionStep(cbit.vcell.model.ReactionStep) ArrayList(java.util.ArrayList) SimulationContext(cbit.vcell.mapping.SimulationContext) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 3 with EditableSymbolTableEntry

use of cbit.vcell.model.EditableSymbolTableEntry in project vcell by virtualcell.

the class BioModelParametersTableModel method propertyChange.

@Override
public void propertyChange(java.beans.PropertyChangeEvent evt) {
    super.propertyChange(evt);
    if (evt.getSource() instanceof EditableSymbolTableEntry) {
        int changeRow = getRowIndex((EditableSymbolTableEntry) evt.getSource());
        if (changeRow >= 0) {
            fireTableRowsUpdated(changeRow, changeRow);
        }
    } else {
        String propertyName = evt.getPropertyName();
        if (evt.getSource() == bioModel.getModel()) {
            if (propertyName.equals(Model.PROPERTY_NAME_MODEL_PARAMETERS)) {
                ModelParameter[] oldValue = (ModelParameter[]) evt.getOldValue();
                if (oldValue != null) {
                    for (EditableSymbolTableEntry parameter : oldValue) {
                        parameter.removePropertyChangeListener(this);
                    }
                }
                ModelParameter[] newValue = (ModelParameter[]) evt.getNewValue();
                if (newValue != null) {
                    for (EditableSymbolTableEntry parameter : newValue) {
                        parameter.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            } else if (propertyName.equals(Model.PROPERTY_NAME_SPECIES_CONTEXTS)) {
                SpeciesContext[] oldValue = (SpeciesContext[]) evt.getOldValue();
                if (oldValue != null) {
                    for (SpeciesContext sc : oldValue) {
                        sc.removePropertyChangeListener(this);
                    }
                }
                SpeciesContext[] newValue = (SpeciesContext[]) evt.getNewValue();
                if (newValue != null) {
                    for (SpeciesContext sc : newValue) {
                        sc.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            } else if (propertyName.equals(Model.PROPERTY_NAME_REACTION_STEPS)) {
                ReactionStep[] oldValue = (ReactionStep[]) evt.getOldValue();
                if (oldValue != null) {
                    for (ReactionStep reactionStep : oldValue) {
                        reactionStep.removePropertyChangeListener(this);
                        reactionStep.getKinetics().removePropertyChangeListener(this);
                        for (KineticsParameter kineticsEditableSymbolTableEntry : reactionStep.getKinetics().getKineticsParameters()) {
                            kineticsEditableSymbolTableEntry.removePropertyChangeListener(this);
                        }
                        for (ProxyParameter proxyEditableSymbolTableEntry : reactionStep.getKinetics().getProxyParameters()) {
                            proxyEditableSymbolTableEntry.removePropertyChangeListener(this);
                        }
                        for (UnresolvedParameter unresolvedEditableSymbolTableEntry : reactionStep.getKinetics().getUnresolvedParameters()) {
                            unresolvedEditableSymbolTableEntry.removePropertyChangeListener(this);
                        }
                    }
                }
                ReactionStep[] newValue = (ReactionStep[]) evt.getNewValue();
                if (newValue != null) {
                    for (ReactionStep reactionStep : newValue) {
                        reactionStep.addPropertyChangeListener(this);
                        reactionStep.getKinetics().addPropertyChangeListener(this);
                        for (KineticsParameter kineticsEditableSymbolTableEntry : reactionStep.getKinetics().getKineticsParameters()) {
                            kineticsEditableSymbolTableEntry.addPropertyChangeListener(this);
                        }
                        for (ProxyParameter proxyEditableSymbolTableEntry : reactionStep.getKinetics().getProxyParameters()) {
                            proxyEditableSymbolTableEntry.addPropertyChangeListener(this);
                        }
                        for (UnresolvedParameter unresolvedEditableSymbolTableEntry : reactionStep.getKinetics().getUnresolvedParameters()) {
                            unresolvedEditableSymbolTableEntry.addPropertyChangeListener(this);
                        }
                    }
                }
                refreshData();
            } else if (evt.getPropertyName().equals(RbmModelContainer.PROPERTY_NAME_REACTION_RULE_LIST)) {
                List<ReactionRule> oldValue = (List<ReactionRule>) evt.getOldValue();
                if (oldValue != null) {
                    for (ReactionRule rs : oldValue) {
                        rs.removePropertyChangeListener(this);
                    }
                }
                List<ReactionRule> newValue = (List<ReactionRule>) evt.getNewValue();
                if (newValue != null) {
                    for (ReactionRule rs : newValue) {
                        rs.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            }
        } else if (evt.getSource() == bioModel) {
            if (propertyName.equals(BioModel.PROPERTY_NAME_SIMULATION_CONTEXTS)) {
                SimulationContext[] oldValue = (SimulationContext[]) evt.getOldValue();
                for (SimulationContext simulationContext : oldValue) {
                    simulationContext.removePropertyChangeListener(this);
                    simulationContext.getGeometryContext().removePropertyChangeListener(this);
                    for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
                        mapping.removePropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                            parameter.removePropertyChangeListener(this);
                        }
                    }
                    simulationContext.getReactionContext().removePropertyChangeListener(this);
                    for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
                        spec.removePropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : spec.getParameters()) {
                            parameter.removePropertyChangeListener(this);
                        }
                    }
                    for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
                        elect.removePropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : elect.getParameters()) {
                            parameter.removePropertyChangeListener(this);
                        }
                    }
                    for (SpatialObject spatialObject : simulationContext.getSpatialObjects()) {
                        spatialObject.removePropertyChangeListener(this);
                    }
                    for (SpatialProcess spatialProcess : simulationContext.getSpatialProcesses()) {
                        spatialProcess.removePropertyChangeListener(this);
                        for (LocalParameter p : spatialProcess.getParameters()) {
                            p.removePropertyChangeListener(this);
                        }
                    }
                    for (SimulationContextParameter p : simulationContext.getSimulationContextParameters()) {
                        p.removePropertyChangeListener(this);
                    }
                }
                SimulationContext[] newValue = (SimulationContext[]) evt.getNewValue();
                for (SimulationContext simulationContext : newValue) {
                    simulationContext.addPropertyChangeListener(this);
                    simulationContext.getGeometryContext().addPropertyChangeListener(this);
                    for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
                        mapping.addPropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                            parameter.addPropertyChangeListener(this);
                        }
                    }
                    simulationContext.getReactionContext().addPropertyChangeListener(this);
                    for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
                        spec.addPropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : spec.getParameters()) {
                            parameter.addPropertyChangeListener(this);
                        }
                    }
                    for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
                        elect.addPropertyChangeListener(this);
                        for (EditableSymbolTableEntry parameter : elect.getParameters()) {
                            parameter.addPropertyChangeListener(this);
                        }
                    }
                    for (SpatialObject spatialObject : simulationContext.getSpatialObjects()) {
                        spatialObject.addPropertyChangeListener(this);
                    }
                    for (SpatialProcess spatialProcess : simulationContext.getSpatialProcesses()) {
                        spatialProcess.addPropertyChangeListener(this);
                        for (LocalParameter p : spatialProcess.getParameters()) {
                            p.addPropertyChangeListener(this);
                        }
                    }
                    for (SimulationContextParameter p : simulationContext.getSimulationContextParameters()) {
                        p.addPropertyChangeListener(this);
                    }
                }
                refreshData();
            }
        } else if (evt.getSource() instanceof GeometryContext && evt.getPropertyName().equals(GeometryContext.PROPERTY_STRUCTURE_MAPPINGS)) {
            StructureMapping[] oldValue = (StructureMapping[]) evt.getOldValue();
            if (oldValue != null) {
                for (StructureMapping mapping : oldValue) {
                    mapping.removePropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                        parameter.removePropertyChangeListener(this);
                    }
                }
            }
            StructureMapping[] newValue = (StructureMapping[]) evt.getNewValue();
            if (newValue != null) {
                for (StructureMapping mapping : newValue) {
                    mapping.addPropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                        parameter.addPropertyChangeListener(this);
                    }
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof ReactionStep && (evt.getPropertyName().equals(ReactionStep.PROPERTY_NAME_KINETICS))) {
            Kinetics oldValue = (Kinetics) evt.getOldValue();
            if (oldValue != null) {
                oldValue.removePropertyChangeListener(this);
                for (KineticsParameter kineticsEditableSymbolTableEntry : oldValue.getKineticsParameters()) {
                    kineticsEditableSymbolTableEntry.removePropertyChangeListener(this);
                }
                for (ProxyParameter proxyEditableSymbolTableEntry : oldValue.getProxyParameters()) {
                    proxyEditableSymbolTableEntry.removePropertyChangeListener(this);
                }
                for (UnresolvedParameter unresolvedEditableSymbolTableEntry : oldValue.getUnresolvedParameters()) {
                    unresolvedEditableSymbolTableEntry.removePropertyChangeListener(this);
                }
            }
            Kinetics newValue = (Kinetics) evt.getNewValue();
            if (newValue != null) {
                newValue.addPropertyChangeListener(this);
                for (KineticsParameter kineticsEditableSymbolTableEntry : newValue.getKineticsParameters()) {
                    kineticsEditableSymbolTableEntry.addPropertyChangeListener(this);
                }
                for (ProxyParameter proxyEditableSymbolTableEntry : newValue.getProxyParameters()) {
                    proxyEditableSymbolTableEntry.addPropertyChangeListener(this);
                }
                for (UnresolvedParameter unresolvedEditableSymbolTableEntry : newValue.getUnresolvedParameters()) {
                    unresolvedEditableSymbolTableEntry.addPropertyChangeListener(this);
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(SimulationContext.PROPERTY_NAME_SPATIALPROCESSES)) {
            SpatialProcess[] oldValue = (SpatialProcess[]) evt.getOldValue();
            if (oldValue != null) {
                for (SpatialProcess process : oldValue) {
                    process.removePropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : process.getParameters()) {
                        parameter.removePropertyChangeListener(this);
                    }
                }
            }
            SpatialProcess[] newValue = (SpatialProcess[]) evt.getNewValue();
            if (newValue != null) {
                for (SpatialProcess process : newValue) {
                    process.addPropertyChangeListener(this);
                    for (EditableSymbolTableEntry parameter : process.getParameters()) {
                        parameter.addPropertyChangeListener(this);
                    }
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(SimulationContext.PROPERTY_NAME_SPATIALOBJECTS)) {
            SpatialObject[] oldValue = (SpatialObject[]) evt.getOldValue();
            if (oldValue != null) {
                for (SpatialObject spatialObject : oldValue) {
                    spatialObject.removePropertyChangeListener(this);
                }
            }
            SpatialObject[] newValue = (SpatialObject[]) evt.getNewValue();
            if (newValue != null) {
                for (SpatialObject spatialObject : newValue) {
                    spatialObject.addPropertyChangeListener(this);
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof SpatialObject && evt.getPropertyName().equals(SpatialObject.PROPERTY_NAME_QUANTITYCATEGORIESENABLED)) {
            refreshData();
        } else if (evt.getSource() instanceof SimulationContext && evt.getPropertyName().equals(SimulationContext.PROPERTY_NAME_SIMULATIONCONTEXTPARAMETERS)) {
            SimulationContextParameter[] oldValue = (SimulationContextParameter[]) evt.getOldValue();
            if (oldValue != null) {
                for (SimulationContextParameter param : oldValue) {
                    param.removePropertyChangeListener(this);
                }
            }
            SimulationContextParameter[] newValue = (SimulationContextParameter[]) evt.getNewValue();
            if (newValue != null) {
                for (SimulationContextParameter param : newValue) {
                    param.addPropertyChangeListener(this);
                }
            }
            refreshData();
        } else if (evt.getSource() instanceof Kinetics && (evt.getPropertyName().equals(Kinetics.PROPERTY_NAME_KINETICS_PARAMETERS))) {
            EditableSymbolTableEntry[] oldValue = (EditableSymbolTableEntry[]) evt.getOldValue();
            if (oldValue != null) {
                for (int i = 0; i < oldValue.length; i++) {
                    oldValue[i].removePropertyChangeListener(this);
                }
            }
            EditableSymbolTableEntry[] newValue = (EditableSymbolTableEntry[]) evt.getNewValue();
            if (newValue != null) {
                for (int i = 0; i < newValue.length; i++) {
                    newValue[i].addPropertyChangeListener(this);
                }
            }
            refreshData();
        // } else if(evt.getSource() instanceof ReactionRuleEmbedded) {
        // ReactionRuleEmbedded reactionRule = (ReactionRuleEmbedded) evt.getSource();
        // int changeRow = getRowIndex(reactionRule);
        // if (changeRow >= 0) {
        // fireTableRowsUpdated(changeRow, changeRow);
        // }
        }
    }
}
Also used : UnresolvedParameter(cbit.vcell.model.Kinetics.UnresolvedParameter) SpeciesContext(cbit.vcell.model.SpeciesContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) StructureMapping(cbit.vcell.mapping.StructureMapping) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) ArrayList(java.util.ArrayList) List(java.util.List) GeometryContext(cbit.vcell.mapping.GeometryContext) ReactionRule(cbit.vcell.model.ReactionRule) SimulationContext(cbit.vcell.mapping.SimulationContext) SimulationContextParameter(cbit.vcell.mapping.SimulationContext.SimulationContextParameter) LocalParameter(cbit.vcell.mapping.ParameterContext.LocalParameter) ModelParameter(cbit.vcell.model.Model.ModelParameter) ElectricalStimulus(cbit.vcell.mapping.ElectricalStimulus) ProxyParameter(cbit.vcell.model.ProxyParameter) ReactionStep(cbit.vcell.model.ReactionStep) Kinetics(cbit.vcell.model.Kinetics) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 4 with EditableSymbolTableEntry

use of cbit.vcell.model.EditableSymbolTableEntry in project vcell by virtualcell.

the class BioModelParametersPanel method deleteButtonPressed.

protected void deleteButtonPressed() {
    try {
        int[] rows = parametersFunctionsTable.getSelectedRows();
        if (rows == null) {
            return;
        }
        String deleteListText = "";
        ArrayList<Parameter> deleteList = new ArrayList<Parameter>();
        for (int r : rows) {
            if (r < parametersFunctionsTableModel.getRowCount()) {
                EditableSymbolTableEntry parameter = parametersFunctionsTableModel.getValueAt(r);
                if (parameter instanceof ModelParameter) {
                    ModelParameter modelParameter = (ModelParameter) parameter;
                    deleteList.add(modelParameter);
                    deleteListText += "\tGlobal Parameter " + modelParameter.getName() + "\n";
                }
                if (parameter instanceof SimulationContextParameter) {
                    SimulationContextParameter simulationContextParameter = (SimulationContextParameter) parameter;
                    deleteList.add(simulationContextParameter);
                    deleteListText += "\tApplication(" + simulationContextParameter.getSimulationContext().getName() + ") Parameter " + simulationContextParameter.getName() + "\n";
                }
            }
        }
        String confirm = PopupGenerator.showOKCancelWarningDialog(this, "Deleting global and/or application parameters", "You are going to delete the following global/application parameter(s):\n\n " + deleteListText + "\n Continue?");
        if (confirm.equals(UserMessage.OPTION_CANCEL)) {
            return;
        }
        for (Parameter param : deleteList) {
            if (param instanceof ModelParameter) {
                bioModel.getModel().removeModelParameter((ModelParameter) param);
            }
            if (param instanceof SimulationContextParameter) {
                SimulationContextParameter simContextParameter = (SimulationContextParameter) param;
                SimulationContext simContext = simContextParameter.getSimulationContext();
                simContext.removeSimulationContextParameter(simContextParameter);
            }
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        DialogUtils.showErrorDialog(this, ex.getMessage());
    }
}
Also used : ModelParameter(cbit.vcell.model.Model.ModelParameter) ArrayList(java.util.ArrayList) Parameter(cbit.vcell.model.Parameter) SimulationContextParameter(cbit.vcell.mapping.SimulationContext.SimulationContextParameter) ModelParameter(cbit.vcell.model.Model.ModelParameter) SimulationContextParameter(cbit.vcell.mapping.SimulationContext.SimulationContextParameter) SimulationContext(cbit.vcell.mapping.SimulationContext) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 5 with EditableSymbolTableEntry

use of cbit.vcell.model.EditableSymbolTableEntry in project vcell by virtualcell.

the class BioModelParametersTableModel method setValueAt.

public void setValueAt(Object value, int row, int col) {
    if (value == null) {
        return;
    }
    try {
        String inputValue = (String) value;
        inputValue = inputValue.trim();
        EditableSymbolTableEntry parameter = getValueAt(row);
        switch(col) {
            case COLUMN_NAME:
                {
                    if (inputValue.length() == 0) {
                        return;
                    }
                    parameter.setName(inputValue);
                    break;
                }
            case COLUMN_EXPRESSION:
                {
                    String newExpressionString = inputValue;
                    if (parameter instanceof SpeciesContextSpec.SpeciesContextSpecParameter) {
                        SpeciesContextSpec.SpeciesContextSpecParameter scsParm = (SpeciesContextSpec.SpeciesContextSpecParameter) parameter;
                        Expression newExp = null;
                        if (newExpressionString == null || newExpressionString.trim().length() == 0) {
                            if (scsParm.getRole() == SpeciesContextSpec.ROLE_InitialConcentration || scsParm.getRole() == SpeciesContextSpec.ROLE_DiffusionRate || scsParm.getRole() == SpeciesContextSpec.ROLE_InitialCount) {
                                newExp = new Expression(0.0);
                            }
                        } else {
                            newExp = new Expression(newExpressionString);
                        }
                        scsParm.setExpression(newExp);
                    } else if (parameter instanceof KineticsParameter) {
                        Expression exp1 = new Expression(inputValue);
                        Kinetics kinetics = ((KineticsParameter) parameter).getKinetics();
                        kinetics.setParameterValue((Kinetics.KineticsParameter) parameter, exp1);
                    } else {
                        Expression exp1 = new Expression(inputValue);
                        exp1.bindExpression(parameter.getNameScope().getScopedSymbolTable());
                        parameter.setExpression(exp1);
                    }
                    break;
                }
            case COLUMN_UNIT:
                {
                    ModelUnitSystem modelUnitSystem = getModel().getUnitSystem();
                    if (inputValue.length() == 0) {
                        parameter.setUnitDefinition(modelUnitSystem.getInstance_TBD());
                    } else {
                        if (!parameter.getUnitDefinition().getSymbol().equals(inputValue)) {
                            parameter.setUnitDefinition(modelUnitSystem.getInstance(inputValue));
                        }
                    }
                    break;
                }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        DialogUtils.showErrorDialog(ownerTable, e.getMessage());
    }
}
Also used : KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) ScopedExpression(cbit.gui.ScopedExpression) Expression(cbit.vcell.parser.Expression) Kinetics(cbit.vcell.model.Kinetics) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry) ModelUnitSystem(cbit.vcell.model.ModelUnitSystem)

Aggregations

EditableSymbolTableEntry (cbit.vcell.model.EditableSymbolTableEntry)7 SimulationContext (cbit.vcell.mapping.SimulationContext)4 SimulationContextParameter (cbit.vcell.mapping.SimulationContext.SimulationContextParameter)4 SpeciesContextSpec (cbit.vcell.mapping.SpeciesContextSpec)4 ModelParameter (cbit.vcell.model.Model.ModelParameter)4 ArrayList (java.util.ArrayList)4 ElectricalStimulus (cbit.vcell.mapping.ElectricalStimulus)3 StructureMapping (cbit.vcell.mapping.StructureMapping)3 SpatialProcess (cbit.vcell.mapping.spatial.processes.SpatialProcess)3 Kinetics (cbit.vcell.model.Kinetics)3 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)3 ReactionStep (cbit.vcell.model.ReactionStep)3 LocalParameter (cbit.vcell.mapping.ParameterContext.LocalParameter)2 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)2 UnresolvedParameter (cbit.vcell.model.Kinetics.UnresolvedParameter)2 ProxyParameter (cbit.vcell.model.ProxyParameter)2 ReactionRule (cbit.vcell.model.ReactionRule)2 SpeciesContext (cbit.vcell.model.SpeciesContext)2 SymbolTableEntry (cbit.vcell.parser.SymbolTableEntry)2 HashMap (java.util.HashMap)2