|
J avolution v5.5 (J2SE 1.6+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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).
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 |
---|
Text toText()
toString
except that the returned value
can be "stack"
allocated and
supports fast concatenation).
|
J avolution v5.5 (J2SE 1.6+) | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |