use of org.vcell.model.rbm.common.NetworkConstraintsEntity in project vcell by virtualcell.
the class NetworkConstraintsTableModel method computeData.
protected ArrayList<NetworkConstraintsEntity> computeData() {
ArrayList<NetworkConstraintsEntity> nceList = new ArrayList<NetworkConstraintsEntity>();
Model model = simContext.getModel();
RbmModelContainer rbmModelContainer = model.getRbmModelContainer();
if (rbmModelContainer == null) {
return nceList;
}
String s1, s2, s3, s4;
NetworkConstraintsEntity nce;
NetworkConstraints networkConstraints = simContext.getNetworkConstraints();
if (networkConstraints != null) {
s1 = networkConstraints.getMaxIteration() + "";
s2 = networkConstraints.getMaxMoleculesPerSpecies() + "";
s3 = networkConstraints.getSpeciesLimit() + "";
s4 = networkConstraints.getReactionsLimit() + "";
} else {
s1 = "?";
s2 = "?";
s3 = "?";
s4 = "?";
}
nce = new NetworkConstraintsEntity(sMaxIterationName, s1, NetworkTransformer.defaultMaxIteration + "");
nceList.add(nce);
nce = new NetworkConstraintsEntity(sMaxMoleculesName, s2, NetworkTransformer.defaultMaxMoleculesPerSpecies + "");
nceList.add(nce);
nce = new NetworkConstraintsEntity(sSpeciesLimitName, s3, NetworkTransformer.defaultSpeciesLimit + "");
nceList.add(nce);
nce = new NetworkConstraintsEntity(sReactionsLimitName, s4, NetworkTransformer.defaultReactionsLimit + "");
nceList.add(nce);
Map<MolecularType, Integer> stoichiometryMap = networkConstraints.getMaxStoichiometry(simContext);
Iterator<Entry<MolecularType, Integer>> it = stoichiometryMap.entrySet().iterator();
while (it.hasNext()) {
// first clean any entry that doesn't exist anymore (should never happen!)
MolecularType mt = it.next().getKey();
if (rbmModelContainer.getMolecularType(mt.getName()) == null) {
it.remove();
}
}
for (MolecularType mt : rbmModelContainer.getMolecularTypeList()) {
// add any new molecule that's not already there, with the default max stoichiometry
if (!stoichiometryMap.containsKey(mt)) {
stoichiometryMap.put(mt, NetworkConstraints.defaultMaxStoichiometry);
}
}
for (Map.Entry<MolecularType, Integer> entry : stoichiometryMap.entrySet()) {
MolecularType mt = entry.getKey();
Integer value = entry.getValue();
nce = new NetworkConstraintsEntity("Max molecules " + mt.getDisplayName() + " / Species", value + "", NetworkConstraints.defaultMaxStoichiometry + "");
nceList.add(nce);
}
return nceList;
}
use of org.vcell.model.rbm.common.NetworkConstraintsEntity in project vcell by virtualcell.
the class NetworkConstraintsTableModel method getValueAt.
@Override
public Object getValueAt(int row, int column) {
if (simContext == null) {
return null;
}
NetworkConstraintsEntity nce = getValueAt(row);
String colName = nce.getName();
String colValue = nce.getValue();
String colDefault = nce.getDefaultValue();
NetworkConstraints networkConstraints = simContext.getNetworkConstraints();
if (row == 0) {
colValue = networkConstraints.getMaxIteration() + "";
} else if (row == 1) {
colValue = networkConstraints.getMaxMoleculesPerSpecies() + "";
} else if (row == 2) {
colValue = networkConstraints.getSpeciesLimit() + "";
} else if (row == 3) {
colValue = networkConstraints.getReactionsLimit() + "";
}
if (nce != null) {
switch(column) {
case iColName:
return colName;
case iColValue:
return colValue;
case iColDefault:
return colDefault;
}
}
return null;
}
use of org.vcell.model.rbm.common.NetworkConstraintsEntity in project vcell by virtualcell.
the class IssuePanel method invokeHyperlink.
private void invokeHyperlink(Issue issue) {
if (selectionManager != null) {
// followHyperlink is no-op if selectionManger null, so no point in proceeding if it is
IssueContext issueContext = issue.getIssueContext();
IssueSource object = issue.getSource();
if (object instanceof DecoratedIssueSource) {
DecoratedIssueSource dis = (DecoratedIssueSource) object;
dis.activateView(selectionManager);
} else if (object instanceof Parameter) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.BIOMODEL_PARAMETERS_NODE, ActiveViewID.parameters_functions), new Object[] { object });
} else if (object instanceof StructureMapping) {
StructureMapping structureMapping = (StructureMapping) object;
StructureMappingNameScope structureMappingNameScope = (StructureMappingNameScope) structureMapping.getNameScope();
SimulationContext simulationContext = ((SimulationContextNameScope) (structureMappingNameScope.getParent())).getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
} else if (object instanceof SpatialObject) {
SpatialObject spatialObject = (SpatialObject) object;
SimulationContext simulationContext = spatialObject.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.spatial_objects), new Object[] { object });
} else if (object instanceof SpatialProcess) {
SpatialProcess spatialProcess = (SpatialProcess) object;
SimulationContext simulationContext = spatialProcess.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.spatial_processes), new Object[] { object });
} else if (object instanceof GeometryContext.UnmappedGeometryClass) {
UnmappedGeometryClass unmappedGeometryClass = (UnmappedGeometryClass) object;
SimulationContext simulationContext = unmappedGeometryClass.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
} else if (object instanceof MicroscopeMeasurement) {
SimulationContext simulationContext = ((MicroscopeMeasurement) object).getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.microscope_measuremments), new Object[] { object });
} else if (object instanceof BioEvent) {
BioEvent be = (BioEvent) object;
SimulationContext simulationContext = be.getSimulationContext();
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.events), new Object[] { object });
} else if (object instanceof OutputFunctionIssueSource) {
SimulationOwner simulationOwner = ((OutputFunctionIssueSource) object).getOutputFunctionContext().getSimulationOwner();
if (simulationOwner instanceof SimulationContext) {
SimulationContext simulationContext = (SimulationContext) simulationOwner;
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, ActiveViewID.output_functions), new Object[] { ((OutputFunctionIssueSource) object).getAnnotatedFunction() });
} else if (simulationOwner instanceof MathModel) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_OUTPUT_FUNCTIONS_NODE, ActiveViewID.math_output_functions), new Object[] { ((OutputFunctionIssueSource) object).getAnnotatedFunction() });
}
} else if (object instanceof Simulation) {
Simulation simulation = (Simulation) object;
SimulationOwner simulationOwner = simulation.getSimulationOwner();
if (simulationOwner instanceof SimulationContext) {
SimulationContext simulationContext = (SimulationContext) simulationOwner;
followHyperlink(new ActiveView(simulationContext, DocumentEditorTreeFolderClass.SIMULATIONS_NODE, ActiveViewID.simulations), new Object[] { simulation });
} else if (simulationOwner instanceof MathModel) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE, ActiveViewID.math_simulations), new Object[] { simulation });
}
} else if (object instanceof AssignmentRule) {
AssignmentRule ar = (AssignmentRule) object;
SimulationContext sc = ar.getSimulationContext();
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.assignmentRules), new Object[] { ar });
} else if (object instanceof RateRule) {
RateRule rr = (RateRule) object;
SimulationContext sc = rr.getSimulationContext();
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.PROTOCOLS_NODE, ActiveViewID.rateRules), new Object[] { rr });
} else if (object instanceof GeometryContext) {
setActiveView(new ActiveView(((GeometryContext) object).getSimulationContext(), DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition));
} else if (object instanceof Structure) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.STRUCTURES_NODE, ActiveViewID.structures), new Object[] { object });
} else if (object instanceof MolecularType) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE, ActiveViewID.structures), new Object[] { object });
} else if (object instanceof ReactionStep) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] { object });
} else if (object instanceof ReactionRule) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] { object });
} else if (object instanceof SpeciesContextSpec) {
SpeciesContextSpec scs = (SpeciesContextSpec) object;
ActiveView av = new ActiveView(scs.getSimulationContext(), DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.species_settings);
followHyperlink(av, new Object[] { object });
} else if (object instanceof ReactionCombo) {
ReactionCombo rc = (ReactionCombo) object;
followHyperlink(new ActiveView(rc.getReactionContext().getSimulationContext(), DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.reaction_setting), new Object[] { ((ReactionCombo) object).getReactionSpec() });
} else if (object instanceof SpeciesContext) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species), new Object[] { object });
} else if (object instanceof RbmObservable) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.OBSERVABLES_NODE, ActiveViewID.observables), new Object[] { object });
} else if (object instanceof MathDescription) {
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_SIMULATIONS_NODE, ActiveViewID.generated_math), new Object[] {object});
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.structure_mapping), new Object[] { object });
} else if (object instanceof SpeciesPattern) {
// if (issue.getIssueContext().hasContextType(ContextType.SpeciesContext)){
// SpeciesContext thing = (SpeciesContext)issue.getIssueContext().getContextObject(ContextType.SpeciesContext);
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species), new Object[] {thing});
// }else if(issue.getIssueContext().hasContextType(ContextType.ReactionRule)) {
// ReactionRule thing = (ReactionRule)issue.getIssueContext().getContextObject(ContextType.ReactionRule);
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions), new Object[] {thing});
// }else if(issue.getIssueContext().hasContextType(ContextType.RbmObservable)) {
// RbmObservable thing = (RbmObservable)issue.getIssueContext().getContextObject(ContextType.RbmObservable);
// followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.OBSERVABLES_NODE, ActiveViewID.observables), new Object[] {thing});
// } else {
System.err.println("SpeciesPattern object missing a proper issue context.");
// }
} else if (object instanceof SimulationContext) {
SimulationContext sc = (SimulationContext) object;
IssueCategory ic = issue.getCategory();
switch(ic) {
case RbmNetworkConstraintsBad:
NetworkConstraints nc = sc.getNetworkConstraints();
if (issue.getMessage() == SimulationContext.IssueInsufficientMolecules) {
NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxMoleculesName, nc.getMaxMoleculesPerSpecies() + "", NetworkTransformer.defaultMaxMoleculesPerSpecies + "");
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
} else {
NetworkConstraintsEntity nce = new NetworkConstraintsEntity(NetworkConstraintsTableModel.sMaxIterationName, nc.getMaxIteration() + "", NetworkTransformer.defaultMaxIteration + "");
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { nce });
}
break;
default:
followHyperlink(new ActiveView(sc, DocumentEditorTreeFolderClass.SPECIFICATIONS_NODE, ActiveViewID.network_setting), new Object[] { object });
break;
}
} else if (object instanceof Geometry) {
if (issueContext.hasContextType(ContextType.SimContext)) {
SimulationContext simContext = (SimulationContext) issueContext.getContextObject(ContextType.SimContext);
followHyperlink(new ActiveView(simContext, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition), new Object[] { object });
} else if (issueContext.hasContextType(ContextType.MathModel)) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.MATH_GEOMETRY_NODE, ActiveViewID.math_geometry), new Object[] { object });
} else if (issueContext.hasContextType(ContextType.MathDescription)) {
followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.GEOMETRY_NODE, ActiveViewID.geometry_definition), new Object[] { object });
}
} else {
System.err.println("unknown object type in IssuePanel.invokeHyperlink(): " + object.getClass() + ", context type: " + issueContext.getContextType());
}
}
}
Aggregations