public class DefaultArrangementEntry extends java.lang.Object implements ArrangementEntry
Constructor and Description |
---|
DefaultArrangementEntry(ArrangementEntry parent,
int startOffset,
int endOffset,
boolean canBeMatched) |
Modifier and Type | Method and Description |
---|---|
void |
addChild(ArrangementEntry entry) |
void |
addDependency(ArrangementEntry dependency) |
boolean |
canBeMatched()
Sometimes we want particular entry to serve just as another entries holder.
|
java.util.List<? extends ArrangementEntry> |
getChildren()
Entries can be organised into hierarchies, that means that only siblings position can be changed during the rearrangement.
|
java.util.List<? extends ArrangementEntry> |
getDependencies()
There is a possible case that particular entry position depends on another entries positions.
|
int |
getEndOffset() |
ArrangementEntry |
getParent() |
int |
getStartOffset() |
public DefaultArrangementEntry(ArrangementEntry parent, int startOffset, int endOffset, boolean canBeMatched)
public ArrangementEntry getParent()
getParent
in interface ArrangementEntry
ArrangementEntry.getChildren()
public java.util.List<? extends ArrangementEntry> getChildren()
ArrangementEntry
Example: there are two classes at file and every class has two methods. Rearranger should not swap positions of methods from the different classes here.
getChildren
in interface ArrangementEntry
ArrangementEntry.getParent()
public void addChild(ArrangementEntry entry)
public java.util.List<? extends ArrangementEntry> getDependencies()
ArrangementEntry
This method allows to answer what sibling entries must be located before the current one at the resulting arrangement algorithm.
There is also a special case when a list with the single entry which is the current's entry parent
is returned - that means that current entry should be arranged to be the first child.
getDependencies
in interface ArrangementEntry
public void addDependency(ArrangementEntry dependency)
public int getStartOffset()
getStartOffset
in interface ArrangementEntry
public int getEndOffset()
getEndOffset
in interface ArrangementEntry
public boolean canBeMatched()
ArrangementEntry
That is achieved for entries which return 'false'
from this method call.
canBeMatched
in interface ArrangementEntry
true
if current entry can be matched
;
false
otherwise