本文整理汇总了Java中org.sbml.jsbml.Compartment类的典型用法代码示例。如果您正苦于以下问题:Java Compartment类的具体用法?Java Compartment怎么用?Java Compartment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Compartment类属于org.sbml.jsbml包,在下文中一共展示了Compartment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: checkCompartmentOverlap
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public boolean checkCompartmentOverlap(String id,double x, double y, double w, double h) {
for (int i = 0; i < sbml.getModel().getCompartmentCount(); i++) {
Compartment c = sbml.getModel().getCompartment(i);
if (c.getId().equals(id)) continue;
Layout layout = getLayout();
CompartmentGlyph compartmentGlyph = layout.getCompartmentGlyph(GlobalConstants.GLYPH+"__"+c.getId());
double cx = compartmentGlyph.getBoundingBox().getPosition().getX();
double cy = compartmentGlyph.getBoundingBox().getPosition().getY();
double cw = compartmentGlyph.getBoundingBox().getDimensions().getWidth();
double ch = compartmentGlyph.getBoundingBox().getDimensions().getHeight();
if (x >= cx && y >= cy && x+w <= cx+cw && y+h <= cy+ch) continue;
if (x <= cx && y <= cy && x+w >= cx+cw && y+h >= cy+ch) continue;
if (x+w <= cx) continue;
if (x >= cx+cw) continue;
if (y+h <= cy) continue;
if (y >= cy+ch) continue;
return false;
}
return true;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:21,代码来源:BioModel.java
示例2: checkUnitsInAssignmentRule
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public static boolean checkUnitsInAssignmentRule(SBMLDocument document, Rule rule)
{
UnitDefinition unitDef = rule.getDerivedUnitDefinition();
UnitDefinition unitDefVar;
Species species = document.getModel().getSpecies(getVariable(rule));
Compartment compartment = document.getModel().getCompartment(getVariable(rule));
Parameter parameter = document.getModel().getParameter(getVariable(rule));
if (species != null)
{
unitDefVar = species.getDerivedUnitDefinition();
}
else if (compartment != null)
{
unitDefVar = compartment.getDerivedUnitDefinition();
}
else
{
unitDefVar = parameter.getDerivedUnitDefinition();
}
if (!UnitDefinition.areEquivalent(unitDef, unitDefVar))
{
return true;
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例3: checkUnitsInInitialAssignment
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public static boolean checkUnitsInInitialAssignment(SBMLDocument document, InitialAssignment init)
{
UnitDefinition unitDef = init.getDerivedUnitDefinition();
UnitDefinition unitDefVar;
Species species = document.getModel().getSpecies(init.getVariable());
Compartment compartment = document.getModel().getCompartment(init.getVariable());
Parameter parameter = document.getModel().getParameter(init.getVariable());
if (species != null)
{
unitDefVar = species.getDerivedUnitDefinition();
}
else if (compartment != null)
{
unitDefVar = compartment.getDerivedUnitDefinition();
}
else
{
unitDefVar = parameter.getDerivedUnitDefinition();
}
if (!UnitDefinition.areEquivalent(unitDef, unitDefVar))
{
return true;
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例4: checkUnitsInEventAssignment
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public static boolean checkUnitsInEventAssignment(SBMLDocument document, EventAssignment assign)
{
UnitDefinition unitDef = assign.getDerivedUnitDefinition();
UnitDefinition unitDefVar;
Species species = document.getModel().getSpecies(assign.getVariable());
Compartment compartment = document.getModel().getCompartment(assign.getVariable());
Parameter parameter = document.getModel().getParameter(assign.getVariable());
if (species != null)
{
unitDefVar = species.getDerivedUnitDefinition();
}
else if (compartment != null)
{
unitDefVar = compartment.getDerivedUnitDefinition();
}
else
{
unitDefVar = parameter.getDerivedUnitDefinition();
}
if (unitDef != null && unitDefVar != null && !UnitDefinition.areEquivalent(unitDef, unitDefVar))
{
return true;
}
return false;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:26,代码来源:SBMLutilities.java
示例5: createCompartment
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
private void createCompartment(String strCompartName, String _Id,
String _Constant, String _SpatialDimension, String _MetaId,
String _SBOTermId, String _Size) {
if (!foundCompartment(strCompartName)) {
Compartment _compartment = model.createCompartment(_Id);
_compartment.setName(strCompartName);
_compartment.setConstant(Boolean.valueOf(_Constant));
_compartment
.setSpatialDimensions(Double.valueOf(_SpatialDimension));
_compartment.setMetaId(_MetaId);
_compartment.setSBOTerm(_SBOTermId);
_compartment.setSize(Double.valueOf(_Size));
_ListOfCompartments.add(strCompartName);
}
}
开发者ID:ibalaur,项目名称:MetabolicFramework,代码行数:18,代码来源:JSON2SBMLParser.java
示例6: mappingCompartmentInfo
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
private void mappingCompartmentInfo(String SpeciesId, String szShortCompName) {
for (Iterator<Compartment> iterator = _listCompartment.iterator(); iterator
.hasNext();) {
Compartment _comp = (Compartment) iterator.next();
if (_comp.getId().equals(szShortCompName)) {
speciesHashMap.get(SpeciesId).setProperty("CompartId",
_comp.getId());
speciesHashMap.get(SpeciesId).setProperty("CompartName",
_comp.getName());
speciesHashMap.get(SpeciesId).setProperty("CompartConstant",
_comp.getConstant());
speciesHashMap.get(SpeciesId).setProperty(
"CompartSpatialDimensions",
_comp.getSpatialDimensions());
speciesHashMap.get(SpeciesId).setProperty("CompartMetaId",
_comp.getMetaId());
speciesHashMap.get(SpeciesId).setProperty("CompartSBOTermID",
_comp.getSBOTermID());
speciesHashMap.get(SpeciesId).setProperty("CompartSize",
_comp.getSize());
}
}
}
开发者ID:ibalaur,项目名称:MetabolicFramework,代码行数:27,代码来源:SBMLReading.java
示例7: addDomainTypes
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
/**
* Adds the domain types.
*/
public void addDomainTypes() {
for (Entry<String, Integer> e : hashDomainTypes.entrySet()) {
// DomainTypes
DomainType dt = geometry.createDomainType();
dt.setSpatialId(e.getKey());
dt.setSpatialDimensions(e.getValue());
// Compartment may need changes for name and id
if(model.getListOfCompartments().get(e.getKey()) != null)
continue;
Compartment c = model.createCompartment();
c.setSpatialDimensions(e.getValue());
//c.setSpatialDimensions(3);
c.setConstant(true);
c.setId(e.getKey());
c.setName(e.getKey());
spatialcompplugin = (SpatialCompartmentPlugin) c.getPlugin("spatial");
CompartmentMapping cm = new CompartmentMapping();
cm.setSpatialId(e.getKey() + c.getId());
cm.setDomainType(e.getKey());
// TODO
//cm.setUnitSize(delta.x * delta.y * delta.z);
cm.setUnitSize(1);
spatialcompplugin.setCompartmentMapping(cm);
}
}
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:32,代码来源:SpatialSBMLExporter.java
示例8: getMappedCompartment
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
/**
* Gets the mapped compartment.
*
* @param id the id
* @return the mapped compartment
*/
private Compartment getMappedCompartment(String id){
ListOf<Compartment> cList = model.getListOfCompartments();
for(Compartment c : cList){
CompartmentMapping cm = ((SpatialCompartmentPlugin)c.getPlugin(SpatialConstants.shortLabel)).getCompartmentMapping();
if(cm.getDomainType().equals(id))
return c;
}
return null;
}
开发者ID:spatialsimulator,项目名称:XitoSBML,代码行数:18,代码来源:SpatialSBMLExporter.java
示例9: convertCompartmentsToCD
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
/**
* Convert compartments to CD.
*
* @param cgList
* the cg list
*/
public void convertCompartmentsToCD(List<CompartmentGlyph> cgList) {
for (CompartmentGlyph cg : cgList) {
Compartment c = (Compartment) cg.getCompartmentInstance();
if (!c.getId().equals("default")
|| (c.getId().equals("default") && convertDefaultCompartment)) {
mWrapper.createCompartmentAliasWrapper(cg);
}
}
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:16,代码来源:Layout2CDConverter.java
示例10: convertTextToCD
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
/**
* Convert text to CD.
*
* @param tgList
* the tg list
*/
public void convertTextToCD(List<TextGlyph> tgList) {
for (TextGlyph tg : tgList) {
SBase reference = tg.getReferenceInstance();
if (reference instanceof CompartmentGlyph) {
Compartment c = (Compartment) ((CompartmentGlyph) reference).getCompartmentInstance();
CompartmentAliasWrapper caw = mWrapper.getCompartmentAliasWrapperByCompartmentId(c.getId());
Point namePoint = tg.getBoundingBox().getPosition();
caw.setNameX(namePoint.getX());
caw.setNameY(namePoint.getY());
}
}
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:19,代码来源:Layout2CDConverter.java
示例11: completeCompartments
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
/**
* Complete compartments.
*
* @param compartments
* the compartments
* @return ListOf<Compartment>
* TODO
*/
public static ListOf<Compartment> completeCompartments(
ListOf<Compartment> compartments) {
int i = 0;
for (Compartment c : compartments) {
if (!c.isSetId()) {
c.setId(c.getClass().getSimpleName() + i++);
}
if (!c.isSetConstant()) {
c.setConstant(true);
}
}
return compartments;
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:22,代码来源:SBMLModelCompleter.java
示例12: CompartmentAliasWrapper
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
/**
* Instantiates a new compartment alias wrapper.
*
* @param cg
* the cg
* @param modelWrapper
* the model wrapper
*/
public CompartmentAliasWrapper(CompartmentGlyph cg, ModelWrapper modelWrapper) {
this.compartmentAlias = new CompartmentAlias();
modelWrapper.addCompartmentAlias(compartmentAlias);
compartmentAliased = (Compartment) cg.getCompartmentInstance();
this.id = compartmentAliased.getId() + "alias";
compartmentAlias.setId(id);
this.compartment = compartmentAliased.getId();
compartmentAlias.setCompartment(compartmentAliased.getId());
bounds = new Bounds();
setH(cg.getBoundingBox().getDimensions().getHeight());
setW(cg.getBoundingBox().getDimensions().getWidth());
setX(cg.getBoundingBox().getPosition().getX());
setY(cg.getBoundingBox().getPosition().getY());
compartmentAlias.setBounds(bounds);
this.clazz = "SQUARE";
compartmentAlias.setClazz(clazz);
doubleLine = new DoubleLine();
doubleLine.setInnerWidth(new BigDecimal(DEFAULT_COMPARTMENT_INNER_WIDTH));
doubleLine.setOuterWidth(new BigDecimal(DEFAULT_COMPARTMENT_OUTER_WIDTH));
doubleLine.setThickness(new BigDecimal(DEFAULT_COMPARTMENT_WIDTH));
compartmentAlias.setDoubleLine(doubleLine);
info = new Info();
info.setAngle(new BigDecimal(0d));
info.setState("empty");
compartmentAlias.setInfo(info);
namePoint = new Point();
compartmentAlias.setNamePoint(namePoint);
paint = new Paint();
paint.setColor("ffcccc00");
paint.setScheme("Color");
compartmentAlias.setPaint(paint);
point = new Point();
compartmentAlias.setPoint(new Point());
}
开发者ID:funasoul,项目名称:celldesigner-parser,代码行数:43,代码来源:CompartmentAliasWrapper.java
示例13: createSBMLDocument
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public void createSBMLDocument(String modelId,boolean grid,boolean lema) {
sbml = new SBMLDocument(GlobalConstants.SBML_LEVEL, GlobalConstants.SBML_VERSION);
modelId = modelId.replaceAll("[\\W]|_", "_");
if (Character.isDigit(modelId.charAt(0))) modelId = "m" + modelId;
Model m = sbml.createModel(modelId);
metaIDIndex = SBMLutilities.setDefaultMetaID(sbml, m, metaIDIndex);
sbmlFile = modelId + ".xml";
createCompPlugin();
createLayoutPlugin();
createFBCPlugin();
if (!lema) {
Compartment c = m.createCompartment();
if (grid) {
if (!modelId.equals("Grid")) {
c.setId("Grid");
} else {
c.setId("GridComp");
}
loadDefaultParameters();
} else {
if (!modelId.equals("Cell")) {
c.setId("Cell");
} else {
c.setId("CellComp");
}
Port port = sbmlCompModel.createPort();
port.setId(GlobalConstants.COMPARTMENT+"__"+c.getId());
port.setIdRef(c.getId());
}
c.setSize(1);
c.setSpatialDimensions(3);
c.setConstant(true);
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:35,代码来源:BioModel.java
示例14: IsWithinCompartment
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public boolean IsWithinCompartment() {
if (sbml.getModel().getCompartmentCount()==0) return false;
for (int i = 0; i < sbml.getModel().getCompartmentCount(); i++) {
Compartment compartment = sbml.getModel().getCompartment(i);
if (getPortByIdRef(compartment.getId())!=null) return false;
//if (sbmlCompModel.getListOfPorts().get(GlobalConstants.COMPARTMENT + "__" + compartment.getId()) != null) return false;
}
return true;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:10,代码来源:BioModel.java
示例15: setGridSize
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public void setGridSize(int rows, int cols) {
//get the grid compartment
Compartment gridComp = sbml.getModel().getCompartment(0);
if (gridComp != null) {
if (rows > 0 && cols > 0) {
AnnotationUtility.setGridAnnotation(gridComp, rows, cols);
}
else {
AnnotationUtility.removeGridAnnotation(gridComp);
}
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:14,代码来源:BioModel.java
示例16: getCompartments
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public ArrayList<String> getCompartments() {
ArrayList<String> compartmentSet = new ArrayList<String>();
if (sbml!=null) {
for (int i = 0; i < sbml.getModel().getCompartmentCount(); i++) {
Compartment compartment = sbml.getModel().getCompartment(i);
compartmentSet.add(compartment.getId());
}
}
return compartmentSet;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:11,代码来源:BioModel.java
示例17: getCompartmentPorts
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public ArrayList<String> getCompartmentPorts() {
ArrayList<String> compartments = new ArrayList<String>();
for (int i = 0; i < sbml.getModel().getCompartmentCount(); i++) {
Compartment compartment = sbml.getModel().getCompartment(i);
if (sbmlCompModel.getListOfPorts().get(GlobalConstants.COMPARTMENT+"__"+compartment.getId())!=null) {
compartments.add(compartment.getId());
}
}
return compartments;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:11,代码来源:BioModel.java
示例18: getCompartmentByLocation
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public String getCompartmentByLocation(float x, float y, float w, float h) {
String compartment = "";
/*
if (sbml.getModel().getCompartmentCount() > 0) {
compartment = sbml.getModel().getCompartment(0).getId();
}
*/
double distance = -1;
for (int i = 0; i < sbml.getModel().getCompartmentCount(); i++) {
Compartment c = sbml.getModel().getCompartment(i);
Layout layout = getLayout();
CompartmentGlyph compartmentGlyph = layout.getCompartmentGlyph(GlobalConstants.GLYPH+"__"+c.getId());
if (compartmentGlyph != null) {
double cx = compartmentGlyph.getBoundingBox().getPosition().getX();
double cy = compartmentGlyph.getBoundingBox().getPosition().getY();
double cw = compartmentGlyph.getBoundingBox().getDimensions().getWidth();
double ch = compartmentGlyph.getBoundingBox().getDimensions().getHeight();
if (x >= cx && y >= cy && x + w <= cx+cw && y + h <= cy+ch) {
double calcDist = (x - cx) + (y - cy);
if (distance==-1 || distance > calcDist) {
compartment = compartmentGlyph.getCompartment();
}
}
}
}
return compartment;
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:28,代码来源:BioModel.java
示例19: loadDefaultEnclosingCompartment
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public void loadDefaultEnclosingCompartment() {
if (sbml != null) {
if (sbml.getModel().getCompartmentCount()==0) {
/*
Compartment c = sbml.getModel().createCompartment();
c.setId("Cell");
c.setSize(1);
c.setSpatialDimensions(3);
c.setConstant(true);
*/
return;
}
for (int i = 0; i < sbml.getModel().getCompartmentCount(); i++) {
Compartment compartment = sbml.getModel().getCompartment(i);
if (AnnotationUtility.checkObsoleteAnnotation(compartment,"EnclosingCompartment")) {
AnnotationUtility.removeObsoleteAnnotation(compartment);
return;
}
}
Port port = sbmlCompModel.getListOfPorts().get(GlobalConstants.ENCLOSING_COMPARTMENT);
if (port!=null) {
sbmlCompModel.removePort(port);
return;
}
port = sbmlCompModel.getListOfPorts().get(GlobalConstants.DEFAULT_COMPARTMENT);
if (port!=null) {
port.setId(GlobalConstants.COMPARTMENT + "__" + port.getIdRef());
return;
}
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:32,代码来源:BioModel.java
示例20: testAddDuplicate
import org.sbml.jsbml.Compartment; //导入依赖的package包/类
public void testAddDuplicate() {
try {
System.loadLibrary("sbmlj");
String filename = "foo.sbml";
SBMLDocument document = new SBMLDocument(BioSim.SBML_LEVEL, BioSim.SBML_VERSION);
String compartment = "default";
Model m = document.createModel();
document.setModel(m);
document.getModel().addCompartment(new Compartment(compartment));
document.getModel().getCompartment("default").setSize(1);
m.addSpecies(Utility.makeSpecies("A", compartment, 0));
m.addSpecies(Utility.makeSpecies("A", compartment, 2));
PrintStream p = new PrintStream(new FileOutputStream(filename));
m.setName("foo");
m.setId("foo");
SBMLWriter writer = new SBMLWriter();
p.print(writer.writeToString(document));
p.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
开发者ID:MyersResearchGroup,项目名称:iBioSim,代码行数:29,代码来源:SBMLTest.java
注:本文中的org.sbml.jsbml.Compartment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论