/**************************************************************************
* Copyright (c) 1996 Jim Crossley
*
* Although it's unlikely that anyone would actually want it,
* permission is hereby granted, without written agreement and
* without license or royalty fees, to use, copy, modify, and
* distribute this software and its documentation for any purpose,
* provided that the above copyright notice and the following three
* paragraphs appear in all copies of this software, its documentation
* and any derivative work.
*
* In no event shall Jim Crossley or Automated Design Systems, Inc. be
* liable to any party for direct, indirect, special, incidental, or
* consequential damages arising out of the use of this software and
* its documentation.
*
* The software provided hereunder is on an "as is" basis, and neither
* Jim Crossley nor Automated Design Systems, Inc. has any obligation
* to provide maintenance, support, updates, enhancements, or modifications.
*
* Derived or altered versions must be plainly marked as such, and
* must not be misrepresented as being the original software.
***************************************************************************/
package dots;

import java.awt.*;
import java.util.*;

/**
 * This class provides the objects that make up a DottedLine.
 * Their attributes include location, diameter, and color.
 *
 * @author Jim Crossley
 * @version 1.0, 10/17/1996
 */
class Dot {

    protected Point location;
    protected int diameter;
    protected Color color;

    /**
     * The constructor sets member variables.
     */
    public Dot(Point p, int d) {
        location = p;
        diameter = d;
        color = Color.black;
    }

    /**
     * Access method for member variable, <em>color</em>.
     */
    public void setColor(Color c) {
        color = c;
    }

    /**
     * Access method for member variable, <em>color</em>.
     */
    public Color getColor() {
        return color;
    }

    /**
     * Darkens the Dot's color.
     */
    public void fade() {
        color = color.darker();
    }

    /**
     * Draws the Dot using the Graphics parameter.  It will only draw the dot
     * if its color isn't black.
     */
    public void draw(Graphics g) {
        if (!color.equals(Color.black)) {
            g.setColor(color);
            g.fillOval(location.x, location.y, diameter, diameter);
        }
    }
}

