1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /*
  17. * $Id: SortSettings.java,v 1.1 2004/02/27 01:58:29 zongaro Exp $
  18. */
  19. package com.sun.org.apache.xalan.internal.xsltc.dom;
  20. import java.text.Collator;
  21. import java.util.Locale;
  22. import com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet;
  23. /**
  24. * Class for carrying settings that are to be used for a particular set
  25. * of <code>xsl:sort</code> elements.
  26. */
  27. final class SortSettings {
  28. /**
  29. * A reference to the translet object for the transformation.
  30. */
  31. private AbstractTranslet _translet;
  32. /**
  33. * The sort order (ascending or descending) for each level of
  34. * <code>xsl:sort</code>
  35. */
  36. private int[] _sortOrders;
  37. /**
  38. * The type of comparison (text or number) for each level of
  39. * <code>xsl:sort</code>
  40. */
  41. private int[] _types;
  42. /**
  43. * The Locale for each level of <code>xsl:sort</code>, based on any lang
  44. * attribute or the default Locale.
  45. */
  46. private Locale[] _locales;
  47. /**
  48. * The Collator object in effect for each level of <code>xsl:sort</code>
  49. */
  50. private Collator[] _collators;
  51. /**
  52. * Case ordering for each level of <code>xsl:sort</code>.
  53. */
  54. private String[] _caseOrders;
  55. /**
  56. * Create an instance of <code>SortSettings</code>.
  57. * @param translet {@link com.sun.org.apache.xalan.internal.xsltc.runtime.AbstractTranslet}
  58. * object for the transformation
  59. * @param sortOrders an array specifying the sort order for each sort level
  60. * @param types an array specifying the type of comparison for each sort
  61. * level (text or number)
  62. * @param locales an array specifying the Locale for each sort level
  63. * @param collators an array specifying the Collation in effect for each
  64. * sort level
  65. * @param caseOrders an array specifying whether upper-case, lower-case
  66. * or neither is to take precedence for each sort level.
  67. * The value of each element is equal to one of
  68. * <code>"upper-first", "lower-first", or ""</code>.
  69. */
  70. SortSettings(AbstractTranslet translet, int[] sortOrders, int[] types,
  71. Locale[] locales, Collator[] collators, String[] caseOrders) {
  72. _translet = translet;
  73. _sortOrders = sortOrders;
  74. _types = types;
  75. _locales = locales;
  76. _collators = collators;
  77. _caseOrders = caseOrders;
  78. }
  79. /**
  80. * @return A reference to the translet object for the transformation.
  81. */
  82. AbstractTranslet getTranslet() {
  83. return _translet;
  84. }
  85. /**
  86. * @return An array containing the sort order (ascending or descending)
  87. * for each level of <code>xsl:sort</code>
  88. */
  89. int[] getSortOrders() {
  90. return _sortOrders;
  91. }
  92. /**
  93. * @return An array containing the type of comparison (text or number)
  94. * to perform for each level of <code>xsl:sort</code>
  95. */
  96. int[] getTypes() {
  97. return _types;
  98. }
  99. /**
  100. * @return An array containing the Locale object in effect for each level
  101. * of <code>xsl:sort</code>
  102. */
  103. Locale[] getLocales() {
  104. return _locales;
  105. }
  106. /**
  107. * @return An array containing the Collator object in effect for each level
  108. * of <code>xsl:sort</code>
  109. */
  110. Collator[] getCollators() {
  111. return _collators;
  112. }
  113. /**
  114. * @return An array specifying the case ordering for each level of
  115. * <code>xsl:sort</code>.
  116. */
  117. String[] getCaseOrders() {
  118. return _caseOrders;
  119. }
  120. }