/** * Adds list of resources to the {@link CVTerm}. * * @param resources a list of strings representing the resources; e.g., * 'http://identifiers.org/kegg.reaction/R00351' * @return {@code true} if all the resources have been added properly. */ public boolean addResources(String... resources) { boolean success = true; for (String resource : resources) { success &= addResource(resource); } return success; }
/** * Adds a resource to the {@link CVTerm}. * * <p>Same method a {@link #addResource(String)} * * @param uri * string representing the resource; e.g., * 'http://identifiers.org/kegg.reaction/R00351' * * @return {@code true} if 'uri' has been added to the list of resourceURI of this * CVTerm. */ public boolean addResourceURI(String uri) { return addResource(uri); }
/** * Adds a resource to the {@link CVTerm}. * * <p>Same method a {@link #addResourceURI(String)} * * @param urn * string representing the resource; e.g., * 'http://identifiers.org/kegg.reaction/R00351' * @return {@code true} as specified in {@link Collection#add(Object)} */ public boolean addResource(String urn) { try { return addResource(getResourceCount(), urn); } catch (Throwable t) { return false; } }
/** * Creates a new {@link CVTerm} with the given {@link Type} and * {@link Qualifier} pointing to all given resources. * * @param type * @param qualifier * @param resources * @throws IllegalArgumentException * if the combination of the given type and qualifier is not * possible or if the given resources are invalid. */ public CVTerm(Type type, Qualifier qualifier, String... resources) { this(); setQualifierType(type); if (isBiologicalQualifier()) { setBiologicalQualifierType(qualifier); } else if (isModelQualifier()) { setModelQualifierType(qualifier); } else { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("CVTerm.INVALID_TYPE_AND_QUALIFIER_COMBINATION_MSG"), type, qualifier)); } for (String resource : resources) { addResource(resource); } }
XMLAttributes attributes = child.getAttributes(); for (int i = 0; i < attributes.size(); i++) { addResource(attributes.getValue(i));