/** * Returns the number of {@link CVTerm}s in this * {@link CVTerm}. * * @return the number of {@link CVTerm}s in this * {@link CVTerm}. * @libsbml.deprecated same as {@link #getNestedCVTermCount()} */ public int getNumNestedCVTerms() { return getNestedCVTermCount(); }
@Override public int getChildCount() { // TODO - include NestedCVTerms in the tree so that we get them when doing recursive filters on SBase. int childCount = getResources().size(); if (getNestedCVTermCount() > 0) { childCount++; } return childCount; }
/** * Returns a list of CVTerm having the given qualifier. * * @param qualifier the qualifier * @param terms the list of CVTerm to filter * @return a list of CVTerm having the given qualifier, an empty * list is returned if no CVTerm are found. */ private List<CVTerm> filterCVTerms(Qualifier qualifier, List<CVTerm> terms) { ArrayList<CVTerm> l = new ArrayList<CVTerm>(); CVTermFilter filter = new CVTermFilter(qualifier); for (CVTerm term : terms) { if (filter.accepts(term)) { l.add(term); } if (term.getNestedCVTermCount() > 0) { l.addAll(filterCVTerms(qualifier, term.getListOfNestedCVTerms())); } } return l; }
/** * * @param currentCVTerm * @param parentNode */ private void writeURIs(CVTerm currentCVTerm, XMLNode parentNode) { if (currentCVTerm.getNestedCVTermCount() > 0) { String precedingElementName = "li"; String precedingElementNamespaceURI = Annotation.URI_RDF_SYNTAX_NS; int i = currentCVTerm.getListOfNestedCVTerms().size() - 1; for (; i >= 0; i--) { CVTerm cvterm = currentCVTerm.getNestedCVTerm(i); writeCVTerm(cvterm, parentNode, precedingElementName, precedingElementNamespaceURI); } } }
/** * Returns a list of CVTerm having the given qualifier. * * @param qualifier the qualifier * @return a list of CVTerm having the given qualifier, an empty * list is returned if no CVTerm are found. */ public List<CVTerm> filterCVTerms(Qualifier qualifier) { ArrayList<CVTerm> l = new ArrayList<CVTerm>(); CVTermFilter filter = new CVTermFilter(qualifier); for (CVTerm term : getListOfCVTerms()) { if (filter.accepts(term)) { l.add(term); } if (term.getNestedCVTermCount() > 0) { l.addAll(filterCVTerms(qualifier, term.getListOfNestedCVTerms())); } } return l; }