Package org.jfree.chart.entity
Class StandardEntityCollection
- java.lang.Object
-
- org.jfree.chart.entity.StandardEntityCollection
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,EntityCollection,PublicCloneable
public class StandardEntityCollection extends java.lang.Object implements EntityCollection, java.lang.Cloneable, PublicCloneable, java.io.Serializable
A standard implementation of theEntityCollectioninterface.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ListentitiesStorage for the entities.private static longserialVersionUIDFor serialization.
-
Constructor Summary
Constructors Constructor Description StandardEntityCollection()Constructs a new entity collection (initially empty).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(ChartEntity entity)Adds an entity to the collection.voidaddAll(EntityCollection collection)Adds all the entities from the specified collection.voidclear()Clears all the entities from the collection.java.lang.Objectclone()Returns a clone of this entity collection.booleanequals(java.lang.Object obj)Tests this object for equality with an arbitrary object.java.util.CollectiongetEntities()Returns the entities in an unmodifiable collection.ChartEntitygetEntity(double x, double y)Returns the last entity in the list with an area that encloses the specified coordinates, ornullif there is no such entity.ChartEntitygetEntity(int index)Returns a chart entity from the collection.intgetEntityCount()Returns the number of entities in the collection.java.util.Iteratoriterator()Returns an iterator for the entities in the collection.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
entities
private java.util.List entities
Storage for the entities.
-
-
Method Detail
-
getEntityCount
public int getEntityCount()
Returns the number of entities in the collection.- Specified by:
getEntityCountin interfaceEntityCollection- Returns:
- The entity count.
-
getEntity
public ChartEntity getEntity(int index)
Returns a chart entity from the collection.- Specified by:
getEntityin interfaceEntityCollection- Parameters:
index- the entity index.- Returns:
- The entity.
- See Also:
add(ChartEntity)
-
clear
public void clear()
Clears all the entities from the collection.- Specified by:
clearin interfaceEntityCollection
-
add
public void add(ChartEntity entity)
Adds an entity to the collection.- Specified by:
addin interfaceEntityCollection- Parameters:
entity- the entity (nullnot permitted).
-
addAll
public void addAll(EntityCollection collection)
Adds all the entities from the specified collection.- Specified by:
addAllin interfaceEntityCollection- Parameters:
collection- the collection of entities (nullnot permitted).
-
getEntity
public ChartEntity getEntity(double x, double y)
Returns the last entity in the list with an area that encloses the specified coordinates, ornullif there is no such entity.- Specified by:
getEntityin interfaceEntityCollection- Parameters:
x- the x coordinate.y- the y coordinate.- Returns:
- The entity (possibly
null).
-
getEntities
public java.util.Collection getEntities()
Returns the entities in an unmodifiable collection.- Specified by:
getEntitiesin interfaceEntityCollection- Returns:
- The entities.
-
iterator
public java.util.Iterator iterator()
Returns an iterator for the entities in the collection.- Specified by:
iteratorin interfaceEntityCollection- Returns:
- An iterator.
-
equals
public boolean equals(java.lang.Object obj)
Tests this object for equality with an arbitrary object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object to test against (nullpermitted).- Returns:
- A boolean.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedExceptionReturns a clone of this entity collection.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classjava.lang.Object- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException- if the object cannot be cloned.
-
-