View Javadoc

1   /* Open Log Viewer
2    *
3    * Copyright 2011
4    *
5    * This file is part of the OpenLogViewer project.
6    *
7    * OpenLogViewer software is free software: you can redistribute it and/or modify
8    * it under the terms of the GNU General Public License as published by
9    * the Free Software Foundation, either version 3 of the License, or
10   * (at your option) any later version.
11   *
12   * OpenLogViewer software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public License
18   * along with any OpenLogViewer software.  If not, see http://www.gnu.org/licenses/
19   *
20   * I ask that if you make any changes to this file you fork the code on github.com!
21   *
22   */
23  package org.diyefi.openlogviewer.coloring;
24  
25  import java.awt.Color;
26  
27  /**
28   * MarkedColor is a couplet used to allow the marking of colors as "unavailable" or "available".
29   * @author Ben Fenner
30   */
31  public class MarkedColor {
32  	private Color color;
33  	private boolean availability;
34  	private double hue;
35  
36  	public MarkedColor() {
37  		color = Color.gray;
38  		availability = true;
39  		hue = -1.0;
40  	}
41  
42  	public MarkedColor(final Color color) {
43  		this.color = color;
44  		availability = true;
45  		hue = -1.0;
46  	}
47  
48  	public MarkedColor(final boolean availability) {
49  		color = Color.gray;
50  		this.availability = availability;
51  		hue = -1.0;
52  	}
53  
54  	public MarkedColor(final Color color, final boolean availability) {
55  		this.color = color;
56  		this.availability = availability;
57  		hue = -1.0;
58  	}
59  
60  	public MarkedColor(final Color color, final boolean availability, final double hue) {
61  		this.color = color;
62  		this.availability = availability;
63  		this.hue = hue;
64  	}
65  
66  	public final Color getColor() {
67  		return color;
68  	}
69  
70  	public final void setColor(final Color color) {
71  		this.color = color;
72  	}
73  
74  	public final boolean isAvailable() {
75  		return availability;
76  	}
77  
78  	public final void setAvailability(final boolean availability) {
79  		this.availability = availability;
80  	}
81  
82  	public final double getHue() {
83  		return hue;
84  	}
85  
86  	public final void setHue(final double hue) {
87  		this.hue = hue;
88  	}
89  
90  	public final boolean equals(final MarkedColor c) {
91  		return c.getColor().equals(this.color) || c.getHue() == this.hue;
92  	}
93  
94  	public final boolean equals(final Color c) {
95  		return c.equals(this.color);
96  	}
97  }