类 CollisionSystem


  • public class CollisionSystem
    extends java.lang.Object
    The CollisionSystem class represents a collection of particles moving in the unit box, according to the laws of elastic collision. This event-based simulation relies on a priority queue.

    For additional documentation, see Section 6.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.

    • 构造器概要

      构造器 
      构造器 说明
      CollisionSystem​(Particle[] particles)
      Initializes a system with the specified collection of particles.
    • 方法概要

      修饰符和类型 方法 说明
      static void main​(java.lang.String[] args)
      Unit tests the CollisionSystem data type.
      void simulate​(double limit)
      Simulates the system of particles for the specified amount of time.
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • CollisionSystem

        public CollisionSystem​(Particle[] particles)
        Initializes a system with the specified collection of particles. The individual particles will be mutated during the simulation.
        参数:
        particles - the array of particles
    • 方法详细资料

      • simulate

        public void simulate​(double limit)
        Simulates the system of particles for the specified amount of time.
        参数:
        limit - the amount of time
      • main

        public static void main​(java.lang.String[] args)
        Unit tests the CollisionSystem data type. Reads in the particle collision system from a standard input (or generates N random particles if a command-line integer is specified); simulates the system.
        参数:
        args - the command-line arguments