View Javadoc

1   /*
2    * Copyright 2007-2008 Volker Fritzsch
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License. 
15   */
16  package motej;
17  
18  import java.awt.Point;
19  
20  /**
21   * 
22   * <p>
23   * @author <a href="mailto:vfritzsch@users.sourceforge.net">Volker Fritzsch</a>
24   */
25  public class IrPoint extends Point {
26  
27  	private static final long serialVersionUID = -7473956039643032186L;
28  
29  	public int size;
30  	
31  	public Point max;
32  	
33  	public Point min;
34  	
35  	public int intensity;
36  
37  	public IrPoint() {
38  		this(0, 0);
39  	}
40  
41  	public IrPoint(int x, int y) {
42  		this(x, y, 1);
43  	}
44  
45  	public IrPoint(int x, int y, int size) {
46  		this(x, y, size, x, y, x, y, 1);
47  	}
48  	
49  	public IrPoint(int x, int y, int size, int xmin, int ymin, int xmax, int ymax, int intensity) {
50  		this(x, y, size, new Point(xmin, ymin), new Point(xmax, ymax), intensity);
51  	}
52  	
53  	public IrPoint(int x, int y, int size, Point min, Point max, int intensity) {
54  		this.x = x;
55  		this.y = y;
56  		this.size = size;
57  		this.max = max;
58  		this.min = min;
59  		this.intensity = intensity;
60  	}
61  
62  	public IrPoint(IrPoint p) {
63  		this.x = p.x;
64  		this.y = p.y;
65  		this.size = p.size;
66  		this.max = p.max;
67  		this.min = p.min;
68  		this.intensity = p.intensity;
69  	}
70  
71  	@Override
72  	public boolean equals(Object obj) {
73  		if (obj == this)
74  			return true;
75  		if (obj instanceof IrPoint) {
76  			IrPoint p = (IrPoint) obj;
77  			return (x == p.x) && (y == p.y) && (size == p.size) && 
78  				(max.x == p.max.x) && (max.y == p.max.y) &&
79  				(min.x == p.min.x) && (min.y == p.min.y) &&
80  				(intensity == p.intensity);
81  		}
82  		return super.equals(obj);
83  	}
84  
85  	public int getSize() {
86  		return size;
87  	}
88  
89  	@Override
90  	public int hashCode() {
91  		int hash = 17;
92  		hash = hash * 31 + x;
93  		hash = hash * 31 + y;
94  		hash = hash * 31 + size;
95  		hash = hash * 31 + max.x;
96  		hash = hash * 31 + max.y;
97  		hash = hash * 31 + min.x;
98  		hash = hash * 31 + min.y;
99  		hash = hash * 31 + intensity;
100 		return hash;
101 	}
102 
103 	public void setSize(int size) {
104 		this.size = size;
105 	}
106 
107 	public Point getMax() {
108 		return max;
109 	}
110 
111 	public void setMax(Point max) {
112 		this.max = max;
113 	}
114 
115 	public Point getMin() {
116 		return min;
117 	}
118 
119 	public void setMin(Point min) {
120 		this.min = min;
121 	}
122 
123 	public int getIntensity() {
124 		return intensity;
125 	}
126 
127 	public void setIntensity(int intensity) {
128 		this.intensity = intensity;
129 	}
130 
131 }