|
From: Michael K. <ko...@us...> - 2006-01-03 09:35:28
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22419 Modified Files: Ontology.java OntologyClass.java Log Message: Support for searching child classes Index: Ontology.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/Ontology.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Ontology.java 10 Aug 2005 13:31:33 -0000 1.5 +++ Ontology.java 3 Jan 2006 09:35:20 -0000 1.6 @@ -19,7 +19,7 @@ import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; -import org.apache.log4j.*; +import org.apache.log4j.Logger; import org.w3c.dom.*; import org.xml.sax.*; @@ -92,6 +92,26 @@ /** + * Return the OntologyClass objects of all children classes of + * the given class + * @param recursive if true, then also grand children etc will be + * returned + */ + public Set getChildren(OntologyClass parent, boolean recursive) + { + Set result = new HashSet(); + if (parent == null) return result; + Iterator i = classes.values().iterator(); + while (i.hasNext()) { + OntologyClass oc = (OntologyClass)i.next(); + if (oc.getParent() == parent) + result.add(oc); + } + return result; + } + + + /** * Read the ontology definition from the given file. * * @param file The file to load Index: OntologyClass.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/core/OntologyClass.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- OntologyClass.java 22 Aug 2005 13:52:06 -0000 1.7 +++ OntologyClass.java 3 Jan 2006 09:35:20 -0000 1.8 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003 Cobricks Group. All rights reserved. + * Copyright (c) 2003-2005 Cobricks Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted under the terms of the Cobricks Software |