Class NodeSortCriterion

  • All Implemented Interfaces:
    java.util.Comparator<org.jdom.Element>

    public class NodeSortCriterion
    extends java.lang.Object
    implements java.util.Comparator<org.jdom.Element>
    This class is used to hold the attribute values of a certain element.
    Since:
    6.2
    • Constructor Summary

      Constructors 
      Constructor Description
      NodeSortCriterion​(java.lang.String select, java.lang.String lang, java.lang.String dataType, java.lang.String order, java.lang.String caseOrder)
      Constructs a NodeSortParameterList that stores all the attributes of an element.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(org.jdom.Element arg1, org.jdom.Element arg2)
      Determines which provided Element has a higher priority (ie.
      java.lang.String getCaseOrder()
      Returns the value of the element's "case-order" attribute, which will either be "upper-first" or "lower-first".
      java.lang.String getDataType()
      Returns the value of the element's "data-type" attribute, which will either be "text", "number", or "qname".
      java.lang.String getLang()
      Returns the value of the element's "lang" attribute, which will be a lowercase ISO 639 code.
      java.lang.String getOrder()
      Returns the value of the element's "order" attribute, which will either be "ascending" or "descending".
      java.lang.String getSelect()
      Returns the value of the element's "select" attribute, which will be an XPath-expression.
      void setCaseOrder​(java.lang.String caseOrder)
      Sets the 's "case-order" attribute explicitly.
      void setDataType​(java.lang.String dataType)
      Sets the 's "data-type" attribute explicitly.
      void setLang​(java.lang.String lang)
      Sets the 's "lang" attribute explicitly.
      void setOrder​(java.lang.String order)
      Sets the 's "order" attribute explicitly.
      void setSelect​(java.lang.String select)
      Sets the 's "select" attribute explicitly, which is an expected xpath expression.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • NodeSortCriterion

        public NodeSortCriterion​(java.lang.String select,
                                 java.lang.String lang,
                                 java.lang.String dataType,
                                 java.lang.String order,
                                 java.lang.String caseOrder)
        Constructs a NodeSortParameterList that stores all the attributes of an element.
        Parameters:
        select - An XPath-expression specifying the node/node-set to sort on
        lang - A lowercase two-letter ISO-639 code that specifies which language is to be used by the sort. Default is "en".
        dataType - Either "text", "number", or "qname"; specifies the data-type of the data to be sorted. Default is "text".
        order - Either "ascending" or "descending"; specifies the sort order. Default is "ascending".
        caseOrder - Either "lower-first" or "upper-first"; specifies whether upper- or lowercase letters are to be ordered first. Default is "lower-first".
    • Method Detail

      • compare

        public int compare​(org.jdom.Element arg1,
                           org.jdom.Element arg2)
        Determines which provided Element has a higher priority (ie. which one should be sorted before the other or whether they have the same priority and it doesn't matter).
        Specified by:
        compare in interface java.util.Comparator<org.jdom.Element>
        Returns:
        0 (equal) for all comparisons if the defined "dataType" variable is not one of these options: "text", "number", or "qname". Otherwise, it returns 1 when arg1 is to be sorted AFTER arg2, returns 0 when arg1 is to be sorted either before OR after arg2 since they are the same, and returns -1 when arg1 is to be sorted BEFORE arg2. If an exception occurs at any time during the comparison, then 0 is returned.
      • setSelect

        public void setSelect​(java.lang.String select)
        Sets the 's "select" attribute explicitly, which is an expected xpath expression. If the provided parameter is empty, then the parameter's value defaults to ".".
      • getSelect

        public java.lang.String getSelect()
        Returns the value of the element's "select" attribute, which will be an XPath-expression.
      • setLang

        public void setLang​(java.lang.String lang)
        Sets the 's "lang" attribute explicitly. If the provided parameter is empty, then the parameter's value defaults to "en".
      • getLang

        public java.lang.String getLang()
        Returns the value of the element's "lang" attribute, which will be a lowercase ISO 639 code.
      • setDataType

        public void setDataType​(java.lang.String dataType)
        Sets the 's "data-type" attribute explicitly. If the provided parameter is unrecognized, then the parameter is set to its default value.
      • getDataType

        public java.lang.String getDataType()
        Returns the value of the element's "data-type" attribute, which will either be "text", "number", or "qname".
      • setOrder

        public void setOrder​(java.lang.String order)
        Sets the 's "order" attribute explicitly. If the provided parameter is unrecognized, then the parameter is set to its default value.
      • getOrder

        public java.lang.String getOrder()
        Returns the value of the element's "order" attribute, which will either be "ascending" or "descending".
      • setCaseOrder

        public void setCaseOrder​(java.lang.String caseOrder)
        Sets the 's "case-order" attribute explicitly. If the provided parameter is unrecognized, then the parameter is set to its default value.
      • getCaseOrder

        public java.lang.String getCaseOrder()
        Returns the value of the element's "case-order" attribute, which will either be "upper-first" or "lower-first".