Class SimpleWorld

java.lang.Object
org.jmanikin.world.SimpleWorld
All Implemented Interfaces:
World<SimpleWorld>

public class SimpleWorld
extends java.lang.Object
implements World<SimpleWorld>

A SimpleWorld provides a (mutable!) World implementation that still conforms to Manikin's minimum semantics.

Because SimpleWorld is not immutable you cannot share it between multiple Threads.

WARNING: NOT THREAD SAFE

  • Constructor Summary

    Constructors
    Constructor Description
    SimpleWorld()  
  • Method Summary

    Modifier and Type Method Description
    SimpleWorld init()
    Returns a pristine new World of type W
    <O> Value<SimpleWorld,​O> obj​(Id<? extends O> id)
    Returns the current Object O value, given an id.
    <O> Value<SimpleWorld,​O> old​(Id<? extends O> id)
    Returns the old Object O value, given an id.
    <I extends Id<O>,​ O,​ E>
    Value<SimpleWorld,​E>
    send​(I id, Message<I,​O,​E> message)
    Returns the effect Value E, after sending a Message to Object O, given an Object identifier.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SimpleWorld

      public SimpleWorld()
  • Method Details

    • obj

      public <O> Value<SimpleWorld,​O> obj​(Id<? extends O> id)
      Description copied from interface: World
      Returns the current Object O value, given an id.
      Specified by:
      obj in interface World<SimpleWorld>
      Type Parameters:
      O - the Object type
      Parameters:
      id - the Object Id
      Returns:
      the current Object O, wrapped in a Value
    • old

      public <O> Value<SimpleWorld,​O> old​(Id<? extends O> id)
      Description copied from interface: World
      Returns the old Object O value, given an id.
      Specified by:
      old in interface World<SimpleWorld>
      Type Parameters:
      O - the Object type
      Parameters:
      id - the Object Id
      Returns:
      the current Object O, wrapped in a Value
    • send

      public <I extends Id<O>,​ O,​ E> Value<SimpleWorld,​E> send​(I id, Message<I,​O,​E> message)
      Description copied from interface: World
      Returns the effect Value E, after sending a Message to Object O, given an Object identifier.
      Specified by:
      send in interface World<SimpleWorld>
      Type Parameters:
      I - the Id Type
      O - the Object Type
      E - the Effect Type
      Parameters:
      id - the Object identifier to send the Message to
      message - the message to send to the Object
      Returns:
      the effect of the Message send, wrapped in a Value
    • init

      public SimpleWorld init()
      Description copied from interface: World
      Returns a pristine new World of type W
      Specified by:
      init in interface World<SimpleWorld>
      Returns:
      a pristine new World