LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.info
Class LySortCriterion

java.lang.Object
  extended by leon.info.LyTag
      extended by leon.info.LyInfo
          extended by leon.info.LySortCriterion
All Implemented Interfaces:
java.lang.Cloneable, LyCommentInterface

public final class LySortCriterion
extends LyInfo

This class represents a sort criterion. It contains the following attributes : - the fieldInfo on which the sort is performed, - a boolean indicating if the sort is increasing or not.
A sort contains a list of sort criteria.
See also : tag of leon.dtd

See Also:
LySort, LyFieldInfo

Nested Class Summary
 
Nested classes/interfaces inherited from class leon.info.LyTag
LyTag.Model
 
Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LySortCriterion(LyFieldInfo fieldInfo, boolean increasing)
          Constructor for a sort criterion.
LySortCriterion(LyFieldInfo fieldInfo, boolean increasing, java.lang.String javaName)
          Constructor for a sort criterion.
LySortCriterion(java.lang.String id, LyFieldInfo fieldInfo, boolean increasing, java.lang.String javaName)
          Constructor for a sort criterion.
LySortCriterion(java.lang.String id, LyFieldInfo fieldInfo, boolean increasing, java.lang.String javaName, java.util.BitSet modifiers)
          Constructor for a sort criterion.
 
Method Summary
 LySortCriterion cloneSortCriterion()
          Clone this criterion.
 int compare(LyObject object1, LyObject object2)
          Compares two objects according to sort criterion parameters.
 int compare(java.lang.Object value1, java.lang.Object value2)
          Compares two values according to sort criterion parameters.
 boolean equals(java.lang.Object obj)
          Compare sort criterion content (all parameters are equals).
 LyFieldInfo getFieldInfo()
          Get field info referred by this sort criterion.
 java.lang.String getJavaName()
          Gets java class name corresponding to this sort criterion.
 java.util.BitSet getModifiers()
          Checks whether the expression has the given modifier set.
 boolean hasModifier(short modifier)
          Checks whether the expression has the given modifier set.
 boolean isGroupBy()
          Tests if sort criterion order groupBy mode is set.
 boolean isIncreasing()
          Tests if sort criterion order is increasing.
 void setFieldInfo(LyFieldInfo fieldInfo)
          Sets the fieldInfo referred by this sort criterion.
 void setGroupBy(boolean groupBy)
          Sets criterion groupBy mode.
 void setIncreasing(boolean increasing)
          Sets criterion order.
 void setJavaName(java.lang.String javaName)
          Sets java class name corresponding to this sort criterion.
 void setModifier(short modifier)
          Sets a modifier on this expression.
 void writeXml(java.io.PrintWriter pw)
          Writes XML corresponding to this criterion element.
 
Methods inherited from class leon.info.LyInfo
getAlias, getApplication, getFile, getId, getInclude, getName, isIncluded, isInternal, isInternal, isLoaded, isLocked, load, setApplication, setFile, toString
 
Methods inherited from class leon.info.LyTag
clone, 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
 
Methods inherited from interface leon.parser.LyCommentInterface
getCommentsEnd, getCommentsStart, setCommentsEnd, setCommentsStart
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LySortCriterion

public LySortCriterion(LyFieldInfo fieldInfo,
                       boolean increasing)
Constructor for a sort criterion.

Parameters:
fieldInfo - The concerned field info.
incresing - True if increasing, false if decreasing.

LySortCriterion

public LySortCriterion(java.lang.String id,
                       LyFieldInfo fieldInfo,
                       boolean increasing,
                       java.lang.String javaName,
                       java.util.BitSet modifiers)
Constructor for a sort criterion.

Parameters:
id - Id of the sort criterion.
fieldInfo - The concerned field info.
incresing - True if increasing, false if decreasing.
javaName - Name of the java class corresponding to this sort criterion.
modifiers - modifiers uses for sort the elements.

LySortCriterion

public LySortCriterion(LyFieldInfo fieldInfo,
                       boolean increasing,
                       java.lang.String javaName)
Constructor for a sort criterion.

Parameters:
fieldInfo - The concerned field info.
incresing - True if increasing, false if decreasing.
javaName - Name of the java class corresponding to this sort criterion.

LySortCriterion

public LySortCriterion(java.lang.String id,
                       LyFieldInfo fieldInfo,
                       boolean increasing,
                       java.lang.String javaName)
Constructor for a sort criterion.

Parameters:
id - Id of the sort criterion.
fieldInfo - The concerned field info.
incresing - True if increasing, false if decreasing.
javaName - Name of the java class corresponding to this sort criterion.
Method Detail

compare

public int compare(LyObject object1,
                   LyObject object2)
Compares two objects according to sort criterion parameters.

Parameters:
object1 - first object.
object2 - first object.
Returns:
0 is objects are equals according to this criterion, a negative value if first object is lower than second object, a positive value if first object is greater than second object.

compare

public int compare(java.lang.Object value1,
                   java.lang.Object value2)
Compares two values according to sort criterion parameters.

Parameters:
value1 - first value.
value2 - first object.
Returns:
0 is values are equals according to this criterion, a negative result if first value is lower than second one, a positive result otherwise.

writeXml

public void writeXml(java.io.PrintWriter pw)
Writes XML corresponding to this criterion element.

Parameters:
pw - PrintWriter on which the XML is written.

getFieldInfo

public LyFieldInfo getFieldInfo()
Get field info referred by this sort criterion.

Returns:
The concerned field info.

isIncreasing

public boolean isIncreasing()
Tests if sort criterion order is increasing.

Returns:
True if the sort is increasing, false otherwise.

isGroupBy

public boolean isGroupBy()
Tests if sort criterion order groupBy mode is set.

Returns:
True if the groupBy mode is on, false otherwise.

hasModifier

public boolean hasModifier(short modifier)
Checks whether the expression has the given modifier set.

Parameters:
modifier - Modifier to set on the expression. See the MOD_XXX constants, default is null (no modifier).
Returns:
True if the modifier is on, false it is off.

getModifiers

public java.util.BitSet getModifiers()
Checks whether the expression has the given modifier set.

Parameters:
modifier - Modifier to set on the expression. See the MOD_XXX constants, default is null (no modifier).
Returns:
True if the modifier is on, false it is off.

getJavaName

public java.lang.String getJavaName()
Gets java class name corresponding to this sort criterion.

Returns:
Name of the java class corresponding to this sort criterion.

setFieldInfo

public void setFieldInfo(LyFieldInfo fieldInfo)
Sets the fieldInfo referred by this sort criterion.

Parameters:
fieldInfo - FieldInfo concerned by this sort criterion.

setIncreasing

public void setIncreasing(boolean increasing)
Sets criterion order.

Parameters:
increasing - True if the sort order become increasing, false otherwise.

setGroupBy

public void setGroupBy(boolean groupBy)
Sets criterion groupBy mode.

Parameters:
groupBy - True if the groupBy mode is set, false otherwise.

setJavaName

public void setJavaName(java.lang.String javaName)
Sets java class name corresponding to this sort criterion.

Parameters:
javaName - Name of the java class corresponding to this sort criterion.

setModifier

public void setModifier(short modifier)
Sets a modifier on this expression.

Parameters:
modifier - Modifier to set on the expression. See the MOD_XXX constants, default is null (no modifier).

equals

public boolean equals(java.lang.Object obj)
Compare sort criterion content (all parameters are equals).

Overrides:
equals in class java.lang.Object
Parameters:
obj - another sort criterion to compare to

cloneSortCriterion

public LySortCriterion cloneSortCriterion()
Clone this criterion.


(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com