001    package breakout;
002    
003    import java.awt.*;
004    
005    /** Defines the contract for all BreakoutComponent objects. **/
006    public interface BreakoutComponent {
007            
008            /** Provides a way to set the location of this BreakoutComponent. **/
009            public void setLocation(Point p);
010            /** Provides a way to get the location of this BreakoutComponent. **/
011            public Point getLocation();
012            /** Provides a way to get the size of this BreakoutComponent. **/
013            public Dimension getSize();
014            
015            /** Called by World at the beginning of evey tick on all BreakoutComponents in a Board.  **/
016            public void update();
017            
018            /** Used in the rebound phase of a World tick.
019              * 
020              * <BR><BR>Objects that implement Rebounding will check the board to see if they intersect 
021              *  with anything.  If they do, they will call this method on the offending BreakoutComponent.
022              *  If the response is true, the BreakoutComponent should be removed from the Board.
023              *
024              * @param bc the BreakoutComponent that's doing the hitting.
025              * @return <code>true</code if this BreakoutComponent should be removed(die) once hit, false otherwise.
026            **/
027            public boolean hit(BreakoutComponent bc);
028            
029            /** Provides a way to get the java.awt.Shape of this BreakoutComponent, 
030              * generally for intersection and rebound checks.
031            **/
032            public Shape getShape();
033            
034            /** Provides a way to paint this BreakoutComponent. 
035              * Note that the upper-left hand corner of this component is at (0,0) according to the Graphics object
036              * passed to this method by BoardPanel.
037              *
038              * @see breakout.BoardPanel
039            **/
040            public void paint(Graphics g);
041    }