2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
7 package gov
.nasa
.worldwind
.geom
;
9 import gov
.nasa
.worldwind
.*;
13 * @version $Id: Intersection.java 510 2007-01-17 04:57:40Z ericdalgliesh $
15 public final class Intersection
// Instances are immutable
18 private final Point intersectionPoint
;
19 private final boolean isTangent
;
22 * @param intersectionPoint
24 * @throws IllegalArgumentException if <code>intersectionpoint</code> is null
26 public Intersection(Point intersectionPoint
, boolean isTangent
)
28 if (intersectionPoint
== null)
30 String message
= WorldWind
.retrieveErrMsg("nullValue.IntersectionPointIsNull");
31 WorldWind
.logger().log(java
.util
.logging
.Level
.FINE
, message
);
32 throw new IllegalArgumentException(message
);
34 this.intersectionPoint
= intersectionPoint
;
35 this.isTangent
= isTangent
;
38 public final Point
getIntersectionPoint()
40 return intersectionPoint
;
43 public final boolean isTangent()
49 public boolean equals(Object o
)
53 if (o
== null || getClass() != o
.getClass())
56 final gov
.nasa
.worldwind
.geom
.Intersection that
= (gov
.nasa
.worldwind
.geom
.Intersection
) o
;
58 if (isTangent
!= that
.isTangent
)
60 if (!intersectionPoint
.equals(that
.intersectionPoint
))
70 result
= intersectionPoint
.hashCode();
71 result
= 29 * result
+ (isTangent ?
1 : 0);
76 public String
toString()
78 String pt
= "Intersection Point: " + this.intersectionPoint
;
79 String tang
= this.isTangent ?
" is a tangent." : " not a tangent";