Constructor and Description |
---|
MultiMerger() |
Modifier and Type | Method and Description |
---|---|
void |
add(Merger merger)
Adds a new algorithm to this merger.
|
boolean |
canMerge(StationDropOperation operation,
DockStation parent,
DockStation child)
Checks whether
Merger.merge(StationDropOperation, DockStation, DockStation) will succeed or not. |
Merger |
get(int index)
Gets the
index 'th merger in this list of mergers. |
void |
merge(StationDropOperation operation,
DockStation parent,
DockStation child)
Moves all children of
child to parent , leaving child
empty. |
void |
remove(Merger merger)
Removes
merger from this MultiMerger . |
int |
size()
Gets the total number of mergers in this set of mergers.
|
public void add(Merger merger)
merger
- the new algorithm, not null
public void remove(Merger merger)
merger
from this MultiMerger
.merger
- the item to removepublic int size()
public Merger get(int index)
index
'th merger in this list of mergers.index
- the locationnull
public boolean canMerge(StationDropOperation operation, DockStation parent, DockStation child)
Merger
Merger.merge(StationDropOperation, DockStation, DockStation)
will succeed or not. This
method will only be called if parent
would accept all children
of child
. This method may be called during "drop" and during "move" operations.canMerge
in interface Merger
operation
- the operation that would be executed, can be null
parent
- an existing stationchild
- a station that is dragged around and may be dropped onto parent
Merger.merge(StationDropOperation, DockStation, DockStation)
will succeedpublic void merge(StationDropOperation operation, DockStation parent, DockStation child)
Merger
child
to parent
, leaving child
empty. This method is only called if canMerge
returned true
and if the accept
-methods allow the operation.child
is not parent
, then child
will be removed
from its parent. Otherwise the child remains, allowing this Merger
to reuse it.