Documentation of 'edu.princeton.cs.algs4.CollisionSystem' Java class
CollisionSystem
edu.princeton.cs.algs4

Class 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.

    • Constructor Summary

      Constructors 
      Constructor and Description
      CollisionSystem(Particle[] particles)
      Initializes a system with the specified collection of particles.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      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.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CollisionSystem

        public CollisionSystem(Particle[] particles)
        Initializes a system with the specified collection of particles. The individual particles will be mutated during the simulation.
        Parameters:
        particles - the array of particles
    • Method Detail

      • simulate

        public void simulate(double limit)
        Simulates the system of particles for the specified amount of time.
        Parameters:
        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.
        Parameters:
        args - the command-line arguments

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.