Re: How can I define a class in stella, use it in Powerloom

Thomas Russ <[email protected]> Fri, 23 Mar 2007 10:06:25 -0700
Newsgroups gmane.comp.ai.powerloom
Message-ID <[email protected]>
On Mar 22, 2007, at 7:34 PM, hui wangh wrote:

> hello,
>       I find in stella STRING is a CLASS, not is a THING, but is  
> can be use in Powerloom.
> how can I define a class in stella, use it in Powerloom, and it not  
> a subclass of THING?

Yes, that is handled by special purpose code in PowerLoom.

>
>      I try to extend data type of Powerloom (for example:   
> BigDecimal), how should I do it?

We have some support for doing things like that, although
a full generic interface has not been completed yet.  (It's
something I want to do, but I don't see having any time for
it in the near future).

What has been done is that there is a base class for Quantity
items and for quantity-logic-wrappers that can be used.  Since
you would need to create a new subclass of Quantity, you can't
directly use something like Java's BigDecimal, but you could
use it indirectly by wrapping the native Java object in your
own subclass of Stella's Quantity.

Equality and inequality reasoning support is present and will
allow you to use the standard <, =<, etc. operations for new
quantity items.  Arithmetic is not yet upgraded (partly because
of the use of constraints rather than simple functions), so
you would have to use your own methods for doing that.

To see an example of how this is done, you can take a look
at the timepoint or units extensions to PowerLoom.

If you have very detailed questions, it would be best to
contact myself ([email protected]) or Hans Chalupsky ([email protected])
directly.

-Tom Russ
--
Thomas A. Russ, Ph.D.  Senior Research Scientist             [email protected]
USC/Information Sciences Institute              WWW:  http://www.isi.edu
4676 Admiralty Way, Marina del Rey, CA 90292              (310) 448-8775