Recent Changes - Search:




edit SideBar


This document describes the design of the tauzaman.temporaldatatypes and tauzaman.timestamp packages.

The following sections outline each of the major pieces of the design and give a rationale as to the importance of each. The design has been implemented and is in the public domain.


The TimeValue class is an implementation of a set of primitive operations on time-values from some underlying temporal domain. The domain could be bounded or unbounded, discrete or continuous, etc. The TimeValue class has a minimal set of operations on TimeValues needed to support higher-level, richer semantics. The class permits a complete encapsulation of the domain-dependent code. We implemented a discrete, unbounded domain with two special values (effectively the integers plus Beginning and Ending of Time, the latter two values have special semantics). The domain is unbounded since it uses Java's built-in BigInteger class (which does not limit the size of integers).


A Granule is the basic unit of Time. A determinate Granule is a TimeValue and a Granularity. An indeterminate Granule is a pair of TimeValues, to represent the lower and upper bounds, and a Granularity. A NowRelativeGranule is a TimeValue, which represents a displacement from now, and a Granularity.


An Instant is a single Granule. The Granule is anchored to the time-line and represents the distance from the granularity anchor point.


An Instant is a single Granule.


The DeterminateSemantics interface defines a set of basic operations that should be supported by a normal semantics for temporal data types. The IndeterminateSemantics interface defines a set of basic operations for indeterminate data types. The general idea behind the Semantics interface is to abstract the operations on temporal entities. Such operations have a variety of meanings or interpretations. Each implementation of the Semantics interface imbues temporal operations with a different meaning. For example, a Semantics should support an operation that determines whether one instant precedes another. For the purpose of this example, we will assume that an instant is represented as a point on an underlying discrete time-line. Several alternative semantics for this simple operation

LeftOperandSemantics casts the second operand to the granularity of the first operand in all operations. Here is an example using the LeftOperandSemantics.

  Instant i = new Instant("Jan 1, 2002");
  Instant j = new Instant("Jan 2, 2002");
  Interval k = new Interval("1 day");
  // A Semantics is a set of operations
  DeterminateSemantics ops = new LeftOperandSemantics();

  // Compare two instants
  if (ops.precedes(i,j)) {....}

  // Add an interval and an instant
  Instant t = ops.add(i, k);

Note that to change to a different semantics for the operations, all we have to do is change one line, e.g.,

  // Scale to the coarser operands
  DeterminateSemantics ops = new CoarserOperandSemantics();

All the other code remains exactly the same. This design also accommodates Indeterminacy through extension of the IndeterminateSemantics Interface. The IndeterminateSemantics changes boolean operations to use the ExtendedBoolean class (for three-valued logic). It also has operations to set the plausibility and credibility for the Semantics. Using an indeterminate semantics will require minimal contortions for the user.

  Instant i = new Instant("Jan 1, 2002 ~ Jan 4, 2002");
  Instant j = new Instant("Jan 2, 2002 ~ Jan 13, 2002");
  Interval k = new Interval("1 ~ 5 days");
  // An IndeterminateSemantics 
  IndeterminateSemantics ops = new LeftOperandIndeterminateSemantics();

  // Carry out the operations at a plausibility of 60

  // Compare two instants
  ExtendedBoolean cond = ops.precedes(i,j);
  if (cond.satisfied()) {...}

  // Add an interval and an instant
  Interval t = ops.add(i, k);

On the user's side, several lines change, one to establish the new semantics, one to set the plausibility, and one to handle ExtendedBoolean values. But the temporal data types remain the same.


The ExtendedBoolean class encapsulates boolean operations on some underlying multi-valued domain. It currently implements a 3-valued domain.

Edit - History - Print - Recent Changes - Search
Page last modified on April 07, 2009, at 10:15 PM