changeset 20:fe54e09128fb

~ integrating saxon
author Alexandre Bertails <bertails@w3.org>
date Fri, 05 Aug 2011 19:46:26 -0400
parents ce91c945e3d0
children 01104d643edf
files project/Build.scala project/build.properties src/main/scala/Date.scala src/main/scala/Main.scala src/main/scala/Model.scala src/main/scala/ResponseCache.scala src/main/scala/Tidy.scala src/main/scala/XML.scala src/main/scala/scala-time/org/scala_tools/time/DurationBuilder.scala src/main/scala/scala-time/org/scala_tools/time/Implicits.scala src/main/scala/scala-time/org/scala_tools/time/Imports.scala src/main/scala/scala-time/org/scala_tools/time/RichAbstractDateTime.scala src/main/scala/scala-time/org/scala_tools/time/RichAbstractInstant.scala src/main/scala/scala-time/org/scala_tools/time/RichAbstractPartial.scala src/main/scala/scala-time/org/scala_tools/time/RichAbstractReadableInstantFieldProperty.scala src/main/scala/scala-time/org/scala_tools/time/RichChronology.scala src/main/scala/scala-time/org/scala_tools/time/RichDate.scala src/main/scala/scala-time/org/scala_tools/time/RichDateMidnight.scala src/main/scala/scala-time/org/scala_tools/time/RichDateTime.scala src/main/scala/scala-time/org/scala_tools/time/RichDateTimeFormatter.scala src/main/scala/scala-time/org/scala_tools/time/RichDateTimeProperty.scala src/main/scala/scala-time/org/scala_tools/time/RichDateTimeZone.scala src/main/scala/scala-time/org/scala_tools/time/RichDuration.scala src/main/scala/scala-time/org/scala_tools/time/RichInstant.scala src/main/scala/scala-time/org/scala_tools/time/RichInt.scala src/main/scala/scala-time/org/scala_tools/time/RichLocalDate.scala src/main/scala/scala-time/org/scala_tools/time/RichLocalDateProperty.scala src/main/scala/scala-time/org/scala_tools/time/RichLocalDateTime.scala src/main/scala/scala-time/org/scala_tools/time/RichLocalDateTimeProperty.scala src/main/scala/scala-time/org/scala_tools/time/RichLocalTime.scala src/main/scala/scala-time/org/scala_tools/time/RichLocalTimeProperty.scala src/main/scala/scala-time/org/scala_tools/time/RichLong.scala src/main/scala/scala-time/org/scala_tools/time/RichPartial.scala src/main/scala/scala-time/org/scala_tools/time/RichPartialProperty.scala src/main/scala/scala-time/org/scala_tools/time/RichPeriod.scala src/main/scala/scala-time/org/scala_tools/time/RichReadableDateTime.scala src/main/scala/scala-time/org/scala_tools/time/RichReadableDuration.scala src/main/scala/scala-time/org/scala_tools/time/RichReadableInstant.scala src/main/scala/scala-time/org/scala_tools/time/RichReadableInterval.scala src/main/scala/scala-time/org/scala_tools/time/RichReadablePartial.scala src/main/scala/scala-time/org/scala_tools/time/RichReadablePeriod.scala src/main/scala/scala-time/org/scala_tools/time/StaticDateTime.scala src/main/scala/scala-time/org/scala_tools/time/StaticDateTimeFormat.scala src/main/scala/scala-time/org/scala_tools/time/StaticDateTimeZone.scala src/main/scala/scala-time/org/scala_tools/time/StaticDuration.scala src/main/scala/scala-time/org/scala_tools/time/StaticInterval.scala src/main/scala/scala-time/org/scala_tools/time/StaticLocalDate.scala src/main/scala/scala-time/org/scala_tools/time/StaticLocalDateTime.scala src/main/scala/scala-time/org/scala_tools/time/StaticLocalTime.scala src/main/scala/scala-time/org/scala_tools/time/StaticPartial.scala src/main/scala/scala-time/org/scala_tools/time/StaticPeriod.scala src/test/scala/DocumentTest.scala src/test/scala/HistoryTest.scala src/test/scala/ModelTest.scala src/test/scala/Test.scala src/test/scala/XMLTest.scala
diffstat 56 files changed, 1820 insertions(+), 617 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/Build.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,65 @@
+import sbt._
+import Keys._
+import java.net.URL
+
+object Dependencies {
+  val scalatest = "org.scalatest" % "scalatest_2.9.0" % "1.6.1" % "test"
+  val antiXML = "com.codecommit" %% "anti-xml" % "0.3-SNAPSHOT"
+  val jodatime = "joda-time" % "joda-time" % "1.6.2"
+  val dispatch = "net.databinder" %% "dispatch-http" % "0.8.4"
+  val saxon = "saxon" % "saxon" % "saxonhe9-3-0-5j" from {
+    val local = new File("/tmp/saxon9he.jar")
+    if (! local.exists) {
+      val url = new URL("http://downloads.sourceforge.net/project/saxon/Saxon-HE/9.3/saxonhe9-3-0-5j.zip")
+      val zip = new java.io.File("/tmp/tmp.zip")
+      url.#>(zip).!
+      Process("unzip -o /tmp/tmp.zip -d /tmp").!  
+    }
+    "file://" + local.getAbsolutePath
+  }
+//  val time = "org.scala-tools.time" %% "time" % "0.5-SNAPSHOT"
+}
+
+object BuildSettings {
+
+  val buildOrganization = "org.w3"
+  val buildVersion      = "0.1-SNAPSHOT"
+  val buildScalaVersion = "2.9.0-1"
+
+  val buildSettings = Defaults.defaultSettings ++ Seq (
+    organization := buildOrganization,
+    version      := buildVersion,
+    scalaVersion := buildScalaVersion,
+    parallelExecution in Test := true,
+    scalacOptions ++= Seq("-deprecation", "-unchecked") // ExplainTypes
+  )
+
+}
+
+object PubrulesToolsBuild extends Build {
+
+  import Dependencies._
+  import BuildSettings._
+
+  val pubrules_settings =
+    Seq(
+      resolvers += ScalaToolsReleases,
+      resolvers += ScalaToolsSnapshots,
+//      resolvers += "Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/snapshots/",
+      libraryDependencies += scalatest,
+      libraryDependencies += antiXML,
+      libraryDependencies += jodatime,
+      libraryDependencies += dispatch,
+      libraryDependencies += saxon
+    )
+
+  lazy val pubrules = Project(
+    id = "pubrules",
+    base = file("."),
+    settings = buildSettings ++ pubrules_settings
+  )
+  
+
+
+}
+
--- a/project/build.properties	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-#Project properties
-#Wed Feb 24 14:11:00 EST 2010
-project.organization=W3C
-project.name=pubruleschecker
-sbt.version=0.7.1
-project.version=1.0
-def.scala.version=2.7.7
-build.scala.versions=2.8.0.Beta1
-project.initialize=false
--- a/src/main/scala/Date.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-package org.w3.prc.util
-
-import org.joda.time._
-
-case class Date(date:ReadableDateTime) extends Ordered[Date] {
-
-  override def compare(that : Date):Int = this.date compareTo that.date
-
-  override def toString = date.toString
-
-}
-
-object Date {
-
-  def apply():Date = Date(new DateTime())
-
-  def apply(year:Int, month:Int, day:Int):Date = Date(new DateMidnight(year, month, day))
-}
--- a/src/main/scala/Main.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-package org.w3.prc
-
-import org.w3.util._
-import org.w3.util.xml._
-import org.w3.util.xml.XPathQuery._
-import scala.xml.Elem
-
-/**
- * represent a report
- */
-case class Document(url:String) {
-
-  /**
-   * the inner parsed XML document from the url
-   */
-  val doc:Node = Node.htmlNode(url)
-
-  final val divHead = "//html:div[@class='head']"
-
-  def edregexp(v:String) = "'^" + v + """(s?)(\s+\([^)]+\)\s*)?(:?)$'"""
-
-  /**
-   * extract the editor section name
-   * basically, it's either "Editor" or "Author"
-   */
-  def editorSectionName = {
-    val editor = divHead + "//html:dl/html:dt[matches(normalize-space()," + edregexp("Editor") + ")]/text()"
-    lazy val author = divHead + "//html:dl/html:dt[matches(normalize-space()," + edregexp("Author") + ")]/text()"
-    val esn = doc.evaluateSingle(editor) orElse doc.evaluateSingle(author)
-    esn.get.toString
-  }
-
-  /**
-   * get the list of editors
-   * adapted from http://www.w3.org/2001/10/trdoc-data.xsl template trd:getEditorsList
-   */
-  def editors:Seq[Editor] = {
-    // extract the right node
-    val sectXPath = divHead + "//html:dl/html:dt[matches(normalize-space()," + edregexp(editorSectionName) + ")]"
-    val sect = doc.evaluateSingle(sectXPath).get
-    // the rights dds are right under the previous section
-    val ddsXPath = "$sect/following-sibling::html:dd[preceding-sibling::html:dt[1] is $sect]"
-    val dds = sect.evaluate(ddsXPath % "sect" -> sect)
-    // parse and inject the found editors into Editor
-    dds map (dd => Editor.parse(dd.text)) toSeq
-  }
-
-  def versionUriAux(m:String):Seq[String] = {
-    val versionblock = divHead + "//html:dl"
-    val dtXPath = versionblock + "/html:dt[matches(normalize-space(.),'version','i') and matches(normalize-space(.),'" + m + "','i')][1]"
-    val dt = doc.evaluateSingle(dtXPath).get
-    val ddXPath = "$dt/following-sibling::html:dd[preceding-sibling::html:dt[1] is $dt]"
-    val dd = dt.evaluateSingle(ddXPath % "dt" -> dt).get
-    val vurisXPath = "$dd//html:a/@href"
-    // val htmls = dd flatMap (dd => dd.evaluateAsString(vurisXPath, "dd" -> dd))
-    val htmls = dd.evaluate(vurisXPath % "dd" -> dd) map (_.normalizeSpace)
-    htmls toSeq
-  }
-
-  def thisVersionUri:DatedUri = DatedUri(versionUriAux("this")(0))
-
-  def previousVersionUris:Seq[DatedUri] = versionUriAux("previous") map (DatedUri(_))
-
-  def previousVersionUri:DatedUri = previousVersionUris max
-
-  def latestVersionUri:ShortUri = ShortUri(versionUriAux("latest")(0))
-
-}
--- a/src/main/scala/Model.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-package org.w3.prc
-
-import scala.xml.Elem
-import org.w3.prc.util.Date
-
-abstract class Uri {
-  val uri:String
-  override def toString:String = uri.toString
-  final def hasTrailingSlash:Boolean = uri endsWith "/"
-}
-
-case class DatedUri(uri:String) extends Uri with Ordered[DatedUri] {
-
-  def date:Date = {
-    val r = """-(\d{4})(\d{2})(\d{2})""".r
-    val m = r.findFirstMatchIn(uri).get
-    Date(m.group(1).toInt, m.group(2).toInt, m.group(3).toInt)
-  }
-
-  override def compare(that : DatedUri):Int = date compare that.date
-
-}
-
-case class ShortUri(uri:String) extends Uri
-
-
-case class Email(address:String)
-
-case class Editor(
-  firstName:String,
-  lastName:String,
-  email:Option[Email] = None,
-  middleName:Option[String] = None,
-  firstNameInitial:Option[String] = None,
-  middleNameInitial:Option[String] = None
-) {
-  
-  override def toString = firstName + " " + lastName
-
-}
-
-object Editor {
-
-  final val nameChunkRegex = """(\(|,|-|&lt;)"""
-
-  /**
-   * parse an editor section
-   * this is a basic implementation
-   * TODO speak with Ian to improve it
-   */  
-  def parse(s:String):Editor = {
-    val tokens = s split nameChunkRegex
-    val editorPart = tokens(0).split(" ").filter(! _.isEmpty)
-    val firstName = editorPart(0)
-    val lastName = editorPart(1)
-    Editor(firstName=firstName, lastName=lastName)
-  }
-
-}
--- a/src/main/scala/ResponseCache.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-package org.w3.util
-
-import java.net._
-import java.io._
-
-case class CachedResponse(in:InputStream) extends CacheResponse {
-  def getBody() = in
-  def getHeaders() = null
-}
-
-object CachedResponse {
-  def apply(file:File):CachedResponse = CachedResponse(new FileInputStream(file))
-  def apply(filename:String):CachedResponse = CachedResponse(new File(filename))
-}
-
-object CatalogLike extends ResponseCache {
-  def get(uri:URI, rqstMethod:String, rqstHeaders:java.util.Map[java.lang.String,java.util.List[java.lang.String]]) =
-    uri.toString match {
-      case "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" => CachedResponse("dtds/xhtml1-strict.dtd")
-      case _ => null
-    }
-  def put(uri:URI, conn:URLConnection) = null
-}
--- a/src/main/scala/Tidy.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-package org.w3.util
-
-import org.w3.util.xml._
-import java.io.{InputStream, OutputStream, ByteArrayInputStream, ByteArrayOutputStream}
-
-trait Tidy extends NodeInjector {
-
-  /**
-   * utility method that invokes the jtidy library
-   * it generated xhtml and UTF-8
-   * encoding is the expected encoding for in
-   * see http://jtidy.sourceforge.net/howto.html
-   */
-  override def getBodyAndCharset(url:String):(InputStream, String) = {
-    val (in:InputStream, encoding:String) = super.getBodyAndCharset(url)
-    val tidy = new org.w3c.tidy.Tidy()
-    tidy.setXHTML(true)
-    tidy.setInputEncoding(encoding)
-    tidy.setOutputEncoding("UTF-8")
-    val out = new ByteArrayOutputStream()
-    tidy.parse(in, out)
-    (new ByteArrayInputStream(out.toByteArray), encoding)
-  }
-
-}
--- a/src/main/scala/XML.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-package org.w3.util.xml
-
-import org.w3.util.{Tidy, CatalogLike}
-import java.io._
-import dispatch._
-import Http._
-import net.sf.saxon.s9api._
-import javax.xml.transform.stream.StreamSource
-import scala.collection.JavaConversions.JIteratorWrapper
-import scala.xml.Elem
-import java.net._
-
-class NodeInjector() {
-
-  ResponseCache.setDefault(CatalogLike)
-
-  final val DEFAULTCHARSET = "UTF-8"
-
-  /** request the url using dispatch
-   * there is one handler to store the body
-   * there is another handler to get the Content-Type header
-   * see http://dispatch.databinder.net/Stdout_Walkthrough
-   */
-  def getBodyAndCharset(url:String):(InputStream, String) = {
-
-    if (url startsWith "file://") {
-
-      (new FileInputStream(url substring 7), DEFAULTCHARSET)
-
-    } else { // we assume it's a regular URL that dispatch can handle, like http://
-
-      val body = new ByteArrayOutputStream()
-
-      val http = new Http
-      val (_, contentType) =
-	http(url >+ {
-	  r => (r >>> body,
-		r >:> { _("Content-Type") } )} )
-
-      // extract the charset from the Content-Type and choose UTF-8 as a default
-      val charset =
-	try {
-	  val uniqContentType = contentType.toList(0)
-	  """charset=(.*)$""".r.findFirstMatchIn(uniqContentType).get.group(1)
-	} catch {
-	  case _ => DEFAULTCHARSET
-	}
-
-      (new ByteArrayInputStream(body.toByteArray), charset)
-
-    } // else
-  }
-
-  /**
-   * utility method to extract a parsed XML from a URL
-   * jtidy is used to clean the document
-   */
-  def convertUrlToXdmNode(url:String):XdmNode = {
-
-    val (body, charset) = getBodyAndCharset(url)
-
-    // parse the XML document using Saxon
-    // see http://www.saxonica.com/documentation/xpath-api/s9api-xpath.html
-    val proc:Processor = new Processor(false)
-    val builder:DocumentBuilder = proc.newDocumentBuilder()
-    builder.setLineNumbering(true)
-    builder.setWhitespaceStrippingPolicy(WhitespaceStrippingPolicy.ALL)
-    //builder.setDTDValidation(false)
-
-    val doc:XdmNode = builder.build(new StreamSource(body))
-
-    // "closing a ByteArrayOutputStream has no effect", so we don't do it
-
-    // the value of this method is the document itself
-    doc
-  }
-
-}
-
-object Node {
-
-  /**
-   * tranform a Saxon XdmItem into a Scala Elem
-   */
-  def XdmNode2Elem(node:XdmNode):Elem = scala.xml.XML.load(new StringReader(node.toString)) 
-
-  val HTML = "html" -> "http://www.w3.org/1999/xhtml"
-  val CONTACT = "contact" -> "http://www.w3.org/2000/10/swap/pim/contact#"
-  val DC = "dc" -> "http://purl.org/dc/elements/1.1/"
-  val DOC = "doc" -> "http://www.w3.org/2000/10/swap/pim/doc#"
-  val LOG = "log" -> "http://www.w3.org/2000/10/swap/log#"
-  val MAT = "mat" -> "http://www.w3.org/2002/05/matrix/vocab#"
-  val ORG = "org" -> "http://www.w3.org/2001/04/roadmap/org#"
-  val RDF = "rdf" -> "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-  val REC = "rec" -> "http://www.w3.org/2001/02pd/rec54#"
-
-  val HTML_NAMESPACES = Map(HTML)
-  val HISTORY_NAMESPACES = Map(DC, DOC, LOG, MAT, ORG, RDF, REC)
-
-  val tidy = new NodeInjector with Tidy
-  val nodeInj = new NodeInjector
-
-  def htmlNode(uri:String):Node = new Node(tidy.convertUrlToXdmNode(uri), HTML_NAMESPACES)
-
-  def apply(uri:String, namespaces:Map[String, String]):Node = new Node(nodeInj.convertUrlToXdmNode(uri), namespaces)
-
-}
-
-case class XPathQuery(query:String, svars:Map[String, String], nvars:Map[String, Node]) {
-  def %(boundvar:String):BoundXPathQuery = BoundXPathQuery(boundvar, query, svars, nvars)
-}
-
-case class BoundXPathQuery(boundvar:String, query:String, svars:Map[String, String], nvars:Map[String, Node]) {
-  def ->(value:String):XPathQuery = XPathQuery(query, svars+(boundvar -> value), nvars)
-  def ->(value:Int):XPathQuery = XPathQuery(query, svars+(boundvar -> value.toString), nvars)
-  def ->(value:Node):XPathQuery = XPathQuery(query, svars, nvars+(boundvar -> value))
-}
-
-object XPathQuery {
-  implicit def apply(query:String):XPathQuery = XPathQuery(query, Map[String, String](), Map[String, Node]())
-}
-
-case class Node(node:XdmNode, namespaces:Map[String, String]) {
-
-  /**
-   * prepare an XPath selector ready to be used against this node
-   * xhtml namespace is assumed
-   */
-  def getXPathSelector(xpath:XPathQuery):XPathSelector = {
-    val proc:Processor = node.getProcessor
-    val xpathCompiler:XPathCompiler = proc.newXPathCompiler();
-    for((prefix, uri) <- namespaces)
-      xpathCompiler.declareNamespace(prefix, uri)
-    def declare(v:String) = xpathCompiler.declareVariable(new QName(v),
-							  ItemType.ANY_NODE,
-							  OccurrenceIndicator.ONE_OR_MORE)
-    for((v, _) <- xpath.svars) declare(v)
-    for((v, _) <- xpath.nvars) declare(v)
-    val selector:XPathSelector = xpathCompiler.compile(xpath.query).load()
-    selector.setContextItem(node)
-    for((v, n) <- xpath.nvars) selector.setVariable(new QName(v), n.node)
-    selector
-  }
-
-  /**
-   * tranform a Saxon XdmItem into a Scala Elem
-   */
-  def toElem:Elem = Node.XdmNode2Elem(node)
-
-  /**
-   * evaluates an xpath expression against a document
-   * TODO
-   */
-  def evaluateSingle(xpath:XPathQuery):Option[Node] = {
-    val selector = getXPathSelector(xpath)
-    Option(selector.evaluateSingle()) flatMap ((item:XdmItem) => Some(Node(item.asInstanceOf[XdmNode], namespaces)))
-  }
-
-  /**
-   * evaluates an xpath expression against a document
-   * TODO
-   */
-  def evaluate(xpath:XPathQuery):Iterator[Node] = {
-    val selector = getXPathSelector(xpath)
-    JIteratorWrapper(selector.iterator()) map ((item:XdmItem) => Node(item.asInstanceOf[XdmNode], namespaces))
-  }
-
-  private def evaluateAsXdmAtomicValues(xpath:XPathQuery):Iterator[XdmAtomicValue] = {
-    val selector = getXPathSelector(xpath)
-    JIteratorWrapper(selector.iterator()) map (_.asInstanceOf[XdmAtomicValue])
-  }
-
-  private def evaluateSingleAsXdmAtomicValues(xpath:XPathQuery):Option[XdmAtomicValue] = {
-    val selector = getXPathSelector(xpath)
-    Option(selector.evaluateSingle()) flatMap ((item:XdmItem) => Some(item.asInstanceOf[XdmAtomicValue]))
-  }
-
-  def evaluateAsString(xpath:XPathQuery):Iterator[String] =
-    evaluateAsXdmAtomicValues(xpath) map (_.toString)
-
-  def evaluateSingleAsString(xpath:XPathQuery):Option[String] =
-    evaluateSingleAsXdmAtomicValues(xpath) map (_.toString)
-
-  override def toString = node.toString
-
-  def text:String = evaluateSingle("text()").get.node.toString
-  def normalizeSpace:String = evaluateSingleAsString("./normalize-space()").get
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/DurationBuilder.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,67 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+private[time] object DurationBuilder {
+  def apply(underlying: Period): DurationBuilder =
+    new DurationBuilder(underlying)
+}
+
+// Duration Builder
+sealed private[time] class DurationBuilder(val underlying: Period) {
+  // DurationBuilder + DurationBuilder = DurationBuilder
+  // This is the only operation that can maintain a DurationBuilder
+  // Everything else kicks us out to DateTime, Duration, or Period
+  def +(that: DurationBuilder): DurationBuilder =
+    DurationBuilder(this.underlying.plus(that.underlying))
+
+  def ago: DateTime =
+    StaticDateTime.now.minus(underlying)
+  def later: DateTime =
+    StaticDateTime.now.plus(underlying)
+  def from(dt: DateTime): DateTime =
+    dt.plus(underlying)
+  def before(dt: DateTime): DateTime =
+    dt.minus(underlying)
+  
+  def standardDuration: Duration =
+    underlying.toStandardDuration  
+  def toDuration: Duration =
+    underlying.toStandardDuration  
+  def toPeriod: Period =
+    underlying
+    
+  def -(period: ReadablePeriod): Period =
+    underlying.minus(period)
+  def +(period: ReadablePeriod): Period =
+    underlying.plus(period)
+
+  def millis: Long =
+    underlying.toStandardDuration.getMillis
+  def seconds: Long =
+    underlying.toStandardDuration.getStandardSeconds
+  def -(amount: Long): Duration =
+    underlying.toStandardDuration.minus(amount)
+  def -(amount: ReadableDuration): Duration =
+    underlying.toStandardDuration.minus(amount)
+  def +(amount: Long): Duration =
+    underlying.toStandardDuration.plus(amount)
+  def +(amount: ReadableDuration): Duration =
+    underlying.toStandardDuration.plus(amount)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/Implicits.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,78 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ * Copyright 2009 Barry Kaplan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.{Date, Locale}
+import org.joda.time._
+import org.joda.time.base.{AbstractDateTime, AbstractInstant, AbstractPartial}
+import org.joda.time.format.DateTimeFormatter
+import org.joda.time.field.AbstractReadableInstantFieldProperty
+
+object Implicits extends Implicits
+object BuilderImplicits extends Implicits
+object IntImplicits extends IntImplicits
+object JodaImplicits extends JodaImplicits
+
+trait Implicits extends BuilderImplicits with IntImplicits with DateImplicits with JodaImplicits
+
+trait BuilderImplicits {
+  implicit def forcePeriod(builder: DurationBuilder): Period =
+    builder.underlying
+  implicit def forceDuration(builder: DurationBuilder): Duration =
+    builder.underlying.toStandardDuration
+}
+
+trait IntImplicits {
+  implicit def RichInt(n: Int): RichInt = new org.scala_tools.time.RichInt(n)
+  implicit def RichLong(n: Long): RichLong = new org.scala_tools.time.RichLong(n)
+}
+
+trait DateImplicits {
+  implicit def RichDate(d: Date): RichDate = new org.scala_tools.time.RichDate(d)
+}
+
+trait JodaImplicits {
+  implicit def RichAbstractDateTime(dt: AbstractDateTime): RichAbstractDateTime = new RichAbstractDateTime(dt)
+  implicit def RichAbstractInstant(in: AbstractInstant): RichAbstractInstant = new RichAbstractInstant(in)
+  implicit def RichAbstractPartial(pt: AbstractPartial): RichAbstractPartial = new RichAbstractPartial(pt)
+  implicit def RichAbstractReadableInstantFieldProperty(pty: AbstractReadableInstantFieldProperty): RichAbstractReadableInstantFieldProperty =
+    new RichAbstractReadableInstantFieldProperty(pty)
+  implicit def RichChronology(ch: Chronology): RichChronology = new RichChronology(ch)
+  implicit def RichDateMidnight(dm: DateMidnight): RichDateMidnight = new RichDateMidnight(dm)
+  implicit def RichDateTime(dt: DateTime): RichDateTime = new RichDateTime(dt)
+  implicit def RichDateTimeFormatter(fmt: DateTimeFormatter): RichDateTimeFormatter = new RichDateTimeFormatter(fmt)
+  implicit def RichDateTimeProperty(pty: DateTime.Property): RichDateTimeProperty = new RichDateTimeProperty(pty)
+  implicit def RichDateTimeZone(zone: DateTimeZone): RichDateTimeZone = new RichDateTimeZone(zone)
+  implicit def RichDuration(dur: Duration): RichDuration = new RichDuration(dur)
+  implicit def RichInstant(in: Instant): RichInstant = new RichInstant(in)
+  implicit def RichLocalDate(ld: LocalDate): RichLocalDate = new RichLocalDate(ld)
+  implicit def RichLocalDateProperty(pty: LocalDate.Property): RichLocalDateProperty = new RichLocalDateProperty(pty)
+  implicit def RichLocalDateTime(dt: LocalDateTime): RichLocalDateTime = new RichLocalDateTime(dt)
+  implicit def RichLocalDateTimeProperty(pty: LocalDateTime.Property): RichLocalDateTimeProperty = new RichLocalDateTimeProperty(pty)
+  implicit def RichLocalTime(lt: LocalTime): RichLocalTime = new RichLocalTime(lt)
+  implicit def RichLocalTimeProperty(pty: LocalTime.Property): RichLocalTimeProperty = new RichLocalTimeProperty(pty)
+  implicit def RichPartial(pt: Partial): RichPartial = new RichPartial(pt)
+  implicit def RichPartialProperty(pty: Partial.Property): RichPartialProperty = new RichPartialProperty(pty)
+  implicit def RichPeriod(per: Period): RichPeriod = new RichPeriod(per)
+  implicit def RichReadableDateTime(dt: ReadableDateTime): RichReadableDateTime = new RichReadableDateTime(dt)
+  implicit def RichReadableDuration(dur: ReadableDuration): RichReadableDuration = new RichReadableDuration(dur)
+  implicit def RichReadableInstant(in: ReadableInstant): RichReadableInstant = new RichReadableInstant(in)
+  implicit def RichReadableInterval(in: ReadableInterval): RichReadableInterval = new RichReadableInterval(in)
+  implicit def RichReadablePartial(rp: ReadablePartial): RichReadablePartial = new RichReadablePartial(rp)
+  implicit def RichReadablePeriod(per: ReadablePeriod): RichReadablePeriod = new RichReadablePeriod(per)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/Imports.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ * Copyright 2009 Barry Kaplan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+object Imports extends Imports
+object TypeImports extends TypeImports
+object StaticForwarderImports extends StaticForwarderImports
+
+trait Imports extends TypeImports with StaticForwarderImports with Implicits
+
+trait TypeImports {
+  type Chronology     = org.joda.time.Chronology
+  type DateTime       = org.joda.time.DateTime
+  type DateTimeFormat = org.joda.time.format.DateTimeFormat
+  type DateTimeZone   = org.joda.time.DateTimeZone
+  type Duration       = org.joda.time.Duration
+  type Interval       = org.joda.time.Interval
+  type LocalDate      = org.joda.time.LocalDate
+  type LocalDateTime  = org.joda.time.LocalDateTime
+  type LocalTime      = org.joda.time.LocalTime
+  type Period         = org.joda.time.Period
+  type Partial        = org.joda.time.Partial
+}
+
+trait StaticForwarderImports {
+  val DateTime       = org.scala_tools.time.StaticDateTime
+  val DateTimeFormat = org.scala_tools.time.StaticDateTimeFormat
+  val DateTimeZone   = org.scala_tools.time.StaticDateTimeZone
+  val Duration       = org.scala_tools.time.StaticDuration
+  val Interval       = org.scala_tools.time.StaticInterval
+  val LocalDate      = org.scala_tools.time.StaticLocalDate
+  val LocalDateTime  = org.scala_tools.time.StaticLocalDateTime
+  val LocalTime      = org.scala_tools.time.StaticLocalTime
+  val Period         = org.scala_tools.time.StaticPeriod
+  val Partial        = org.scala_tools.time.StaticPartial
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichAbstractDateTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.{Locale, Calendar, GregorianCalendar}
+import org.joda.time._
+import org.joda.time.base.AbstractDateTime
+
+class RichAbstractDateTime(underlying: AbstractDateTime) {
+  def calendar(locale: Locale): Calendar =
+    underlying.toCalendar(locale)
+  def gregorianCalendar: Calendar =
+    underlying.toGregorianCalendar
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichAbstractInstant.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Date
+import org.joda.time._
+import org.joda.time.base.AbstractInstant
+
+class RichAbstractInstant(underlying: AbstractInstant) {
+  def date: Date =
+    underlying.toDate
+  def dateTime: DateTime =
+    underlying.toDateTime
+  def dateTime(chronology: Chronology): DateTime =
+    underlying.toDateTime(chronology)
+  def dateTime(zone: DateTimeZone): DateTime =
+    underlying.toDateTime(zone)
+  def dateTimeISO: DateTime =
+    underlying.toDateTimeISO
+  def instant: Instant =
+    underlying.toInstant
+  def mutableDateTime: MutableDateTime =
+    underlying.toMutableDateTime
+  def mutableDateTime(chronology: Chronology): MutableDateTime =
+    underlying.toMutableDateTime(chronology)
+  def mutableDateTime(zone: DateTimeZone): MutableDateTime =
+    underlying.toMutableDateTime(zone)
+  def mutableDateTimeISO: MutableDateTime =
+    underlying.toMutableDateTimeISO
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichAbstractPartial.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+import org.joda.time.base.AbstractPartial
+
+class RichAbstractPartial(underlying: AbstractPartial) extends Ordered[AbstractPartial] {
+  def fields = underlying.getFields
+  def fieldTypes = underlying.getFieldTypes
+  def values = underlying.getValues
+
+  override def compare(that: AbstractPartial): Int =
+    underlying.compareTo(that)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichAbstractReadableInstantFieldProperty.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,75 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+import org.joda.time.field.AbstractReadableInstantFieldProperty
+
+class RichAbstractReadableInstantFieldProperty(underlying: AbstractReadableInstantFieldProperty) {
+  def shortText: String =
+    underlying.getAsShortText
+  def asShortText: String =
+    underlying.getAsShortText
+  def shortText(locale: Locale): String =
+    underlying.getAsShortText(locale)
+  def asShortText(locale: Locale): String =
+    underlying.getAsShortText(locale)
+  def asString: String =
+    underlying.getAsString
+  def text: String =
+    underlying.getAsText
+  def asText: String =
+    underlying.getAsText
+  def text(locale: Locale): String =
+    underlying.getAsText(locale)
+  def asText(locale: Locale): String =
+    underlying.getAsText(locale)
+  def durationField: DurationField =
+    underlying.getDurationField
+  def field: DateTimeField =
+    underlying.getField
+  def fieldType: DateTimeFieldType =
+    underlying.getFieldType
+  def leapAmount: Int =
+    underlying.getLeapAmount
+  def leapDurationField: DurationField =
+    underlying.getLeapDurationField
+  def maximumValue: Int =
+    underlying.getMaximumValue
+  def maxValue: Int =
+    underlying.getMaximumValue
+  def maximumValueOverall: Int =
+    underlying.getMaximumValueOverall
+  def maxValueOverall: Int =
+    underlying.getMaximumValueOverall
+  def minimumValue: Int =
+    underlying.getMinimumValue
+  def minValue: Int =
+    underlying.getMinimumValue
+  def minimumValueOverall: Int =
+    underlying.getMinimumValueOverall
+  def minValueOverall: Int =
+    underlying.getMinimumValueOverall
+  def name: String =
+    underlying.getName
+  def rangeDurationField: DurationField =
+    underlying.getRangeDurationField
+
+  def interval: Interval =
+    underlying.toInterval
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichChronology.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichChronology(underlying: Chronology) {
+  def zone: Option[DateTimeZone] =
+    nullCheck(underlying.getZone)
+  private def nullCheck[T <: AnyRef](x: T): Option[T] =
+    if (x == null) None else Some(x)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDate.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,10 @@
+package org.scala_tools.time
+
+import java.util.Date
+import org.joda.time._
+
+class RichDate(val d: Date) {
+  def toLocalDateTime: LocalDateTime = StaticLocalDateTime.fromDateFields(d)
+  def toLocalDate: LocalDate = StaticLocalDate.fromDateFields(d)
+  def toLocalTime: LocalTime = StaticLocalTime.fromDateFields(d)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDateMidnight.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichDateMidnight(underlying: DateMidnight) {
+  def -(duration: Long): DateMidnight =
+    underlying.minus(duration)
+  def -(duration: ReadableDuration): DateMidnight =
+    underlying.minus(duration)
+  def -(period: ReadablePeriod): DateMidnight =
+    underlying.minus(period)
+  def -(builder: DurationBuilder): DateMidnight =
+    underlying.minus(builder.underlying)
+  def +(duration: Long): DateMidnight =
+    underlying.plus(duration)
+  def +(duration: ReadableDuration): DateMidnight =
+    underlying.plus(duration)
+  def +(period: ReadablePeriod): DateMidnight =
+    underlying.plus(period)
+  def +(builder: DurationBuilder): DateMidnight =
+    underlying.plus(builder.underlying)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDateTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,58 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichDateTime(underlying: DateTime) {
+  def -(duration: Long): DateTime =
+    underlying.minus(duration)
+  def -(duration: ReadableDuration): DateTime =
+    underlying.minus(duration)
+  def -(period: ReadablePeriod): DateTime =
+    underlying.minus(period)
+  def -(builder: DurationBuilder): DateTime =
+    underlying.minus(builder.underlying)
+  def +(duration: Long): DateTime =
+    underlying.plus(duration)
+  def +(duration: ReadableDuration): DateTime =
+    underlying.plus(duration)
+  def +(period: ReadablePeriod): DateTime =
+    underlying.plus(period)
+  def +(builder: DurationBuilder): DateTime =
+    underlying.plus(builder.underlying)
+  
+  def second: DateTime.Property = underlying.secondOfMinute
+  def minute: DateTime.Property = underlying.minuteOfHour
+  def hour: DateTime.Property = underlying.hourOfDay
+  def day: DateTime.Property = underlying.dayOfMonth
+  def week: DateTime.Property = underlying.weekOfWeekyear
+  def month: DateTime.Property = underlying.monthOfYear
+  def year: DateTime.Property = underlying.year
+  def century: DateTime.Property = underlying.centuryOfEra
+  def era: DateTime.Property = underlying.era
+  
+  def withSecond(second: Int) = underlying.withSecondOfMinute(second)
+  def withMinute(minute: Int) = underlying.withMinuteOfHour(minute)
+  def withHour(hour: Int) = underlying.withHourOfDay(hour)
+  def withDay(day: Int) = underlying.withDayOfMonth(day)
+  def withWeek(week: Int) = underlying.withWeekOfWeekyear(week)
+  def withMonth(month: Int) = underlying.withMonthOfYear(month)
+  def withYear(year: Int) = underlying.withYear(year)
+  def withCentury(century: Int) = underlying.withCenturyOfEra(century)
+  def withEra(era: Int) = underlying.withEra(era)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDateTimeFormatter.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+import org.joda.time.format.{DateTimeFormatter, DateTimeParser,
+  DateTimePrinter}
+
+class RichDateTimeFormatter(underlying: DateTimeFormatter) {
+  def chronology: Chronology = underlying.getChronolgy
+  def locale: Locale = underlying.getLocale
+  def parser: DateTimeParser = underlying.getParser
+  def pivotYear: Int = underlying.getPivotYear.intValue
+  def printer: DateTimePrinter = underlying.getPrinter
+  def zone: DateTimeZone = underlying.getZone
+  def parseOption(text: String): Option[DateTime] =
+    try {
+      Some(underlying.parseDateTime(text))
+    } catch {
+      case _ : UnsupportedOperationException => None
+      case _ : IllegalArgumentException => None
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDateTimeProperty.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+
+class RichDateTimeProperty(underlying: DateTime.Property) {
+  def dateTime: DateTime =
+    underlying.getDateTime
+  def roundFloor: DateTime =
+    underlying.roundFloorCopy
+  def roundCeiling: DateTime =
+    underlying.roundCeilingCopy
+  def roundDown: DateTime =
+    underlying.roundFloorCopy
+  def roundUp: DateTime =
+    underlying.roundCeilingCopy
+  def round: DateTime =
+    underlying.roundHalfEvenCopy
+
+  def apply(value: Int): DateTime = underlying.setCopy(value)
+  def apply(text: String): DateTime = underlying.setCopy(text)
+  def apply(text: String, locale: Locale): DateTime =
+    underlying.setCopy(text, locale)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDateTimeZone.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichDateTimeZone(underlying: DateTimeZone) {
+  def id: String =
+    underlying.getID
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichDuration.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichDuration(underlying: Duration) {
+  def seconds: Long =
+    underlying.getStandardSeconds
+  def -(amount: Long): Duration =
+    underlying.minus(amount)
+  def -(amount: ReadableDuration): Duration =
+    underlying.minus(amount)
+  def +(amount: Long): Duration =
+    underlying.plus(amount)
+  def +(amount: ReadableDuration): Duration =
+    underlying.plus(amount)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichInstant.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichInstant(underlying: Instant) {
+  def -(duration: Long): Instant =
+    underlying.minus(duration)
+  def -(duration: ReadableDuration): Instant =
+    underlying.minus(duration)
+  def +(duration: Long): Instant =
+    underlying.plus(duration)
+  def +(duration: ReadableDuration): Instant =
+    underlying.plus(duration)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichInt.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichInt(n: Int) {
+  // These units of time can build durations or periods.
+  // At most we lose a leap second. (Unless someone adopts
+  // leap minutes).
+  def millis  = DurationBuilder(Period.millis(n))
+  def seconds = DurationBuilder(Period.seconds(n))
+  def minutes = DurationBuilder(Period.minutes(n))
+  def hours   = DurationBuilder(Period.hours(n))
+
+  // These units of time can only be periods. At this
+  // point if we made durations automatically we'd start
+  // getting into trouble with daylight savings time,
+  // monthly differences, leap years, etc.
+  def days   = Period.days(n)
+  def weeks  = Period.weeks(n)
+  def months = Period.months(n)
+  def years  = Period.years(n)
+
+  // See above.
+  def milli  = DurationBuilder(Period.millis(n))
+  def second = DurationBuilder(Period.seconds(n))
+  def minute = DurationBuilder(Period.minutes(n))
+  def hour   = DurationBuilder(Period.hours(n))
+
+  // See above.
+  def day   = Period.days(n)
+  def week  = Period.weeks(n)
+  def month = Period.months(n)
+  def year  = Period.years(n)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLocalDate.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ * Copyright 2009 Barry Kaplan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichLocalDate(underlying: LocalDate) {
+  def -(period: ReadablePeriod): LocalDate =
+    underlying.minus(period)
+  def -(builder: DurationBuilder): LocalDate =
+    underlying.minus(builder.underlying)
+  def +(period: ReadablePeriod): LocalDate =
+    underlying.plus(period)
+  def +(builder: DurationBuilder): LocalDate =
+    underlying.plus(builder.underlying)
+
+  def day: LocalDate.Property = underlying.dayOfMonth
+  def week: LocalDate.Property = underlying.weekOfWeekyear
+  def month: LocalDate.Property = underlying.monthOfYear
+  def year: LocalDate.Property = underlying.year
+  def century: LocalDate.Property = underlying.centuryOfEra
+  def era: LocalDate.Property = underlying.era
+
+  def withDay(day: Int) = underlying.withDayOfMonth(day)
+  def withWeek(week: Int) = underlying.withWeekOfWeekyear(week)
+  def withMonth(month: Int) = underlying.withMonthOfYear(month)
+  def withYear(year: Int) = underlying.withYear(year)
+  def withCentury(century: Int) = underlying.withCenturyOfEra(century)
+  def withEra(era: Int) = underlying.withEra(era)
+  
+  def interval = underlying.toInterval
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLocalDateProperty.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+
+class RichLocalDateProperty(underlying: LocalDate.Property) {
+  def localDate: LocalDate =
+    underlying.getLocalDate
+  def roundFloor: LocalDate =
+    underlying.roundFloorCopy
+  def roundCeiling: LocalDate =
+    underlying.roundCeilingCopy
+  def roundDown: LocalDate =
+    underlying.roundFloorCopy
+  def roundUp: LocalDate =
+    underlying.roundCeilingCopy
+  def round: LocalDate =
+    underlying.roundHalfEvenCopy
+
+  def apply(value: Int): LocalDate = underlying.setCopy(value)
+  def apply(text: String): LocalDate = underlying.setCopy(text)
+  def apply(text: String, locale: Locale): LocalDate =
+    underlying.setCopy(text, locale)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLocalDateTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichLocalDateTime(underlying: LocalDateTime) {
+  def -(duration: ReadableDuration): LocalDateTime =
+    underlying.minus(duration)
+  def -(period: ReadablePeriod): LocalDateTime =
+    underlying.minus(period)
+  def -(builder: DurationBuilder): LocalDateTime =
+    underlying.minus(builder.underlying)
+  def +(duration: ReadableDuration): LocalDateTime =
+    underlying.plus(duration)
+  def +(period: ReadablePeriod): LocalDateTime =
+    underlying.plus(period)
+  def +(builder: DurationBuilder): LocalDateTime =
+    underlying.plus(builder.underlying)
+
+  def second: LocalDateTime.Property = underlying.secondOfMinute
+  def minute: LocalDateTime.Property = underlying.minuteOfHour
+  def hour: LocalDateTime.Property = underlying.hourOfDay
+  def day: LocalDateTime.Property = underlying.dayOfMonth
+  def week: LocalDateTime.Property = underlying.weekOfWeekyear
+  def month: LocalDateTime.Property = underlying.monthOfYear
+  def year: LocalDateTime.Property = underlying.year
+  def century: LocalDateTime.Property = underlying.centuryOfEra
+  def era: LocalDateTime.Property = underlying.era
+
+  def withSecond(second: Int) = underlying.withSecondOfMinute(second)
+  def withMinute(minute: Int) = underlying.withMinuteOfHour(minute)
+  def withHour(hour: Int) = underlying.withHourOfDay(hour)
+  def withDay(day: Int) = underlying.withDayOfMonth(day)
+  def withWeek(week: Int) = underlying.withWeekOfWeekyear(week)
+  def withMonth(month: Int) = underlying.withMonthOfYear(month)
+  def withYear(year: Int) = underlying.withYear(year)
+  def withCentury(century: Int) = underlying.withCenturyOfEra(century)
+  def withEra(era: Int) = underlying.withEra(era)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLocalDateTimeProperty.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+
+class RichLocalDateTimeProperty(underlying: LocalDateTime.Property) {
+  def localDateTime: LocalDateTime =
+    underlying.getLocalDateTime
+  def roundFloor: LocalDateTime =
+    underlying.roundFloorCopy
+  def roundCeiling: LocalDateTime =
+    underlying.roundCeilingCopy
+  def roundDown: LocalDateTime =
+    underlying.roundFloorCopy
+  def roundUp: LocalDateTime =
+    underlying.roundCeilingCopy
+  def round: LocalDateTime =
+    underlying.roundHalfEvenCopy
+
+  def apply(value: Int): LocalDateTime = underlying.setCopy(value)
+  def apply(text: String): LocalDateTime = underlying.setCopy(text)
+  def apply(text: String, locale: Locale): LocalDateTime =
+    underlying.setCopy(text, locale)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLocalTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,38 @@
+/**
+ * Copyright 2009 Barry Kaplan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichLocalTime(underlying: LocalTime) {
+  def -(period: ReadablePeriod): LocalTime =
+    underlying.minus(period)
+  def -(builder: DurationBuilder): LocalTime =
+    underlying.minus(builder.underlying)
+  def +(period: ReadablePeriod): LocalTime =
+    underlying.plus(period)
+  def +(builder: DurationBuilder): LocalTime =
+    underlying.plus(builder.underlying)
+
+  def second: LocalTime.Property = underlying.secondOfMinute
+  def minute: LocalTime.Property = underlying.minuteOfHour
+  def hour: LocalTime.Property = underlying.hourOfDay
+
+  def withSecond(second: Int) = underlying.withSecondOfMinute(second)
+  def withMinute(minute: Int) = underlying.withMinuteOfHour(minute)
+  def withHour(hour: Int) = underlying.withHourOfDay(hour)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLocalTimeProperty.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,40 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+
+class RichLocalTimeProperty(underlying: LocalTime.Property) {
+  def localTime: LocalTime =
+    underlying.getLocalTime
+  def roundFloor: LocalTime =
+    underlying.roundFloorCopy
+  def roundCeiling: LocalTime =
+    underlying.roundCeilingCopy
+  def roundDown: LocalTime =
+    underlying.roundFloorCopy
+  def roundUp: LocalTime =
+    underlying.roundCeilingCopy
+  def round: LocalTime =
+    underlying.roundHalfEvenCopy
+
+  def apply(value: Int): LocalTime = underlying.setCopy(value)
+  def apply(text: String): LocalTime = underlying.setCopy(text)
+  def apply(text: String, locale: Locale): LocalTime =
+    underlying.setCopy(text, locale)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichLong.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichLong(n: Long) {
+  def toDateTime = new DateTime(n)
+  def toDuration = new Duration(n)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichPartial.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,32 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichPartial(underlying: Partial) {
+  def formatter = underlying.getFormatter
+  
+  def -(period: ReadablePeriod): Partial =
+    underlying.minus(period)
+  def -(builder: DurationBuilder): Partial =
+    underlying.minus(builder.underlying)
+  def +(period: ReadablePeriod): Partial =
+    underlying.plus(period)
+  def +(builder: DurationBuilder): Partial =
+    underlying.plus(builder.underlying)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichPartialProperty.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,30 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+
+class RichPartialProperty(underlying: Partial.Property) {
+  def partial: Partial =
+    underlying.getPartial
+
+  def apply(value: Int): Partial = underlying.setCopy(value)
+  def apply(text: String): Partial = underlying.setCopy(text)
+  def apply(text: String, locale: Locale): Partial =
+    underlying.setCopy(text, locale)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichPeriod.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,53 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichPeriod(underlying: Period) {
+  def days: Int =
+    underlying.getDays
+  def hours: Int =
+    underlying.getHours
+  def millis: Int =
+    underlying.getMillis
+  def minutes: Int =
+    underlying.getMinutes
+  def months: Int =
+    underlying.getMonths
+  def seconds: Int =
+    underlying.getSeconds
+  def weeks: Int =
+    underlying.getWeeks
+  def years: Int =
+    underlying.getYears
+  def -(period: ReadablePeriod): Period =
+    underlying.minus(period)
+  def +(period: ReadablePeriod): Period =
+    underlying.plus(period)
+  def ago: DateTime =
+    StaticDateTime.now.minus(underlying)
+  def later: DateTime =
+    StaticDateTime.now.plus(underlying)
+  def from(dt: DateTime): DateTime =
+    dt.plus(underlying)
+  def before(dt: DateTime): DateTime =
+    dt.minus(underlying)
+  
+  def standardDuration: Duration =
+    underlying.toStandardDuration
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichReadableDateTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,43 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichReadableDateTime(underlying: ReadableDateTime) {  
+  def second: Int =
+    underlying.getSecondOfMinute
+  def minute: Int =
+    underlying.getMinuteOfHour
+  def hour: Int =
+    underlying.getHourOfDay
+  def day: Int =
+    underlying.getDayOfMonth
+  def week: Int =
+    underlying.getWeekOfWeekyear
+  def month: Int =
+    underlying.getMonthOfYear
+  def year: Int =
+    underlying.getYear
+  def century: Int =
+    underlying.getCenturyOfEra
+  
+  def dateTime: DateTime =
+    underlying.toDateTime
+  def mutableDateTime: MutableDateTime =
+    underlying.toMutableDateTime
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichReadableDuration.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,26 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichReadableDuration(underlying: ReadableDuration) extends Ordered[ReadableDuration] {
+  def millis: Long =
+    underlying.getMillis
+  def compare(other: ReadableDuration): Int =
+    underlying.compareTo(other)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichReadableInstant.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,36 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichReadableInstant(underlying: ReadableInstant) extends Ordered[ReadableInstant] {
+  def chronology: Chronology =
+    underlying.getChronology
+  def millis: Long =
+    underlying.getMillis
+  def zone: DateTimeZone =
+    underlying.getZone
+  override def compare(that: ReadableInstant): Int =
+    underlying.compareTo(that)
+  
+  def to(other: ReadableInstant): Interval =
+    new Interval(underlying, other)
+
+  def instant: Instant =
+    underlying.toInstant
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichReadableInterval.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,35 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichReadableInterval(underlying: ReadableInterval) {
+  def chronology: Chronology =
+    underlying.getChronology
+  def end: DateTime =
+    underlying.getEnd
+  def start: DateTime =
+    underlying.getStart
+
+  def duration: Duration =
+    underlying.toDuration
+  def millis: Long =
+    underlying.toDuration.getMillis
+  // TODO: Should > and > be added as aliases for isAfter and isBefore?
+  //   could be convenient, or just confusing because this isn't Ordered.
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichReadablePartial.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,23 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichReadablePartial(underlying: ReadablePartial) {
+  def chronology = underlying.getChronology
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/RichReadablePeriod.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,24 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+class RichReadablePeriod(underlying: ReadablePeriod) {
+  def periodType: PeriodType =
+    underlying.getPeriodType
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticDateTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+import org.scala_tools.time.Implicits._
+
+object StaticDateTime extends StaticDateTime
+
+trait StaticDateTime {
+  type Property = DateTime.Property
+
+  def now        = new DateTime
+
+  def nextSecond = now + 1.second
+  def nextMinute = now + 1.minute
+  def nextHour   = now + 1.hour
+  def nextDay    = now + 1.day
+  def tomorrow   = now + 1.day
+  def nextWeek   = now + 1.week
+  def nextMonth  = now + 1.month
+  def nextYear   = now + 1.year
+
+  def lastSecond = now - 1.second
+  def lastMinute = now - 1.minute
+  def lastHour   = now - 1.hour
+  def lastDay    = now - 1.day
+  def yesterday  = now - 1.day
+  def lastWeek   = now - 1.week
+  def lastMonth  = now - 1.month
+  def lastYear   = now - 1.year
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticDateTimeFormat.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.Locale
+import org.joda.time._
+import org.joda.time.format._
+
+object StaticDateTimeFormat extends StaticDateTimeFormat
+
+trait StaticDateTimeFormat {
+  def forPattern(pattern: String): DateTimeFormatter =
+    DateTimeFormat.forPattern(pattern)
+  def forStyle(style: String): DateTimeFormatter =
+    DateTimeFormat.forStyle(style)
+  def fullDate(): DateTimeFormatter = DateTimeFormat.fullDate()
+  def fullDateTime(): DateTimeFormatter = DateTimeFormat.fullDateTime()
+  def fullTime(): DateTimeFormatter = DateTimeFormat.fullTime()
+  def longDate(): DateTimeFormatter = DateTimeFormat.longDate()
+  def longDateTime(): DateTimeFormatter = DateTimeFormat.longDateTime()
+  def longTime(): DateTimeFormatter = DateTimeFormat.longTime()
+  def mediumDate(): DateTimeFormatter = DateTimeFormat.mediumDate()
+  def mediumDateTime(): DateTimeFormatter = DateTimeFormat.mediumDateTime()
+  def mediumTime(): DateTimeFormatter = DateTimeFormat.mediumTime()
+  def patternForStyle(style: String, locale: Locale): String =
+    DateTimeFormat.patternForStyle(style, locale)
+  def shortDate(): DateTimeFormatter = DateTimeFormat.shortDate()
+  def shortDateTime(): DateTimeFormatter = DateTimeFormat.shortDateTime()
+  def shortTime(): DateTimeFormatter = DateTimeFormat.shortTime()
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticDateTimeZone.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,39 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+object StaticDateTimeZone extends StaticDateTimeZone
+
+trait StaticDateTimeZone {
+  lazy val UTC = DateTimeZone.UTC
+  def forID(id: String) = DateTimeZone.forID(id)
+  def forOffsetHours(hours: Int) = DateTimeZone.forOffsetHours(hours)
+  def forOffsetHoursMinutes(hours: Int, minutes: Int) =
+    DateTimeZone.forOffsetHoursMinutes(hours, minutes)
+  def forOffsetMillis(millis: Int) = DateTimeZone.forOffsetMillis(millis)
+  def forTimeZone(zone: java.util.TimeZone) = DateTimeZone.forTimeZone(zone)
+  def getAvailableIDs() = DateTimeZone.getAvailableIDs()
+  def getDefault() = DateTimeZone.getDefault()
+  def getNameProvider() = DateTimeZone.getNameProvider()
+  def getProvider() = DateTimeZone.getProvider()
+  def setDefault(zone: DateTimeZone) = DateTimeZone.setDefault(zone)
+  def setNameProvider(nameProvider: tz.NameProvider) =
+    DateTimeZone.setNameProvider(nameProvider)
+  def setProvider(provider: tz.Provider) = DateTimeZone.setProvider(provider)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticDuration.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,28 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+object StaticDuration extends StaticDuration
+
+trait StaticDuration {
+  def standardDays(days: Long) = Duration.standardDays(days)
+  def standardHours(hours: Long) = Duration.standardHours(hours)
+  def standardMinutes(minutes: Long) = Duration.standardMinutes(minutes)
+  def standardSeconds(seconds: Long) = Duration.standardSeconds(seconds)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticInterval.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,51 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.scala_tools.time.Implicits._
+import org.joda.time._
+
+object StaticInterval extends StaticInterval
+
+trait StaticInterval {
+  def thisSecond = StaticDateTime.now.second.interval
+  def thisMinute = StaticDateTime.now.minute.interval
+  def thisHour   = StaticDateTime.now.hour.interval
+  def thisDay    = StaticDateTime.now.day.interval
+  def today      = StaticDateTime.now.day.interval
+  def thisWeek   = StaticDateTime.now.week.interval
+  def thisMonth  = StaticDateTime.now.month.interval
+  def thisYear   = StaticDateTime.now.year.interval
+
+  def nextSecond = StaticDateTime.nextSecond.second.interval
+  def nextMinute = StaticDateTime.nextMinute.minute.interval
+  def nextHour   = StaticDateTime.nextHour.hour.interval
+  def nextDay    = StaticDateTime.nextDay.day.interval
+  def tomorrow   = StaticDateTime.nextDay.day.interval
+  def nextWeek   = StaticDateTime.nextWeek.week.interval
+  def nextMonth  = StaticDateTime.nextMonth.month.interval
+  def nextYear   = StaticDateTime.nextYear.year.interval
+
+  def lastSecond = StaticDateTime.lastSecond.second.interval
+  def lastMinute = StaticDateTime.lastMinute.minute.interval
+  def lastHour   = StaticDateTime.lastHour.hour.interval
+  def lastDay    = StaticDateTime.lastDay.day.interval
+  def yesterday  = StaticDateTime.lastDay.day.interval
+  def lastWeek   = StaticDateTime.lastWeek.week.interval
+  def lastMonth  = StaticDateTime.lastMonth.month.interval
+  def lastYear   = StaticDateTime.lastYear.year.interval
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticLocalDate.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,48 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ * Copyright 2009 Barry Kaplan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.{Calendar, Date}
+import org.joda.time._
+import org.scala_tools.time.Implicits._
+
+object StaticLocalDate extends StaticLocalDate 
+
+trait StaticLocalDate {
+  type Property = LocalDate.Property
+  
+  def fromCalendarFields(calendar: Calendar) =
+    LocalDate.fromCalendarFields(calendar)
+  def fromDateFields(date: Date) =
+    LocalDate.fromDateFields(date)
+  
+  def now        = new LocalDate
+  def today      = new LocalDate
+
+  def nextDay    = now + 1.day
+  def tomorrow   = now + 1.day
+  def nextWeek   = now + 1.week
+  def nextMonth  = now + 1.month
+  def nextYear   = now + 1.year
+
+  def lastDay    = now - 1.day
+  def yesterday  = now - 1.day
+  def lastWeek   = now - 1.week
+  def lastMonth  = now - 1.month
+  def lastYear   = now - 1.year
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticLocalDateTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,52 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.{Calendar, Date}
+import org.joda.time._
+import org.scala_tools.time.Implicits._
+
+object StaticLocalDateTime extends StaticLocalDateTime
+
+trait StaticLocalDateTime {
+  type Property = LocalDateTime.Property
+  
+  def fromCalendarFields(calendar: Calendar) =
+    LocalDateTime.fromCalendarFields(calendar)
+  def fromDateFields(date: Date) =
+    LocalDateTime.fromDateFields(date)
+
+  def now        = new LocalDateTime
+
+  def nextSecond = now + 1.second
+  def nextMinute = now + 1.minute
+  def nextHour   = now + 1.hour
+  def nextDay    = now + 1.day
+  def tomorrow   = now + 1.day
+  def nextWeek   = now + 1.week
+  def nextMonth  = now + 1.month
+  def nextYear   = now + 1.year
+
+  def lastSecond = now - 1.second
+  def lastMinute = now - 1.minute
+  def lastHour   = now - 1.hour
+  def lastDay    = now - 1.day
+  def yesterday  = now - 1.day
+  def lastWeek   = now - 1.week
+  def lastMonth  = now - 1.month
+  def lastYear   = now - 1.year
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticLocalTime.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ * Copyright 2009 Barry Kaplan
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import java.util.{Calendar, Date}
+import org.joda.time._
+import org.scala_tools.time.Implicits._
+
+object StaticLocalTime extends StaticLocalTime
+
+trait StaticLocalTime {
+  type Property = LocalTime.Property
+  
+  final val MIDNIGHT = LocalTime.MIDNIGHT
+  final val Midnight = LocalTime.MIDNIGHT
+  
+  def fromCalendarFields(calendar: Calendar) =
+    LocalTime.fromCalendarFields(calendar)
+  def fromDateFields(date: Date) =
+    LocalTime.fromDateFields(date)
+  def fromMillisOfDay(millis: Long) =
+    LocalTime.fromMillisOfDay(millis)
+  def fromMillisOfDay(millis: Long, chrono: Chronology) =
+    LocalTime.fromMillisOfDay(millis, chrono)
+
+  def now        = new LocalTime
+
+  def nextSecond = now + 1.second
+  def nextMinute = now + 1.minute
+  def nextHour   = now + 1.hour
+
+  def lastSecond = now - 1.second
+  def lastMinute = now - 1.minute
+  def lastHour   = now - 1.hour
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticPartial.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,25 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+object StaticPartial extends StaticPartial
+
+trait StaticPartial {
+  type Property = Partial.Property
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/scala-time/org/scala_tools/time/StaticPeriod.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -0,0 +1,34 @@
+/**
+ * Copyright 2009 Jorge Ortiz
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License. 
+ *
+ **/
+package org.scala_tools.time
+
+import org.joda.time._
+
+object StaticPeriod extends StaticPeriod
+
+trait StaticPeriod {
+  def days(days: Int) = Period.days(days)
+  def fieldDifference(start: ReadablePartial, end: ReadablePartial) =
+    Period.fieldDifference(start, end)
+  def hours(hours: Int) = Period.hours(hours)
+  def millis(millis: Int) = Period.millis(millis)
+  def minutes(minutes: Int) = Period.minutes(minutes)
+  def months(months: Int) = Period.months(months)
+  def seconds(seconds: Int) = Period.seconds(seconds)
+  def weeks(weeks: Int) = Period.weeks(weeks)
+  def years(years: Int) = Period.years(years)
+}
--- a/src/test/scala/DocumentTest.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-import org.scalatest.FunSuite
-import org.w3.prc._
-
-class DocumentTest extends FunSuite {
-
-  test("PR-xlink11-20100225") {
-
-    val document = Document("file://src/test/resources/PR-xlink11-20100225.html")
-
-    assert("Editors:" === document.editorSectionName)
-
-    val expectedEditors = Set(Editor("Steve", "DeRose"),
-			      Editor("Eve", "Maler"),
-			      Editor("David", "Orchard"),
-			      Editor("Norman", "Walsh"))
-
-    assert(expectedEditors === document.editors.toList.toSet)
-
-    val thisVersionUri = document.thisVersionUri
-    assert(DatedUri("http://www.w3.org/TR/2010/PR-xlink11-20100225/") === thisVersionUri)
-    assert(thisVersionUri hasTrailingSlash)
-
-    val expectedpreviousVersionUris = Seq(DatedUri("http://www.w3.org/TR/2008/WD-xlink11-20080331/"),
-					  DatedUri("http://www.w3.org/TR/2006/CR-xlink11-20060328/"))
-    assert(expectedpreviousVersionUris === document.previousVersionUris)
-
-    val previousVersionUri = document.previousVersionUri
-    assert(DatedUri("http://www.w3.org/TR/2008/WD-xlink11-20080331/") === previousVersionUri)
-    assert(previousVersionUri hasTrailingSlash)
-
-    val latestVersionUri = document.latestVersionUri
-    assert(ShortUri("http://www.w3.org/TR/xlink11/") === latestVersionUri)
-    assert(latestVersionUri hasTrailingSlash)
-
-  }
-
-  test("WD-xmldsig-properties-20100204") {
-
-    val document = Document("file://src/test/resources/WD-xmldsig-properties-20100204.html")
-
-    assert("Editor:" === document.editorSectionName)
-
-    val expectedEditors = Set(Editor("Frederick", "Hirsch"))
-    assert(expectedEditors === document.editors.toList.toSet)
-
-    assert(DatedUri("http://www.w3.org/TR/2010/WD-xmldsig-properties-20100204/") === document.thisVersionUri)
-
-    val expectedpreviousVersionUris = Seq(DatedUri("http://www.w3.org/TR/2009/WD-xmldsig-properties-20090430/"))
-    assert(expectedpreviousVersionUris === document.previousVersionUris)
-
-    assert(DatedUri("http://www.w3.org/TR/2009/WD-xmldsig-properties-20090430/") === document.previousVersionUri)
-
-    assert(ShortUri("http://www.w3.org/TR/xmldsig-properties/") === document.latestVersionUri)
-
-  }
-
-}
--- a/src/test/scala/HistoryTest.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-import org.scalatest.FunSuite
-import org.w3.prc.DatedUri
-import org.w3.util.xml.Node
-
-
-class HistoryTest extends FunSuite {
-
-  test("") {
-
-    val mappings = Map("" -> "", "" -> "", "" -> "", "" -> "")
-    val all = Node("file://src/test/resources/all.rdf", Node.HISTORY_NAMESPACES)
-    
-
-
-  }
-
-}
--- a/src/test/scala/ModelTest.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-import org.scalatest.FunSuite
-import org.w3.prc._
-
-class ModelTest extends FunSuite {
-
-  test("parse editors") {
-
-    assert(Editor("Steve", "DeRose") === Editor.parse("Steve DeRose, Brown University Scholarly Technology Group"))
-
-    assert(Editor("Norman", "Walsh") === Editor.parse("Norman Walsh, Mark Logic Corporation - Version 1.1"))
-
-  }
-
-}
--- a/src/test/scala/Test.scala	Thu Aug 04 14:45:02 2011 -0400
+++ b/src/test/scala/Test.scala	Fri Aug 05 19:46:26 2011 -0400
@@ -1,136 +1,49 @@
-import org.scalatest.FunSuite
-import net.croz.scardf._
-import org.w3.prc.util.Date
-
-object Rec54 extends Vocabulary("http://www.w3.org/2001/02pd/rec54#") {
-  val TRPub = pRes("TRPub")
-  val WD = pRes("WD")
-  val NOTE = pRes("NOTE")
-  val Retired = pRes("Retired")
-  val Rec = pRes("Rec")
-  val PER = pRes("PER")
-  val editor = pProp("editor")
-  val cites = pProp("cites")
-  val perReviewsDue = pProp("perReviewsDue")
-  val previousEdition = pProp("previousEdition")
-  val formerShortname = pProp("formerShortname")
-  val sameWorkAs = pProp("sameWorkAs")
-  val replaces = pProp("replaces")
-  val supersedes = pProp("supersedes")
-}
-
-object Doc extends Vocabulary("http://www.w3.org/2000/10/swap/pim/doc#") {
-  val versionOf = pProp("versionOf")
-  val obsoletes = pProp("obsoletes")
-}
-
-object DC extends Vocabulary("http://purl.org/dc/elements/1.1/") {
-  val date = pProp("date")
-  val title = pProp("title")
-}
-
-object Contact extends Vocabulary("http://www.w3.org/2000/10/swap/pim/contact#") {
-  val fullName = pProp("fullName")
-  val mailBox = pProp("mailBox")
-  val homePage = pProp("homePage")
-}
-
-object Org extends Vocabulary("http://www.w3.org/2001/04/roadmap/org#") {
-  val deliveryBy = pProp("deliveryBy")
-}
-
-case class SpecService(model:Model) {
+package org.w3.prc
 
-  def getAllWDs = Sparql selectAllX asRes where( (X, RDF.Type, Rec54.WD) ) from model map (Spec(_))
-  
-}
-
-/*****************/
-
-case class Spec(res:Res) extends Ordered[Spec] {
-
-  override def toString = res.toString
-
-  def date:Date = {
-    val date = res/DC.date/asString
-    val m = """(\d{4})-(\d{2})-(\d{2})""".r.findFirstMatchIn(date).get
-    Date(m.group(1).toInt, m.group(2).toInt, m.group(3).toInt)
-  }
-
-  def compare(that:Spec) = this.date compare that.date
-
-  def versionOf:Set[LatestSpec] = (res/Doc.versionOf/asRes.set) map { LatestSpec(_) }
-
-  def obsoletes:Set[Spec] = (res/Doc.obsoletes/asRes.set) map { Spec(_) }
+import org.scalatest.FunSuite
 
-  def supersedes:Set[Spec] = (res/Rec54.supersedes/asRes.set) map { Spec(_) }
- 
-  def sameWorkAs:Set[LatestSpec] = versionOf flatMap { _.sameWorkAs }
-
-  def replaces:Set[LatestSpec] = versionOf flatMap { _.replaces }
-
-  def hasFormerShortname(names:Iterator[String]) = {
-    val formerShortname = versionOf flatMap { _.formerShortname }
-    names exists { name => formerShortname contains name }
-  }
-}
+import java.net.ResponseCache
+import net.sf.saxon.Transform
 
-case class LatestSpec(res:Res) {
-
-  override def toString = res.toString
-
-  val name = new java.net.URI(res.uri).getPath.split("/").last
-
-  def formerShortname:Set[String] = res/Rec54.formerShortname/asString.set
-
-  def sameWorkAs:Set[LatestSpec] = (res/Rec54.sameWorkAs/asRes.set).map(LatestSpec(_))
-
-  def replaces:Set[LatestSpec] = (res/Rec54.replaces/asRes.set).map(LatestSpec(_))
-
-}
-
-/*****************/
+import net.sf.saxon.s9api._
+import javax.xml.transform.stream.StreamSource
+import java.io._
+import java.net._
 
 class Test extends FunSuite {
 
-  test("") {
-
-    // implicit val model:Model = Model("src/test/resources/all.rdf", "http://www.w3.org")
-
-    implicit val model:Model = Model("/home/betehess/W3C/WWW/2006/07/home/wire/history/all.rdf", "http://www.w3.org")
-
-    val service = SpecService(model)
-
-    val ignore = Set("http://www.w3.org/TR/SRML", "http://www.w3.org/TR/EGIX", "http://www.w3.org/TR/SMIL2-AuthExt/", "http://www.w3.org/TR/XAdES/", "http://www.w3.org/TR/XIndirect", "http://www.w3.org/TR/chips", "http://www.w3.org/TR/cuap", "http://www.w3.org/TR/odrl", "http://www.w3.org/TR/photo-rdf/", "http://www.w3.org/TR/wsci", "http://www.w3.org/TR/xmcl/", "http://www.w3.org/TR/xup/", "http://www.w3.org/TR/WCAG20/checklist.html", "http://www.w3.org/TR/WCAG20/checklist-linear.html") map { x => Spec(Res(x)) }
-
-    val formers = Sparql selectAllX asString where( ('spec, Rec54.formerShortname, X) ) from model
-
-    val obsoletes = Sparql selectAllX asRes where( ('spec, Doc.obsoletes, X) ) from model map { Spec(_) }
-
-    val supersedes = Sparql selectAllX asRes where( ('spec, Rec54.supersedes, X) ) from model map { Spec(_) }
+  ResponseCache.setDefault(URLResolver("/home/betehess/W3C"))
 
-    val sameWorkAs = Sparql selectAllX asRes where( ('spec, Rec54.sameWorkAs, X) ) from model map { Spec(_) }
+  ("") {
 
-    val specs = (Sparql selectAllX asRes where( (X, DC.date, 'date) ) from model map { Spec(_) })
-		.filterNot { obsoletes contains _ }
-    		.filterNot { supersedes contains _ }
-    		.filterNot { sameWorkAs contains _ }
-    		.filterNot { ignore contains _ }
-    		// I don't see any rec:replaces in all.rdf!!!
-     		.filterNot { _ hasFormerShortname formers }
-
-    // *[dc:date and not(@rdf:about=$obs)
-    //   and not(doc:versionOf/@rdf:resource=$super)
-    //   and not(substring-after(doc:versionOf/@rdf:resources,'http://www.w3.org/TR/')=$former)
-    //   and not(doc:versionOf/@rdf:resource=$samework)
-    //   and not(doc:versionOf/@rdf:resource=$ignore)
-    //   and not(doc:versionOf/@rdf:resource=$replaces)]
-
-    // val latestspecs:Map[Set[LatestSpec], Set[Spec]] = Map[Set[LatestSpec], Set[Spec]]() ++ ( specs map { x:Spec => (x.versionOf -> x) } )
+    // Transform.main(Array("-s:http://www.w3.org/TR/2011/CR-WOFF-20110804/",
+    //                      "-xsl:http://www.w3.org/2001/10/trdoc2rdf.xslt",
+    //                      "-o:/tmp/toto.xml"))
 
 
-    // for(spec <- latestspecs ; if spec._1.size != 1) println(spec)
 
+    val s = "http://www.w3.org/TR/2011/CR-WOFF-20110804/"
+    val xsl = "http://www.w3.org/2001/10/trdoc2rdf.xslt"
+    val o = "/tmp/toto2.xml"
+
+    val proc:Processor = new Processor(false)
+    val comp:XsltCompiler = proc.newXsltCompiler()
+    val xsltStreamSource = new StreamSource(new URL(xsl).openStream())
+    xsltStreamSource.setSystemId(xsl)
+    val exp:XsltExecutable = comp.compile(xsltStreamSource)
+    val source:XdmNode = proc.newDocumentBuilder().build(new StreamSource(new URL(s).openStream()))
+    val out:Serializer = new Serializer()
+    out.setOutputProperty(Serializer.Property.METHOD, "html")
+    out.setOutputProperty(Serializer.Property.INDENT, "yes")
+    out.setOutputFile(new File(o))
+    val trans:XsltTransformer = exp.load()
+    trans.setInitialContextNode(source)
+    trans.setDestination(out)
+    trans.transform()
+
+    println("Output written to books.html")
+
+    1
   }
 
 }
--- a/src/test/scala/XMLTest.scala	Thu Aug 04 14:45:02 2011 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-package org.w3.util.xml
-
-import org.scalatest.FunSuite
-
-class XMLTest extends FunSuite {
-
-  test("xpath requests") {
-
-    val document = Node.htmlNode("file://src/test/resources/WD-xmldsig-properties-20100204.html")
-
-    assert(document.evaluateSingle("//html:h2") isDefined)
-
-    assert(document.evaluate("//html:h2").length > 1)
-
-  }
-
-}
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.