@@ -10,14 +10,14 @@ public class BasicDuration extends AbstractScalar implements Comparable<BasicDur
10
10
private static final String [] unitSyms = {"ns" , "us" , "ms" , "s" , "m" , "H" , "d" , "w" , "M" , "y" , "B" };
11
11
private int value ;
12
12
private DURATION unit ;
13
- private int exchange_ ;
13
+ private int exchange ;
14
14
15
15
public BasicDuration (DURATION unit , int value ){
16
16
this .value = value ;
17
17
if (unit == DURATION .TDAY )
18
18
throw new RuntimeException ("the exchange unit should be given as String when use exchange calendar." );
19
19
this .unit = unit ;
20
- this .exchange_ = unit .ordinal ();
20
+ this .exchange = unit .ordinal ();
21
21
}
22
22
23
23
public BasicDuration (String unit , int value ) {
@@ -27,16 +27,16 @@ public BasicDuration(String unit, int value) {
27
27
this .unit = DURATION .values ()[codeNumber ];
28
28
else
29
29
this .unit = DURATION .TDAY ;
30
- this .exchange_ = codeNumber ;
30
+ this .exchange = codeNumber ;
31
31
}
32
32
33
- protected BasicDuration (int exchange_ , int value ) {
33
+ protected BasicDuration (int exchange , int value ) {
34
34
this .value = value ;
35
- if (exchange_ >= 0 && exchange_ <= 10 )
36
- this .unit = DURATION .values ()[exchange_ ];
35
+ if (exchange >= 0 && exchange <= 10 )
36
+ this .unit = DURATION .values ()[exchange ];
37
37
else
38
38
this .unit = DURATION .TDAY ;
39
- this .exchange_ = exchange_ ;
39
+ this .exchange = exchange ;
40
40
}
41
41
42
42
public BasicDuration (ExtendedDataInput in ) throws IOException {
@@ -46,7 +46,7 @@ public BasicDuration(ExtendedDataInput in) throws IOException{
46
46
unit = DURATION .values ()[codeNumber ];
47
47
else
48
48
unit = DURATION .TDAY ;
49
- exchange_ = codeNumber ;
49
+ this . exchange = codeNumber ;
50
50
}
51
51
52
52
public int getDuration () {
@@ -58,34 +58,34 @@ public DURATION getUnit() {
58
58
}
59
59
60
60
public int getExchangeInt () {
61
- return exchange_ ;
61
+ return this . exchange ;
62
62
}
63
63
64
64
public String getExchangeName () {
65
- if (exchange_ >= 0 && exchange_ <= 10 ) {
66
- return unitSyms [exchange_ ];
67
- }
65
+ if (this . exchange >= 0 && this . exchange <= 10 )
66
+ return this . unitSyms [this . exchange ];
67
+
68
68
char [] codes = new char [4 ];
69
- codes [0 ] = (char ) ((exchange_ >> 24 ) & 255 );
70
- codes [1 ] = (char ) ((exchange_ >> 16 ) & 255 );
71
- codes [2 ] = (char ) ((exchange_ >> 8 ) & 255 );
72
- codes [3 ] = (char ) (exchange_ & 255 );
69
+ codes [0 ] = (char ) ((this . exchange >> 24 ) & 255 );
70
+ codes [1 ] = (char ) ((this . exchange >> 16 ) & 255 );
71
+ codes [2 ] = (char ) ((this . exchange >> 8 ) & 255 );
72
+ codes [3 ] = (char ) (this . exchange & 255 );
73
73
return String .valueOf (codes );
74
74
}
75
75
76
76
@ Override
77
77
public boolean isNull () {
78
- return value == Integer .MIN_VALUE ;
78
+ return this . value == Integer .MIN_VALUE ;
79
79
}
80
80
81
81
@ Override
82
82
public void setNull () {
83
- value = Integer .MIN_VALUE ;
83
+ this . value = Integer .MIN_VALUE ;
84
84
}
85
85
86
86
@ Override
87
87
public Number getNumber () throws Exception {
88
- return value ;
88
+ return this . value ;
89
89
}
90
90
91
91
@ JsonIgnore
@@ -116,22 +116,22 @@ public DATA_TYPE getDataType() {
116
116
117
117
@ Override
118
118
public String getString () {
119
- if ( value == Integer .MIN_VALUE )
119
+ if ( this . value == Integer .MIN_VALUE )
120
120
return "" ;
121
121
else
122
- return value + getExchangeName ();
122
+ return this . value + getExchangeName ();
123
123
}
124
124
125
125
@ Override
126
126
protected void writeScalarToOutputStream (ExtendedDataOutput out ) throws IOException {
127
- out .writeInt (value );
128
- out .writeInt (exchange_ );
127
+ out .writeInt (this . value );
128
+ out .writeInt (this . exchange );
129
129
}
130
130
131
131
@ Override
132
132
public int compareTo (BasicDuration o ) {
133
- if (unit == o .unit && exchange_ == o .exchange_ )
134
- return Integer .compare (o .value , value );
133
+ if (this . unit == o .unit && this . exchange == o .exchange )
134
+ return Integer .compare (o .value , this . value );
135
135
else
136
136
return -1 ;
137
137
}
@@ -141,7 +141,7 @@ public boolean equals(Object o){
141
141
if (! (o instanceof BasicDuration ) || o == null )
142
142
return false ;
143
143
else
144
- return value == ((BasicDuration ) o ).value && unit == ((BasicDuration ) o ).unit && exchange_ == ((BasicDuration ) o ).exchange_ ;
144
+ return this . value == ((BasicDuration ) o ).value && this . unit == ((BasicDuration ) o ).unit && this . exchange == ((BasicDuration ) o ).exchange ;
145
145
}
146
146
147
147
@ JsonIgnore
0 commit comments