Skip to content

Commit 16f353a

Browse files
committed
Merge branch 'dev' of https://dolphindb.net/dolphindb/api-java into dev
2 parents 4b7d0c0 + 1413a5a commit 16f353a

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

src/com/xxdb/data/BasicDuration.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ public class BasicDuration extends AbstractScalar implements Comparable<BasicDur
1010
private static final String[] unitSyms = {"ns", "us", "ms", "s", "m", "H", "d", "w", "M", "y", "B"};
1111
private int value;
1212
private DURATION unit;
13-
private int exchange_;
13+
private int exchange;
1414

1515
public BasicDuration(DURATION unit, int value){
1616
this.value = value;
1717
if (unit == DURATION.TDAY)
1818
throw new RuntimeException("the exchange unit should be given as String when use exchange calendar.");
1919
this.unit = unit;
20-
this.exchange_ = unit.ordinal();
20+
this.exchange = unit.ordinal();
2121
}
2222

2323
public BasicDuration(String unit, int value) {
@@ -27,16 +27,16 @@ public BasicDuration(String unit, int value) {
2727
this.unit = DURATION.values()[codeNumber];
2828
else
2929
this.unit = DURATION.TDAY;
30-
this.exchange_ = codeNumber;
30+
this.exchange = codeNumber;
3131
}
3232

33-
protected BasicDuration(int exchange_, int value) {
33+
protected BasicDuration(int exchange, int value) {
3434
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];
3737
else
3838
this.unit = DURATION.TDAY;
39-
this.exchange_ = exchange_;
39+
this.exchange = exchange;
4040
}
4141

4242
public BasicDuration(ExtendedDataInput in) throws IOException{
@@ -46,7 +46,7 @@ public BasicDuration(ExtendedDataInput in) throws IOException{
4646
unit = DURATION.values()[codeNumber];
4747
else
4848
unit = DURATION.TDAY;
49-
exchange_ = codeNumber;
49+
this.exchange = codeNumber;
5050
}
5151

5252
public int getDuration() {
@@ -58,34 +58,34 @@ public DURATION getUnit() {
5858
}
5959

6060
public int getExchangeInt() {
61-
return exchange_;
61+
return this.exchange;
6262
}
6363

6464
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+
6868
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);
7373
return String.valueOf(codes);
7474
}
7575

7676
@Override
7777
public boolean isNull() {
78-
return value == Integer.MIN_VALUE;
78+
return this.value == Integer.MIN_VALUE;
7979
}
8080

8181
@Override
8282
public void setNull() {
83-
value = Integer.MIN_VALUE;
83+
this.value = Integer.MIN_VALUE;
8484
}
8585

8686
@Override
8787
public Number getNumber() throws Exception {
88-
return value;
88+
return this.value;
8989
}
9090

9191
@JsonIgnore
@@ -116,22 +116,22 @@ public DATA_TYPE getDataType() {
116116

117117
@Override
118118
public String getString() {
119-
if(value == Integer.MIN_VALUE)
119+
if (this.value == Integer.MIN_VALUE)
120120
return "";
121121
else
122-
return value + getExchangeName();
122+
return this.value + getExchangeName();
123123
}
124124

125125
@Override
126126
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);
129129
}
130130

131131
@Override
132132
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);
135135
else
136136
return -1;
137137
}
@@ -141,7 +141,7 @@ public boolean equals(Object o){
141141
if(! (o instanceof BasicDuration) || o == null)
142142
return false;
143143
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;
145145
}
146146

147147
@JsonIgnore

0 commit comments

Comments
 (0)