public class OrderedLayerCollection extends Object
OrderedLayerCollection
is a helper class that allows order a set
DockStation
s according to the rules defined in DockStationDropLayer
.Constructor and Description |
---|
OrderedLayerCollection(DockStationDropLayerFactory factory)
Creates a new collection
|
Modifier and Type | Method and Description |
---|---|
void |
add(DockStation station)
Adds an additional station which is to be ordered.
|
protected int |
compare(DockStationDropLayer a,
DockStationDropLayer b)
|
List<DockStation> |
sort(int x,
int y)
Sorts the current set of
DockStation s currently known to this
collection. |
protected List<DockStationDropLayer> |
sort(List<DockStationDropLayer> layers)
Creates a new ordered list containing all items of
layer , the new list
is built by an algorithm that is resistent against inconstant ordering. |
public OrderedLayerCollection(DockStationDropLayerFactory factory)
factory
- applied to all DockStation
s in order to find their DockStationDropLayer
s.public void add(DockStation station)
station
- the additional stationpublic List<DockStation> sort(int x, int y)
DockStation
s currently known to this
collection.x
- the x-coordinate of the mouse on the screeny
- the y-coordinate of the mouse on the screenprotected List<DockStationDropLayer> sort(List<DockStationDropLayer> layers)
layer
, the new list
is built by an algorithm that is resistent against inconstant ordering.layers
- the layers to orderprotected int compare(DockStationDropLayer a, DockStationDropLayer b)
a
- the first object to compareb
- the second object to comparea
is less/equal/greater than b
.