Class ContextPhysics<T>

All Implemented Interfaces:
ContextListener<T>, ContinuousSpace<T>, PhysicsSpace<T>, Projection<T>

public class ContextPhysics<T> extends DefaultPhysicsSpace<T> implements ContextListener<T>
Default implementation of an n-dimensional continuous space.
  • Constructor Details

    • ContextPhysics

      public ContextPhysics(String name, ContinuousAdder<T> adder, PointTranslator translator, double xdim, double ydim, double zdim)
      Constructs this space with the specified name, adder, translator, accessor and size. The size is the size of the space meaning [3, 3] is a 3x3 space.
      Parameters:
      name - the name of the space
      size - the dimensions of the space
    • ContextPhysics

      public ContextPhysics(String name, ContinuousAdder<T> adder, PointTranslator translator, double[] size, double[] origin)
      Constructs this space with the specified name, adder, translator, accessor and size. The size is the size of the space meaning [3, 3] is a 3x3 space.
      Parameters:
      name - the name of the space
      size - the dimensions of the space
      origin - the origin of the space
  • Method Details

    • eventOccured

      public void eventOccured(ContextEvent<T> evt)
      If the event is an add this will put the object at the (0, 0, ..., 0) location. If it is a remove it will remove the object from its location map.
      Specified by:
      eventOccured in interface ContextListener<T>
      Parameters:
      evt - a ContextEvent that occurred to the context this is a part of
    • addFromContext

      protected void addFromContext(T t)
    • addAll

      protected void addAll(Context<T> context)