public class WorldObjectList<ObjectType extends WorldObject> extends Object implements Iterable<ObjectType>
Constructor and Description |
---|
WorldObjectList() |
Modifier and Type | Method and Description |
---|---|
void |
add(ObjectType newObject)
Adds a new object to the list if it is not already present
|
void |
clear()
Clears all objects from the list
|
boolean |
contains(ObjectType testObject)
Returns true if the List contains the specified object
|
ObjectType |
get(int index)
Returns a reference to a specified object from the world model
|
boolean |
isClearPath(double[] end1,
double[] end2)
Determines whether or not a line segment encroaches into any
of the objects in the list
|
boolean |
isClearPath(double x1,
double y1,
double x2,
double y2)
Determines whether or not a line segment encroaches into any
of the objects in the list
|
boolean |
isClearPath(LineSegment segment)
Determines whether or not a line segment encroaches into any
of the objects in the list
|
boolean |
isClearPath(Point end1,
Point end2)
Determines whether or not a line segment encroaches into any
of the objects in the list
|
boolean |
isClearPoint(double[] point)
Determines whether or not a point encroaches on any
of the objects in the list
|
boolean |
isClearPoint(double x,
double y)
Determines whether or not a point encroaches on any
of the objects in the list
|
boolean |
isClearPoint(Point point)
Determines whether or not a point encroaches on any
of the objects in the list
|
Iterator<ObjectType> |
iterator()
Implements the Iterable interface
|
ObjectType |
remove(int index)
Removes a stationary object from the world model
|
boolean |
remove(ObjectType toRemove)
Removes a stationary object from the world model
|
int |
size() |
String |
toString()
Generates a string representation of the wall object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Iterator<ObjectType> iterator()
iterator
in interface Iterable<ObjectType extends WorldObject>
public void clear()
public void add(ObjectType newObject)
newObject
- public ObjectType get(int index)
index
- the object to be removedpublic ObjectType remove(int index)
index
- index of the object to be removedpublic boolean remove(ObjectType toRemove)
toRemove
- the object to be removedpublic boolean contains(ObjectType testObject)
testObject
- public int size()
public boolean isClearPoint(double[] point)
point
- public boolean isClearPoint(Point point)
point
- public boolean isClearPoint(double x, double y)
x
- the x coordinate of the point being testedy
- the y coordinate of the point being testedpublic boolean isClearPath(LineSegment segment)
segment
- public boolean isClearPath(Point end1, Point end2)
end1
- the first end point of the segmentend2
- the second end point of the segmentpublic boolean isClearPath(double[] end1, double[] end2)
end1
- the first end point of the segmentend2
- the second end point of the segmentpublic boolean isClearPath(double x1, double y1, double x2, double y2)
x1
- coordinate for the first end point of the segmenty1
- coordinate for the first end point of the segmentx2
- coordinate for the second end point of the segmenty2
- coordinate for the second end point of the segment