J avolution v5.2 (J2SE 1.5+)

javolution.lang
Interface Realtime

All Known Implementing Classes:
FastCollection, FastList, FastMap, FastSet, FastTable, Text, TextBuilder

public interface Realtime

This interface identifies RTSJ safe classes with predictable response time and supporting custom allocation policies (e.g.  "stack" allocations).

Instances of this class are typically created through an ObjectFactory. For example:

         public final class Complex implements Realtime, ValueType {
             private double _real;
             private double _imaginary;
             private static ObjectFactory<Complex> FACTORY = new ObjectFactory() {
                 protected Complex create() { return new Complex(); }
             }
             private Complex() { }
             public static Complex valueOf(double real, double imaginary) {
                Complex c = FACTORY.object(); 
                c._real = real;
                c._imaginary = imaginary;
                return c;
             }
             public Complex copy() {
                 return Complex.valueOf(_real, _imaginary);
             }
             public Text toText() {
                 return Text.valueOf(_real).plus(" + ")
                     .plus(Text.valueOf(_imaginary).plus("i")); 
             }
         }

It should be noted that classes with no static reference field or with only static final immutable fields are always RTSJ safe. Such classes may implement this interface and be used while running in scoped memory (RTSJ) or non-heap allocators (Javolution).

Version:
5.0, May 6, 2007
Author:
Jean-Marie Dautelle

Method Summary
 Text toText()
          Returns the textual representation of this real-time object (equivalent to toString except that the returned value can be "stack" allocated and supports fast concatenation).
 

Method Detail

toText

Text toText()
Returns the textual representation of this real-time object (equivalent to toString except that the returned value can be "stack" allocated and supports fast concatenation).

Returns:
this object's textual representation.

J avolution v5.2 (J2SE 1.5+)

Copyright © 2005 - 2007 Javolution.