Class QueueNetAnimation

All Implemented Interfaces:
Animation, ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
OptimizedQNAnimation, SampleQNAnimation

public class QueueNetAnimation extends JPanel implements Animation
Created by IntelliJ IDEA. User: orsotronIII Date: 17-gen-2005 Time: 13.07.50 To change this template use Options | File Templates.
See Also:
  • Field Details

  • Constructor Details

    • QueueNetAnimation

      public QueueNetAnimation()
      Creates a new instance of QueueNetAnimation.
    • QueueNetAnimation

      public QueueNetAnimation(IconsToolkit toolkit)
      Creates a new instance of QueueNetAnimation with a customized toolkit for renderization of the queuenet background.
  • Method Details

    • refresh

      public void refresh()
      Description copied from interface: Animation
      Called when an animation needs to be refreshed. This method should update image currently handled by the animation
      Specified by:
      refresh in interface Animation
    • update

      public void update(Graphics g)
      Updates the image shown during animation, e.g. calls paint() method in every queue net element's implementing class contained in this queue net.
      Overrides:
      update in class JComponent
      Parameters:
      g - : Graphics object used to repaint image.
    • init

      public void init()
      Description copied from interface: Animation
      Initialization method for implementing class. The implementation of this method should prepare images for the animation, if this has not been done within constructor.
      Specified by:
      init in interface Animation
    • paint

      public void paint(Graphics g, ImageObserver io)
      Description copied from interface: Animation
      Paints image currently handled in a rectangle defined within Animation.setBounds(Rectangle) method
      Specified by:
      paint in interface Animation
    • getBGImage

      public Image getBGImage()
      Description copied from interface: Animation
      returns background image for this animation.
      Specified by:
      getBGImage in interface Animation
      Returns:
      :Background image for this animation
    • setBGImage

      public void setBGImage(Image img)
      Description copied from interface: Animation
      sets background image for this animation.
      Specified by:
      setBGImage in interface Animation
      Parameters:
      img - : background image for this animation
    • addStation

      public void addStation(StationAnimation station)
      Adds a station to this queue net.
      Parameters:
      station - : station to be added to this queuenet
    • addEdge

      public void addEdge(EdgeAnimation edge, StationAnimation source, StationAnimation target)
      Adds an edge between two stations of this queuenet.
      Parameters:
      edge - : new edge to be added.
      source - : source station for this edge.
      target - : target station for this edge.
    • addJob

      public void addJob(JobAnimation jobAnimation, JobContainer startingPoint)
      Adds a job to be routed through this queue net.
      Parameters:
      jobAnimation - : job to be added.
      startingPoint - : queue net element from which this job should start its path.
    • getSuccessors

      public JobContainer[] getSuccessors(JobContainer precedant)
      Returns a list of successor nodes for the specified one.
      Parameters:
      precedant - : current node
      Returns:
      list of nodes which are successors of the current one.
    • getSinglePath

      public JobPath getSinglePath(StationAnimation start, StationAnimation end)
      Returns a possible path for this queue net, which must start from start station and end in end station. If there's no path that links this two stations, then null value is returned. This is useful in case a job is wanted to run on certain edges and stations and not on all. This method is not optimized to search for the shortest path, so it will find the first valid path available.
      Parameters:
      start - : starting point for this path.
      end - : ending point for this path.
      Returns:
      a possible path between start and end stations, or null if does not exist.