|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectutil.grid.Placeable
public class Placeable
Lightweight representation of a figure placeable in Cartesian coordinates. Implementations can occupy multiple locations by providing an immutable pattern of occupancy around the pivot.
Field Summary | |
---|---|
static long |
serialVersionUID
|
Constructor Summary | |
---|---|
Placeable(Placeable placeable)
Constructs a deep duplicate of a placeable. |
|
Placeable(Point anchor,
Orientation facedOrientation)
Constructor for a placeable that occupies a single location. |
Method Summary | |
---|---|
boolean |
contains(Point loc)
Returns if this contains a given location. |
HashSet<Point> |
getOccupied()
Provides positions currently occupied. |
Orientation |
getOrientation()
Provides the direction being faced. |
HashSet<Point> |
getPattern(Orientation ori)
Provides the pattern used to construct occupied positions. |
Point |
getPivot()
Provides placeable's central position. |
Iterator<Point> |
iterator()
Provides an iterator over occupied locations with an unsupported removal method. |
void |
setOrientation(Orientation ori)
Sets the direction being faced. |
void |
setPivot(Point loc)
Sets the placeable's central position. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long serialVersionUID
Constructor Detail |
---|
public Placeable(Point anchor, Orientation facedOrientation)
anchor
- initial occupied locationfacedOrientation
- initial direction being facedpublic Placeable(Placeable placeable)
placeable
- placeable from which to duplicate attributesMethod Detail |
---|
public Point getPivot()
public void setPivot(Point loc)
loc
- new central position of the figurepublic Orientation getOrientation()
public void setOrientation(Orientation ori)
ori
- direction being faced
IllegalArgumentException
- if no pattern is available for the orientationpublic HashSet<Point> getPattern(Orientation ori)
ori
- orientation of pattern
public HashSet<Point> getOccupied()
public boolean contains(Point loc)
loc
- location to be checked
public Iterator<Point> iterator()
iterator
in interface Iterable<Point>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |