public final class SubdivisionElement
extends java.lang.Object
Subdivision
.
Immutable class containing either an Subdivision.edges()
, Subdivision.faces()
,
Subdivision.vertices()
element of a planar Subdivision
. A
SubdivisionElementType
value indicates which element type is present.Modifier and Type | Field and Description |
---|---|
java.lang.Object |
content
The actual
Subdivision element stored in the SubdivisionElement . |
static SubdivisionElement |
NULL_FACE
|
SubdivisionElementType |
type
The
SubdivisionElementType of the SubdivisionElement . |
Constructor and Description |
---|
SubdivisionElement(PointD vertex)
Creates a
SubdivisionElement of type SubdivisionElementType.VERTEX
with the specified PointD vertex. |
SubdivisionElement(SubdivisionEdge edge)
Creates a
SubdivisionElement of type SubdivisionElementType.EDGE
with the specified SubdivisionEdge . |
SubdivisionElement(SubdivisionFace face)
Creates a
SubdivisionElement of type SubdivisionElementType.FACE
with the specified SubdivisionFace . |
Modifier and Type | Method and Description |
---|---|
SubdivisionEdge |
edge()
Gets the
SubdivisionEdge stored in the SubdivisionElement . |
boolean |
equals(java.lang.Object obj)
Compares the specified
Object to this SubdivisionElement instance. |
SubdivisionFace |
face()
Gets the
SubdivisionFace stored in the SubdivisionElement . |
int |
hashCode()
Returns a hash code for the
SubdivisionElement . |
boolean |
isUnboundedFace()
Indicates whether the
SubdivisionElement represents an unbounded SubdivisionFace . |
java.lang.String |
toString()
Returns a
String representation of the SubdivisionElement . |
PointD |
vertex()
Gets the
PointD vertex stored in the SubdivisionElement . |
public static final SubdivisionElement NULL_FACE
SubdivisionElement
of type SubdivisionElementType.FACE
whose face()
is null
.
By convention, NULL_FACE
represents the unbounded face of a planar
Subdivision
. Use isUnboundedFace()
to test for this condition,
as well as for the actual unbounded SubdivisionFace
.public final java.lang.Object content
Subdivision
element stored in the SubdivisionElement
.
Contains either a SubdivisionEdge
, a SubdivisionFace
, or a PointD
vertex. Use edge()
, face()
and vertex()
for type-safe access.public final SubdivisionElementType type
public SubdivisionElement(SubdivisionEdge edge)
SubdivisionElement
of type SubdivisionElementType.EDGE
with the specified SubdivisionEdge
.edge
- the SubdivisionEdge
to storejava.lang.NullPointerException
- if edge
is null
public SubdivisionElement(SubdivisionFace face)
SubdivisionElement
of type SubdivisionElementType.FACE
with the specified SubdivisionFace
.
face
may be null
to represent an unbounded face,
see NULL_FACE
and isUnboundedFace()
.face
- the SubdivisionFace
to storepublic SubdivisionElement(PointD vertex)
SubdivisionElement
of type SubdivisionElementType.VERTEX
with the specified PointD
vertex.vertex
- the PointD
vertex to storejava.lang.NullPointerException
- if vertex
is null
public SubdivisionEdge edge()
SubdivisionEdge
stored in the SubdivisionElement
java.lang.IllegalStateException
- if type
does not equal SubdivisionElementType.EDGE
public SubdivisionFace face()
SubdivisionFace
stored in the SubdivisionElement
.
May return null
to represent an unbounded face,
see NULL_FACE
and isUnboundedFace()
.SubdivisionFace
stored in the SubdivisionElement
java.lang.IllegalStateException
- if type
does not equal SubdivisionElementType.FACE
public boolean isUnboundedFace()
SubdivisionElement
represents an unbounded SubdivisionFace
.
The unbounded face of a planar Subdivision
may be represented by NULL_FACE
or by a valid SubdivisionFace
whose SubdivisionFace.key()
is zero.
isUnboundedFace()
tests for both conditions.true
if type
is SubdivisionElementType.FACE
and face()
is null
or its SubdivisionFace.key()
is zero, else false
public PointD vertex()
PointD
vertex stored in the SubdivisionElement
java.lang.IllegalStateException
- if type
does not equal SubdivisionElementType.VERTEX
public boolean equals(java.lang.Object obj)
Object
to this SubdivisionElement
instance.equals
in class java.lang.Object
obj
- the Object
to compare to this instancetrue
if obj
is not null
and a SubdivisionElement
instance
whose type
and content
equal those of this instance, else false
public int hashCode()
SubdivisionElement
.hashCode
in class java.lang.Object
Integer
hash code for the SubdivisionElement
public java.lang.String toString()
String
representation of the SubdivisionElement
.