summaryrefslogtreecommitdiff
path: root/sources
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2004-05-04 16:39:11 +0000
committermichelou <michelou@epfl.ch>2004-05-04 16:39:11 +0000
commitef7348057f897208428a9535b0ee3e5d088ebe2b (patch)
tree639230c5cb0d8b47fb97756ff19e18264abd42a6 /sources
parenteeab29703e4aeb7e5f339746ff676a9f97805753 (diff)
downloadscala-ef7348057f897208428a9535b0ee3e5d088ebe2b.tar.gz
scala-ef7348057f897208428a9535b0ee3e5d088ebe2b.tar.bz2
scala-ef7348057f897208428a9535b0ee3e5d088ebe2b.zip
- updated Scala comment for class 'Location'.
- added Scala comment for object 'Location'.
Diffstat (limited to 'sources')
-rw-r--r--sources/scala/mobile/Location.scala43
1 files changed, 32 insertions, 11 deletions
diff --git a/sources/scala/mobile/Location.scala b/sources/scala/mobile/Location.scala
index 7c8d787caf..5a125a3dfb 100644
--- a/sources/scala/mobile/Location.scala
+++ b/sources/scala/mobile/Location.scala
@@ -15,12 +15,17 @@ import scala.collection.mutable._;
/** The class <code>Location</code> provides a <code>create</code>
- * method to instanciate objects from a network location by
- * specifying its URL address.
+ * method to instantiate objects from a network location by
+ * specifying the URL address of the jar/class file.<p/>
+ *
+ * An update of the jar/class file should not break your code as far
+ * as the used class names and method signatures are the same.<p/>
*
* Example:<pre>
- * val url = new URL("http://scala.epfl.ch/classes/examples.jar");
- * val obj = new Location(url) create "examples.sort";</pre>
+ * <b>val</b> url = <b>new</b> URL("http://scala.epfl.ch/classes/examples.jar");
+ * <b>val</b> obj = <b>new</b> Location(url) create "examples.sort";</pre>
+ *
+ * @see class <a href="Code-class.html">Code</a>
*
* @author Stephane Micheloud
* @version 1.0, 04/05/2004
@@ -49,10 +54,16 @@ class Location(url: URL) {
*/
private var ccache: Map[String, java.lang.Class] = new HashMap;
- def create(className: String): Code = {
- val clazz = ccache.get(className) match {
- case Some(x) =>
- x
+ /** Return the code description for the string <code>className</code>
+ * at this location.
+ *
+ * @param the name of the class
+ * @return the code description corresponding to <code>className</code>
+ */
+ def create(className: String) = new Code(
+ ccache.get(className) match {
+ case Some(clazz) =>
+ clazz
case _ =>
val clazz = if (loader.loadClass(className).isInterface()) {
// Scala source: class A { ... };
@@ -66,10 +77,20 @@ class Location(url: URL) {
}
ccache(className) = clazz;
clazz
- };
- new Code(clazz)
- }
+ }
+ );
}
+/** The object <code>Location</code> can be used to instantiate
+ * objects on the same Java VM. It is just provided to illustrate
+ * the special case where resources are available locally.<p/>
+ *
+ * Example:<pre>
+ * <b>val</b> obj = Location.create("xcode.Math");
+ * <b>val</b> x = obj[Int, Int]("square")(5));</pre>
+ *
+ * @author Stephane Micheloud
+ * @version 1.0, 04/05/2004
+ */
object Location extends Location(null);