~ubuntu-branches/ubuntu/raring/eucalyptus/raring

« back to all changes in this revision

Viewing changes to clc/modules/www/src/main/java/com/eucalyptus/webui/client/service/SearchRange.java

  • Committer: Package Import Robot
  • Author(s): Brian Thomason
  • Date: 2011-11-29 13:17:52 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: package-import@ubuntu.com-20111129131752-rq31al3ntutv2vvl
Tags: upstream-3.0.999beta1
ImportĀ upstreamĀ versionĀ 3.0.999beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package com.eucalyptus.webui.client.service;
 
2
 
 
3
import java.io.Serializable;
 
4
 
 
5
public class SearchRange implements Serializable {
 
6
 
 
7
  private static final long serialVersionUID = 1L;
 
8
 
 
9
  private int start;
 
10
  private int length;
 
11
  private int sortField;
 
12
  private boolean ascending;
 
13
  
 
14
  public SearchRange( ) {
 
15
    this.setStart( 0 );
 
16
    this.setLength( 15 );
 
17
    this.setSortField( 0 );
 
18
    this.setAscending( true );
 
19
  }
 
20
 
 
21
  public SearchRange( int sortField ) {
 
22
    this.setStart( 0 );
 
23
    this.setLength( 15 );
 
24
    this.setSortField( sortField );
 
25
    this.setAscending( true );
 
26
  }
 
27
  
 
28
  public SearchRange( int start, int length ) {
 
29
    this.setStart( start );
 
30
    this.setLength( length );
 
31
    this.setSortField( 0 );
 
32
    this.setAscending( true );
 
33
  }
 
34
  
 
35
  public SearchRange( int start, int length, int sortField, boolean ascending ) {
 
36
    this.setStart( start );
 
37
    this.setLength( length );
 
38
    this.setSortField( sortField );
 
39
    this.setAscending( ascending );
 
40
  }
 
41
  
 
42
  @Override
 
43
  public String toString( ) {
 
44
    return "start=" + start + ", length=" + length + ", sortField=" + sortField + ", ascending=" + ascending;
 
45
  }
 
46
  
 
47
  @Override
 
48
  public boolean equals( Object obj ) {
 
49
    if (!( obj instanceof SearchRange ) ) {
 
50
      return false;
 
51
    }
 
52
    SearchRange that = ( SearchRange ) obj;
 
53
    if ( this == that ) {
 
54
      return true;
 
55
    }
 
56
    if ( ( this.start == that.start ) && 
 
57
         ( this.length == that.length ) &&
 
58
         ( this.sortField == that.sortField ) &&
 
59
         ( this.ascending == that.ascending ) ) {
 
60
      return true;
 
61
    }
 
62
    return false;
 
63
  }
 
64
  
 
65
  public boolean isSameSort( SearchRange that ) {
 
66
    if ( that != null && this.sortField == that.sortField && this.ascending == that.ascending ) {
 
67
      return true;
 
68
    }
 
69
    return false;
 
70
  }
 
71
  
 
72
  public void setLength( int length ) {
 
73
    this.length = length;
 
74
  }
 
75
 
 
76
  public int getLength( ) {
 
77
    return length;
 
78
  }
 
79
 
 
80
  public void setSortField( int sortField ) {
 
81
    this.sortField = sortField;
 
82
  }
 
83
 
 
84
  public int getSortField( ) {
 
85
    return sortField;
 
86
  }
 
87
 
 
88
  public void setAscending( boolean ascending ) {
 
89
    this.ascending = ascending;
 
90
  }
 
91
 
 
92
  public boolean isAscending( ) {
 
93
    return ascending;
 
94
  }
 
95
 
 
96
  public void setStart( int start ) {
 
97
    this.start = start;
 
98
  }
 
99
 
 
100
  public int getStart( ) {
 
101
    return start;
 
102
  }
 
103
  
 
104
}