@Override public boolean equals(Object o) { boolean equals = super.equals(o); if (equals) { ListOf<?> listOf = (ListOf<?>) o; equals &= getSBaseListType() == listOf.getSBaseListType(); equals &= getOtherListName() == listOf.getOtherListName(); } return equals; }
/** * Sets the listOfModifiers of this {@link Reaction}. Automatically sets the * parentSBML object of the list to this {@link Reaction} instance. * * @param listOfModifiers */ public void setListOfModifiers(ListOf<ModifierSpeciesReference> listOfModifiers) { unsetListOfModifiers(); this.listOfModifiers = listOfModifiers; if ((this.listOfModifiers != null) && (this.listOfModifiers.getSBaseListType() != ListOf.Type.listOfModifiers)) { this.listOfModifiers.setSBaseListType(ListOf.Type.listOfModifiers); } registerChild(this.listOfModifiers); }
/** * Sets the listOfSpeciesTypes of this Model to 'listOfSpeciesTypes'. * Automatically sets the parentSBML objects of 'listOfSpeciesTypes' to this * Model. * * @param listOfSpeciesTypes * the listOfSpeciesTypes to set * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @Deprecated public void setListOfSpeciesTypes(ListOf<SpeciesType> listOfSpeciesTypes) { unsetListOfSpeciesTypes(); this.listOfSpeciesTypes = listOfSpeciesTypes; if ((this.listOfSpeciesTypes != null) && (this.listOfSpeciesTypes.getSBaseListType() != ListOf.Type.listOfSpeciesTypes)) { this.listOfSpeciesTypes.setSBaseListType(ListOf.Type.listOfSpeciesTypes); } registerChild(this.listOfSpeciesTypes); }
/** * Sets the {@link #listOfProducts} of this {@link Reaction}. Automatically sets the * parentSBML object of the list to this {@link Reaction} instance. * * @param listOfProducts */ public void setListOfProducts(ListOf<SpeciesReference> listOfProducts) { unsetListOfProducts(); this.listOfProducts = listOfProducts; if ((this.listOfProducts != null) && (this.listOfProducts.getSBaseListType() != ListOf.Type.listOfProducts)) { this.listOfProducts.setSBaseListType(ListOf.Type.listOfProducts); } registerChild(this.listOfProducts); }
/** * Sets the listOfCompartmentTypes of this Model to 'listOfCompartmentTypes'. * Automatically sets the parentSBML objects of 'listOfCompartmentTypes' to * this {@link Model}. * * @param listOfCompartmentTypes * the listOfCompartmentTypes to set * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @Deprecated public void setListOfCompartmentTypes( ListOf<CompartmentType> listOfCompartmentTypes) { unsetListOfCompartmentTypes(); this.listOfCompartmentTypes = listOfCompartmentTypes; if ((this.listOfCompartmentTypes != null) && (this.listOfCompartmentTypes.getSBaseListType() != ListOf.Type.listOfCompartmentTypes)) { this.listOfCompartmentTypes.setSBaseListType( ListOf.Type.listOfCompartmentTypes); } registerChild(this.listOfCompartmentTypes); }
/** * Sets the {@link #listOfRules} of this {@link Model} to 'listOfRules'. * Automatically sets the parentSBML objects of 'listOfRules' to this Model. * * @param listOfRules */ public void setListOfRules(ListOf<Rule> listOfRules) { unsetListOfRules(); this.listOfRules = listOfRules; if ((this.listOfRules != null) && (this.listOfRules.getSBaseListType() != ListOf.Type.listOfRules)) { this.listOfRules.setSBaseListType(ListOf.Type.listOfRules); } registerChild(this.listOfRules); }
/** * Sets the listOfEvents of this {@link Model} to 'listOfEvents'. * Automatically sets the parentSBML objects of 'listOfEvents' to this * {@link Model}. * * @param listOfEvents */ public void setListOfEvents(ListOf<Event> listOfEvents) { unsetListOfEvents(); this.listOfEvents = listOfEvents; if ((this.listOfEvents != null) && (this.listOfEvents.getSBaseListType() != ListOf.Type.listOfEvents)) { this.listOfEvents.setSBaseListType(ListOf.Type.listOfEvents); } registerChild(this.listOfEvents); }
/** * Sets the {@link #listOfParameters} of this {@link Model} to * 'listOfParameters'. Automatically sets the parentSBML objects of * 'listOfParameters' to this Model. * * @param listOfParameters */ public void setListOfParameters(ListOf<Parameter> listOfParameters) { unsetListOfParameters(); this.listOfParameters = listOfParameters; if ((this.listOfParameters != null) && (this.listOfParameters.getSBaseListType() != ListOf.Type.listOfParameters)) { this.listOfParameters.setSBaseListType(ListOf.Type.listOfParameters); } registerChild(listOfParameters); }
/** * Sets the listOfReactants of this {@link Reaction}. Automatically sets the * parentSBML object of the list to this {@link Reaction} instance. * * @param listOfReactants */ public void setListOfReactants(ListOf<SpeciesReference> listOfReactants) { unsetListOfReactants(); this.listOfReactants = listOfReactants; if ((this.listOfReactants != null) && (this.listOfReactants.getSBaseListType() != ListOf.Type.listOfReactants)) { this.listOfReactants.setSBaseListType(ListOf.Type.listOfReactants); } registerChild(this.listOfReactants); }
/** * Sets the listOfCompartments of this {@link Model} to 'listOfCompartments'. * Automatically sets the parentSBML objects of 'listOfCompartments' to this * Model. * * @param listOfCompartments */ public void setListOfCompartments(ListOf<Compartment> listOfCompartments) { unsetListOfCompartments(); this.listOfCompartments = listOfCompartments; if ((this.listOfCompartments != null) && (this.listOfCompartments.getSBaseListType() != ListOf.Type.listOfCompartments)) { this.listOfCompartments.setSBaseListType(ListOf.Type.listOfCompartments); } registerChild(this.listOfCompartments); }
/** * Sets the listOfSpecies of this {@link Model} to 'listOfSpecies'. * Automatically sets the parentSBML objects of 'listOfSpecies' to this Model. * * @param listOfSpecies */ public void setListOfSpecies(ListOf<Species> listOfSpecies) { unsetListOfSpecies(); this.listOfSpecies = listOfSpecies; if ((this.listOfSpecies != null) && (this.listOfSpecies.getSBaseListType() != ListOf.Type.listOfSpecies)) { this.listOfSpecies.setSBaseListType(ListOf.Type.listOfSpecies); } registerChild(this.listOfSpecies); }
/** * Sets the {@link #listOfReactions} of this {@link Model} to * 'listOfReactions'. Automatically sets the parentSBML objects of * 'listOfReactions' to this Model. * * @param listOfReactions */ public void setListOfReactions(ListOf<Reaction> listOfReactions) { unsetListOfReactions(); this.listOfReactions = listOfReactions; if ((this.listOfReactions != null) && (this.listOfReactions.getSBaseListType() != ListOf.Type.listOfReactions)) { this.listOfReactions.setSBaseListType(ListOf.Type.listOfReactions); } registerChild(this.listOfReactions); }
/** * Sets the listOfUnitDefinitions of this {@link Model} to * 'listOfUnitDefinitions'. Automatically sets the parentSBML objects of * 'listOfUnitDefinitions' to this Model. * * @param listOfUnitDefinitions */ public void setListOfUnitDefinitions( ListOf<UnitDefinition> listOfUnitDefinitions) { unsetListOfUnitDefinitions(); this.listOfUnitDefinitions = listOfUnitDefinitions; if ((this.listOfUnitDefinitions != null) && (this.listOfUnitDefinitions.getSBaseListType() != ListOf.Type.listOfUnitDefinitions)) { this.listOfUnitDefinitions.setSBaseListType( ListOf.Type.listOfUnitDefinitions); } registerChild(this.listOfUnitDefinitions); }
/** * Sets the {@link #listOfUnits} of this {@link UnitDefinition}. * * <p>Automatically sets the parent SBML object of the list to this * {@link UnitDefinition} instance. * * @param listOfUnits the new list of {@link Unit}s. */ public void setListOfUnits(ListOf<Unit> listOfUnits) { unsetListOfUnits(); this.listOfUnits = listOfUnits; if ((this.listOfUnits != null) && (this.listOfUnits.getSBaseListType() != ListOf.Type.listOfUnits)) { this.listOfUnits.setSBaseListType(ListOf.Type.listOfUnits); } registerChild(this.listOfUnits); }
/** * Sets the listOfConstraints of this {@link Model} to 'listOfConstraints'. * Automatically sets the parentSBML objects of 'listOfCanstraints' to this * Model. * * @param listOfConstraints * the listOfConstraints to set */ public void setListOfConstraints(ListOf<Constraint> listOfConstraints) { unsetListOfConstraints(); this.listOfConstraints = listOfConstraints; if ((this.listOfConstraints != null) && (this.listOfConstraints.getSBaseListType() != ListOf.Type.listOfConstraints)) { this.listOfConstraints.setSBaseListType(ListOf.Type.listOfConstraints); } registerChild(this.listOfConstraints); }
/** * Sets the listOfFunctionDefinitions of this {@link Model} to * 'listOfFunctionDefinitions'. Automatically sets the parentSBML objects of * 'listOfFunctionDefinitions' to this Model. * * @param listOfFunctionDefinitions * the listOfFunctionDefinitions to set */ public void setListOfFunctionDefinitions( ListOf<FunctionDefinition> listOfFunctionDefinitions) { unsetListOfFunctionDefinitions(); this.listOfFunctionDefinitions = listOfFunctionDefinitions; if ((this.listOfFunctionDefinitions != null) && (this.listOfFunctionDefinitions.getSBaseListType() != ListOf.Type.listOfFunctionDefinitions)) { this.listOfFunctionDefinitions.setSBaseListType( ListOf.Type.listOfFunctionDefinitions); } registerChild(this.listOfFunctionDefinitions); }
/** * Sets the {@link #listOfInitialAssignments} of this {@link Model} to * 'listOfInitialAssignments'. Automatically sets the parentSBML objects of * 'listOfInitialAssignments' to this Model. * * @param listOfInitialAssignments * the listOfInitialAssignments to set */ public void setListOfInitialAssignments( ListOf<InitialAssignment> listOfInitialAssignments) { unsetListOfInitialAssignments(); this.listOfInitialAssignments = listOfInitialAssignments; if ((this.listOfInitialAssignments != null) && (this.listOfInitialAssignments.getSBaseListType() != ListOf.Type.listOfInitialAssignments)) { this.listOfInitialAssignments.setSBaseListType( ListOf.Type.listOfInitialAssignments); } registerChild(this.listOfInitialAssignments); }
/** * Returns a new {@link List} that contains only those elements that * satisfy a certain filter criterion. * * @param f * A filter that defines the criterion for elements to be put * into the list to be returned. * @return A new list that can be empty if no element fulfills the filter * criterion. */ public List<T> filterList(Filter f) { /* * The new list should not be linked to the model or SBMLDocument * as otherwise, it will try to register elements that are * already registered and send an exception instead doing any * filtering */ ListOf<T> list = new ListOf<T>(getLevel(), getVersion()); list.setSBaseListType(getSBaseListType()); for (T sbase : this) { if (f.accepts(sbase)) { list.listOf.add(sbase); } } list.parent = parent; return list; }
/** * Creates a ListOf instance from a given ListOf. * * @param listOf the list to clone */ @SuppressWarnings("unchecked") public ListOf(ListOf<? extends SBase> listOf) { super(listOf); setSBaseListType(listOf.getSBaseListType()); setOtherListName(listOf.getOtherListName()); for (SBase base : listOf) { if (base != null) { add((T) base.clone()); } } }
@Override public boolean check(ValidationContext ctx, SBase sb) { if (sb.isSetSBOTerm()) { try { if (sb instanceof ModifierSpeciesReference) { return SBO.isModifier(sb.getSBOTerm()); } else if (((ListOf<?>) sb.getParent()).getSBaseListType().equals(ListOf.Type.listOfReactants)) { return SBO.isReactant(sb.getSBOTerm()); } else if (((ListOf<?>) sb.getParent()).getSBaseListType().equals(ListOf.Type.listOfProducts)) { return SBO.isProduct(sb.getSBOTerm()); } else { return SBO.isParticipantRole(sb.getSBOTerm()); } } catch (Exception e) { return false; } } return true; }; };