/** * Creates a new {@link Compartment} inside this {@link Model} and returns it. * * @param id * the id of the new element to create * @return the {@link Compartment} object created */ public Compartment createCompartment(String id) { Compartment compartment = new Compartment(id, getLevel(), getVersion()); addCompartment(compartment); return compartment; }
Compartment compartment = (Compartment) newContextObject; compartment.initDefaults(); model.addCompartment(compartment);
Compartment relatedCompartment = model.getCompartment(compartmentsIds[i]); subModel.addCompartment(relatedCompartment.clone()); processUnitsMap(unitsMap, model, relatedCompartment.getUnits());
private void addSBaseToModel(Model model, SBase sBase) { if (model != null && sBase != null) { sBase.removeFromParent(); if (sBase.getClass() == Reaction.class) { model.addReaction((Reaction) sBase); } else if (sBase.getClass() == Compartment.class) { model.addCompartment((Compartment) sBase); } else if (sBase.getClass() == Constraint.class) { model.addConstraint((Constraint) sBase); } else if (sBase.getClass() == Event.class) { model.addEvent((Event) sBase); } else if (sBase.getClass() == FunctionDefinition.class) { model.addFunctionDefinition((FunctionDefinition) sBase); } else if (sBase.getClass() == Parameter.class) { model.addParameter((Parameter) sBase); } else if (sBase.getClass() == Rule.class) { model.addRule((Rule) sBase); } else if (sBase.getClass() == Species.class) { model.addSpecies((Species) sBase); } else if (sBase.getClass() == UnitDefinition.class) { model.addUnitDefinition((UnitDefinition) sBase); } } }
targetModel.addCompartment(compartment.clone());