java.lang.Object | |
↳ | sofia.graphics.ShapeFilter<ShapeType extends sofia.graphics.Shape> |
TODO: document.
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ShapeFilter(ShapeFilter<? super ShapeType> previous, String descriptionOfConstraint)
Create a new Filter object.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ShapeSet<ShapeType> |
all()
Returns the set of all shapes matched by this filter.
| ||||||||||
ShapeType |
back()
Gets the shape that is farthest in the background that matches this
filter.
| ||||||||||
int |
count()
Gets the number of shapes matched by this filter.
| ||||||||||
String |
description()
Get a human-readable description of this filter.
| ||||||||||
boolean |
equals(Object other)
Determine whether this object is equal to the another.
| ||||||||||
boolean |
exist()
Returns true if any shapes were matched by this filter.
| ||||||||||
ShapeType |
front()
Gets the shape that is farthest in the foreground that matches this
filter.
| ||||||||||
int | hashCode() | ||||||||||
ShapeFilter<ShapeType> |
intersecting(RectF bounds)
Restrict this filter to only match shapes that intersect the specified
rectangle.
| ||||||||||
ShapeFilter<ShapeType> |
intersecting(float left, float top, float right, float bottom)
Restrict this filter to only match shapes that intersect the specified
rectangle.
| ||||||||||
boolean |
isEmpty()
Returns true if no shapes were matched by this filter.
| ||||||||||
Iterator<ShapeType> |
iterator()
Gets an iterator over all shapes matched by this filter.
| ||||||||||
ShapeFilter<ShapeType> |
locatedAt(PointF point)
Restrict this filter to only match shapes that occupy the specified
point.
| ||||||||||
ShapeFilter<ShapeType> |
locatedAt(float x, float y)
Restrict this filter to only match shapes that occupy the specified
point.
| ||||||||||
ShapeFilter<ShapeType> |
locatedWithin(PointF point, float radius)
Restrict this filter to only match shapes that are located within the
specified radius of a point.
| ||||||||||
ShapeFilter<ShapeType> |
locatedWithin(float x, float y, float radius)
Restrict this filter to only match shapes that are located within the
specified radius of a point.
| ||||||||||
ShapeSet<ShapeType> |
remove()
Removes all of the shapes matched by this filter from the field they are
in, and returns the set of those shapes.
| ||||||||||
String |
toString()
Get a human-readable description of this filter.
| ||||||||||
ShapeFilter<ShapeType> |
withAngularVelocity(Predicate<Number> predicate)
Restrict this filter to only match shapes that are currently in motion
with a linear velocity whose magnitude satisfies the specified predicate
(less than, greater than, etc.).
| ||||||||||
ShapeFilter<ShapeType> |
withAwake(boolean awake)
Restrict this filter to only match shapes with the specified awake
state.
| ||||||||||
<ConstrainedShapeType extends ShapeType extends Shape> ShapeFilter<ConstrainedShapeType> |
withClass(Class<? extends ConstrainedShapeType> theClass)
Restrict this filter to only match shapes whose classes are the same as,
or subclasses of, the specified class.
| ||||||||||
<ConstrainedShapeType extends ShapeType extends Shape> ShapeFilter<ConstrainedShapeType> |
withClass(Predicate<Class<? extends ConstrainedShapeType>> predicate)
Restrict this filter to only match shapes whose classes match the
specified predicate (such as Predicate#equalTo(Object) or
Predicate#extending(Class)).
| ||||||||||
ShapeFilter<ShapeType> |
withColor(Color color)
Restrict this filter to only match shapes with the specified color.
| ||||||||||
ShapeFilter<ShapeType> |
withLinearVelocity(Predicate<Number> predicate)
Restrict this filter to only match shapes that are currently in motion
with a linear velocity whose magnitude satisfies the specified predicate
(less than, greater than, etc.).
| ||||||||||
ShapeFilter<ShapeType> |
withSensor(boolean sensor)
Restrict this filter to only match shapes with the specified sensor
property.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
final boolean |
accept(ShapeType object)
TODO: document.
| ||||||||||
void |
addDescriptionOfConstraint(StringBuilder result)
Get a human-readable description of this filter.
| ||||||||||
World |
b2World()
Gets the JBox2D world where this filter will be executed.
| ||||||||||
String |
describe(ShapeType object)
Get a description of the specified object, suitable for use in
a diagnostic message.
| ||||||||||
String |
description(boolean plural)
Get a human-readable description of this filter.
| ||||||||||
final void |
filter()
TODO: document.
| ||||||||||
String |
filteredObjectDescription()
Get a human-readable name for the type of objects to which this filter
applies.
| ||||||||||
String |
filteredObjectsDescription()
Get the plural form of
filteredObjectDescription() . | ||||||||||
ShapeFilter<? super ShapeType> |
previousFilter()
TODO: document.
| ||||||||||
RectF |
queryBounds()
Gets a bounding box that indicates which subregion of the world should
be queried by the filter, or null to query the entire world.
| ||||||||||
abstract boolean |
thisFilterAccepts(ShapeType object)
TODO: document.
| ||||||||||
RectF |
thisQueryBounds()
Gets a bounding box that indicates which subregion of the world should
be queried by the filter, or null to query the entire world.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Create a new Filter object.
previous | The previous filter in the chain of filters. |
---|---|
descriptionOfConstraint | A description of the constraint imposed by this filter (just one step in the chain). |
Returns the set of all shapes matched by this filter. The type returned is a ShapeSet, so the shapes will be returned back to front.
Gets the shape that is farthest in the background that matches this filter. This is the shape that has the lowest z-index, or if multiple shapes have the same z-index, the one that was added least recently to its field.
Gets the number of shapes matched by this filter.
Get a human-readable description of this filter.
Determine whether this object is equal to the another.
other | The object to compare against. |
---|
Returns true if any shapes were matched by this filter. This is the
opposite of isEmpty()
.
Gets the shape that is farthest in the foreground that matches this filter. This is the shape that has the highest z-index, or if multiple shapes have the same z-index, the one that was added most recently to its field.
Restrict this filter to only match shapes that intersect the specified rectangle.
bounds | the intersection rectangle |
---|
Restrict this filter to only match shapes that intersect the specified rectangle.
left | the x-coordinate of the left edge of the intersection rectangle |
---|---|
top | the y-coordinate of the top of the intersection rectangle |
right | the x-coordinate of the right edge of the intersection rectangle |
bottom | the y-coordinate of the bottom of the intersection rectangle |
Returns true if no shapes were matched by this filter. This is the
opposite of exist()
.
Gets an iterator over all shapes matched by this filter. The iterator is
the same as that which would be returned by the ShapeSet
retrieved by calling the all()
method, so the shapes are
iterated in back-to-front order.
Restrict this filter to only match shapes that occupy the specified point.
point | the point to test |
---|
Restrict this filter to only match shapes that occupy the specified point.
x | the x-coordinate of the point |
---|---|
y | the y-coordinate of the point |
Restrict this filter to only match shapes that are located within the specified radius of a point.
point | the point at the center of the intersection circle |
---|---|
radius | the radius of the intersection circle |
Restrict this filter to only match shapes that are located within the specified radius of a point.
x | the x-coordinate of the center of the intersection circle |
---|---|
y | the y-coordinate of the center of the intersection circle |
radius | the radius of the intersection circle |
Removes all of the shapes matched by this filter from the field they are in, and returns the set of those shapes.
Get a human-readable description of this filter.
Restrict this filter to only match shapes that are currently in motion with a linear velocity whose magnitude satisfies the specified predicate (less than, greater than, etc.).
predicate | the predicate that specifies how the angular velocity of the shape should be compared |
---|
Restrict this filter to only match shapes with the specified awake state.
awake | true if the filter should only match shapes that are awake; false if it should only match shapes that are asleep |
---|
Restrict this filter to only match shapes whose classes are the same as,
or subclasses of, the specified class. This is equivalent to calling
withClass(Predicate.extending(theClass))
. If you need to write
a filter that only matches the class of the shape
exactly and excludes subclasses, then you must call the
predicate version of this method directly:
withClass(Predicate.equalTo(theClass))
.
theClass | the class that shapes matching the filter will be instances (or subclasses) of |
---|
Restrict this filter to only match shapes whose classes match the specified predicate (such as Predicate#equalTo(Object) or Predicate#extending(Class)).
predicate | the predicate that specifies how the class of the shape should be compared |
---|
Restrict this filter to only match shapes with the specified color.
color | the Color of shapes to be matched |
---|
Restrict this filter to only match shapes that are currently in motion with a linear velocity whose magnitude satisfies the specified predicate (less than, greater than, etc.).
predicate | the predicate that specifies how the linear velocity of the shape should be compared |
---|
Restrict this filter to only match shapes with the specified sensor property.
sensor | true if the filter should only match sensors; false if it should only match shapes that are not sensors |
---|
TODO: document.
object | TODO: describe |
---|
Get a human-readable description of this filter.
result | A StringBuilder to add the description to. |
---|
Gets the JBox2D world where this filter will be executed. The default behavior of this method is to ask the previous filter for its world,
Get a description of the specified object, suitable for use in
a diagnostic message. The default implementation just uses
toString()
on the object.
object | The object to describe. |
---|
Get a human-readable description of this filter.
plural | Whether to generate the singular (false) or plural (true) form of the description. |
---|
TODO: document.
Get a human-readable name for the type of objects to which this filter applies. The result should be in the singular form.
Get the plural form of filteredObjectDescription()
.
Gets a bounding box that indicates which subregion of the world should be queried by the filter, or null to query the entire world.
TODO: document.
object | TODO: describe |
---|
Gets a bounding box that indicates which subregion of the world should be queried by the filter, or null to query the entire world.