Update of /cvsroot/monetdb/java/src/nl/cwi/monetdb/util
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv2697
Modified Files:
Extract.java NamespaceContextImpl.java
Log Message:
added some documentation
Index: NamespaceContextImpl.java
===================================================================
RCS file:
/cvsroot/monetdb/java/src/nl/cwi/monetdb/util/NamespaceContextImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- NamespaceContextImpl.java 5 Dec 2007 17:02:00 -0000 1.1
+++ NamespaceContextImpl.java 7 Dec 2007 22:01:56 -0000 1.2
@@ -22,6 +22,14 @@
import javax.xml.namespace.*;
/**
+ * This class implements <code>NamespaceContex</code>, which is needed
+ * to evaluate an <code>XPath</code> expression on an XML document.
+ * This class provides functions to store and retrieve (prefix, uri)
+ * mappings for Namespaces.
+ * See the documentation of the interface <a
+ *
href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/namespace/NamespaceContext.html">NamespaceContext</a>
+ * for more information.
+ *
* @author Ying Zhang <[EMAIL PROTECTED]>
* @version 0.1
*/
@@ -29,23 +37,55 @@
public class NamespaceContextImpl implements NamespaceContext{
private Map map;
+ /**
+ * Creates a <code>NamespaceContextImpl</code> object.
+ */
public NamespaceContextImpl(){
map = new HashMap();
}
+ /**
+ * Creates a <code>NamespaceContextImpl</code> object with an initial
binding of
+ * the given (<code>prefix</code>, <code>uri</code>).
+ *
+ * @param prefix Prefix of the Namespace
+ * @param uri URI of the Namespace
+ */
public NamespaceContextImpl(String prefix, String uri){
map = new HashMap();
map.put(prefix, uri);
}
+ /**
+ * Add a new binding of the given (<code>prefix</code>,
+ * <code>uri</code>).
+ *
+ * @param prefix Prefix of the Namespace
+ * @param uri URI of the Namespace
+ */
public void add(String prefix, String uri){
map.put(prefix, uri);
}
+ /**
+ * Get Namespace URI bound to the given <code>prefix</code> in the
+ * current scope.
+ *
+ * @param prefix prefix to look up
+ * @return Namespace URI bound to prefix in the current scope.
+ */
public String getNamespaceURI(String prefix){
return (String) map.get(prefix);
}
+ /**
+ * Get prefix bound to Namespace URI in the current scope.
+ * To get all prefixes bound to a Namespace URI in the current
+ * scope, use [EMAIL PROTECTED] #getPrefixes(String namespaceURI)}.
+ *
+ * @param namespaceURI URI of Namespace to lookup
+ * @return prefix bound to Namespace URI in current context
+ */
public String getPrefix(String namespaceURI){
String[] prefixes = (String[]) map.keySet().toArray(new String[0]);
@@ -56,6 +96,15 @@
return null;
}
+ /**
+ * Get all prefixes bound to a Namespace URI in the current scope.
+ * An <code>Iterator</code> over <code>String</code> elements is
+ * returned in an arbitrary, <b>implementation dependent</b>, order.
+ *
+ * @param namespaceURI URI of Namespace to lookup
+ * @return <code>Iterator</code> for all prefixed bound to the
+ * Namespace URI in the current scope
+ */
public Iterator getPrefixes(String namespaceURI){
List prefixes = new ArrayList();
String[] keys = (String[]) map.keySet().toArray(new String[0]);
Index: Extract.java
===================================================================
RCS file: /cvsroot/monetdb/java/src/nl/cwi/monetdb/util/Extract.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- Extract.java 5 Dec 2007 17:02:00 -0000 1.1
+++ Extract.java 7 Dec 2007 22:01:56 -0000 1.2
@@ -23,6 +23,9 @@
/**
+ * This file contains a function to extract files from its including Jar
+ * package.
+ *
* @author Ying Zhang <[EMAIL PROTECTED]>
* @version 0.1
*/
@@ -32,7 +35,17 @@
public Extract() {}
- /* Extracts 'fromFile' from the jar package to 'toFile' */
+ /**
+ * Extracts a file from the Jar package which includes this class to
+ * the given destination
+ * @param fromFile The file to extract, including it absolute path
+ * inside its including Jar package.
+ * @param toFile Destination for the extracted file
+ * @throws FileNotFoundException If the file to extract can not be
+ * found in its including Jar package.
+ * @throws IOException If any error happens during
+ * creating/reading/writing files.
+ */
public static void extractFile(String fromFile, String toFile)
throws FileNotFoundException, IOException
{
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins