1
2
3
4
5
6
7 package nl.tudelft.simulation.introspection.sortable;
8
9 /***
10 * The SortDefinition.
11 * <p>
12 * (c) copyright 2002-2005-2004 <a href="http://www.simulation.tudelft.nl">Delft
13 * University of Technology </a>, the Netherlands. <br>
14 * See for project information <a
15 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
16 * License of use: <a href="http://www.gnu.org/copyleft/lesser.html">Lesser
17 * General Public License (LGPL) </a>, no warranty.
18 *
19 * @author <a
20 * href="http://web.eur.nl/fbk/dep/dep1/Introduction/Staff/People/Lang">Niels
21 * Lang </a><a href="http://www.peter-jacobs.com/index.htm">Peter
22 * Jacobs </a>
23 * @version 1.1 Apr 15, 2004
24 * @since 1.5
25 */
26 public class SortDefinition implements Sortable.Definition
27 {
28 /*** the fieldID */
29 private int fieldID;
30
31 /*** whether sorting should occur ascending */
32 private boolean ascending;
33
34 /***
35 * constructs a new SortDefinition
36 *
37 * @param fieldID the fieldID
38 * @param ascending whether sorting should occur ascending
39 */
40 public SortDefinition(final int fieldID, final boolean ascending)
41 {
42 this.fieldID = fieldID;
43 this.ascending = ascending;
44 }
45
46 /***
47 * @see nl.tudelft.simulation.introspection.sortable.Sortable.Definition#getFieldID()
48 */
49 public int getFieldID()
50 {
51 return this.fieldID;
52 }
53
54 /***
55 * @see nl.tudelft.simulation.introspection.sortable.Sortable.Definition
56 * #isAcendingSort()
57 */
58 public boolean isAcendingSort()
59 {
60 return this.ascending;
61 }
62
63 /***
64 * @see nl.tudelft.simulation.introspection.sortable.Sortable.Definition
65 * #setAscending(boolean)
66 */
67 public void setAscending(final boolean ascending)
68 {
69 this.ascending = ascending;
70 }
71
72 /***
73 * @see java.lang.Object#toString()
74 */
75 @Override
76 public String toString()
77 {
78 return "Sort definition, fieldID: " + this.fieldID + ", ascending: "
79 + this.ascending;
80 }
81 }