Package org.jmanikin.core
Interface World<W extends World<W>>
- Type Parameters:
W- The concrete World type
- All Known Subinterfaces:
Value<W,V>
- All Known Implementing Classes:
SimpleWorld,Value.ValueImpl
public interface World<W extends World<W>>
A World is a 'memory' for (old) Objects and the entry point for sending Messages to Objects.
But specific Worlds can do much more than that. They could:
- Log all Messages sent
- Capture the history of Object states
- Synchronize state between concurrent Worlds
- Capture runtime dependencies between Object states and Messages
- etc, etc
See SimpleWorld for an example implementation.
-
Method Summary
Modifier and Type Method Description Winit()Returns a pristine new World of type W<O> Value<W,O>obj(Id<? extends O> id)Returns the current Object O value, given an id.<O> Value<W,O>old(Id<? extends O> id)Returns the old Object O value, given an id.<I extends Id<O>, O, E>
Value<W,E>send(I id, Message<I,O,E> msg)Returns the effect Value E, after sending a Message to Object O, given an Object identifier.
-
Method Details
-
obj
Returns the current Object O value, given an id.- Type Parameters:
O- the Object type- Parameters:
id- the Object Id- Returns:
- the current Object O, wrapped in a Value
-
old
Returns the old Object O value, given an id.- Type Parameters:
O- the Object type- Parameters:
id- the Object Id- Returns:
- the current Object O, wrapped in a Value
-
send
Returns the effect Value E, after sending a Message to Object O, given an Object identifier.- Type Parameters:
I- the Id TypeO- the Object TypeE- the Effect Type- Parameters:
id- the Object identifier to send the Message tomsg- the message to send to the Object- Returns:
- the effect of the Message send, wrapped in a Value
-
init
W init()Returns a pristine new World of type W- Returns:
- a pristine new World
-