leon.info
Class LySort
java.lang.Object
leon.info.LyTag
leon.info.LyInfo
leon.info.LyObjectInfo
leon.info.LySort
- All Implemented Interfaces:
- java.lang.Cloneable, LyCommentInterface
public final class LySort
- extends LyObjectInfo
This class represents a sort used to compare 2 objects in order to be able to sort objects list.
It contains a list of criteria.
See also tag of leon.dtd
- See Also:
LySortCriterion
,
LyObject.compare(leon.data.LyObject, leon.info.LySort, boolean)
,
LyObjectList
Field Summary |
static java.lang.String |
__VERSION
|
Constructor Summary |
LySort()
Default constructor with to parameters to build a sort. |
LySort(java.lang.String id,
LySort template)
Constructs an identified sort from a template. |
Methods inherited from class leon.info.LyObjectInfo |
clone, getAlias, getData, getDataList, getDatas, getFilePrefix, getGroup, getInternalAlias, getInternalFilePrefix, getInternalName, getMarks, getName, getTemplate, getTip, getUserData, hasMark, hasMarks, hasTemplate, isTemplate, putData, putData, removeData, toName |
Methods inherited from class leon.info.LyInfo |
getApplication, getFile, getId, getInclude, isIncluded, isInternal, isInternal, isLoaded, isLocked, load, setApplication, setFile, toString |
Methods inherited from class leon.info.LyTag |
getCommentsEnd, getCommentsStart, getEnvironment, getModelType, getParent, getRootProject, hasAncestor, isExtern, setCommentsEnd, setCommentsStart, wasCloned |
Methods inherited from class java.lang.Object |
getClass, hashCode, notify, notifyAll, wait, wait, wait |
__VERSION
public static final java.lang.String __VERSION
- See Also:
- Constant Field Values
LySort
public LySort()
- Default constructor with to parameters to build a sort.
LySort
public LySort(java.lang.String id,
LySort template)
- Constructs an identified sort from a template.
- Parameters:
id
- Id of the new sort.template
- Sort from which criteria are copied.
cloneSort
public LySort cloneSort()
- Clone this sort.
lock
public void lock()
- Lock this sort.
getCriterion
public LySortCriterion getCriterion(int index)
- Gets the criterion at the given index in this sort.
- Parameters:
index
- Index of the searched criterion.
- Returns:
- The criterion found at this position in criteria list of this sort.
- Throws:
java.lang.ArrayIndexOutOfBoundsException
- If index is negative of greater or equal to the
number of criteria.
getCriterionCount
public int getCriterionCount()
- Gets number of criteria of this sort.
- Returns:
- Number of criteria.
getCriteria
public java.util.Vector<LySortCriterion> getCriteria()
- Gets a copy of criteria list.
- Returns:
- Copy of this sort citeria. Since a copy is made, the returned list can freely be
modified.
contains
public boolean contains(LyFieldInfo fieldInfo)
- Checks if the sort contains the given field info.
- Parameters:
fieldInfo
- FieldInfo that is searched.
- Returns:
- True if the sort contains the given fieldInfo, false otherwise.
contains
public boolean contains(LySortCriterion criterion)
- Checks if a sort criterion is found in this sort.
- Parameters:
criterion
- The sort criterion.
- Returns:
- True if the sort criterion is found, false otherwise.
getCriterion
public LySortCriterion getCriterion(LyFieldInfo fieldInfo)
- Gets sort criterion corresponding to the given fieldInfo.
- Parameters:
fieldInfo
- FieldInfo for which a criterion is searched.
- Returns:
- The criterion found for the given fieldInfo, null if no criterion in this sort
concerns this fieldInfo.
getIndex
public int getIndex(LyFieldInfo fieldInfo)
- Gets position of the criterion corresponding to the given fieldInfo.
- Parameters:
fieldInfo
- FieldInfo for which a criterion is searched.
- Returns:
- Index of the criterion found for the given fieldInfo, -1 if no criterion in this sort
concerns this fieldInfo.
getFieldInfos
public LyInfoList<LyFieldInfo> getFieldInfos()
- Gets list of fieldInfos that this sort refers to.
- Returns:
- List of fieldInfos that the sort depends on.
getGroupByFieldInfos
public LyInfoList<LyFieldInfo> getGroupByFieldInfos()
- Gets list of fieldInfos corresponding to groups.
- Returns:
- List of fieldInfos corresponding to groups, maybe null.
hasGroups
public boolean hasGroups()
- Checks if this sort defines grouping.
- Returns:
- True if groups are defined, false otherwise.
hasCalculatedFields
public boolean hasCalculatedFields(LyClassInfo classInfo)
- Checks if this sort has fields that are calculated.
- Returns:
- True the sort contains calculated fields, false otherwise.
hasCriterionWithComparator
public boolean hasCriterionWithComparator()
- Checks if this sort has at least one criterion with a comparator.
- Returns:
- True the sort contains at least one criterion with a comparator, false otherwise.
writeXml
public void writeXml(java.io.PrintWriter pw)
- Writes XML corresponding to this sort element.
- Parameters:
pw
- PrintWriter on which the XML is written.
addCriterion
public void addCriterion(LySortCriterion criterion)
- Adds a criterion to this sort.
- Parameters:
criterion
- Criterion that is added to this sort.
equals
public boolean equals(java.lang.Object obj)
- Compare sort content (all criterion are equals).
- Overrides:
equals
in class java.lang.Object
- Parameters:
obj
- another sort to compare to
addCriterion
public LySortCriterion addCriterion(LyFieldInfo fieldInfo,
boolean increasing)
- Adds a criterion to this sort by giving a field info and a boolean that indicates if sort on
this field is increasing or not. This method is a shortcut of the previous one.
- Parameters:
fieldInfo
- Field info for which a sort criterion is added to this sort.increasing
- Sort criterion order.
- Returns:
- The new sort criterion.
addSort
public void addSort(LySort sort)
- Adds all criteria of the given sort to this sort.
- Parameters:
sort
- Sort added to this sort.
Website: W4 S.A., contact us: support@w4global.com