Skip to content

Commit bf0b6f8

Browse files
release 3.00.2.1
1 parent 47c305d commit bf0b6f8

35 files changed

+10620
-234
lines changed

src/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
3333
//通过使用 "*",如下所示:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("3.00.2.0")]
36-
[assembly: AssemblyFileVersion("3.00.2.0")]
35+
[assembly: AssemblyVersion("3.00.2.1")]
36+
[assembly: AssemblyFileVersion("3.00.2.1")]

src/data/AbstractVector.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ public static void checkCompressedMethod(DATA_TYPE type, int method){
194194
case DATA_TYPE.DT_NANOTIMESTAMP:
195195

196196
case DATA_TYPE.DT_INT128:
197+
case DATA_TYPE.DT_COMPLEX:
197198
case DATA_TYPE.DT_UUID:
198199
case DATA_TYPE.DT_IPADDR:
199200
case DATA_TYPE.DT_FLOAT:
@@ -264,6 +265,7 @@ public static int getUnitLength(DATA_TYPE type)
264265
unitLength = 8;
265266
break;
266267
case DATA_TYPE.DT_INT128:
268+
case DATA_TYPE.DT_COMPLEX:
267269
case DATA_TYPE.DT_UUID:
268270
case DATA_TYPE.DT_IPADDR:
269271
case DATA_TYPE.DT_DECIMAL128:

src/data/BasicComplex.cs

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using dolphindb.io;
4+
5+
namespace dolphindb.data
6+
{
7+
public class BasicComplex : AbstractScalar
8+
{
9+
10+
protected Double2 value;
11+
12+
public BasicComplex(double real, double image)
13+
{
14+
value = new Double2(real, image);
15+
}
16+
17+
public BasicComplex(ExtendedDataInput @in)
18+
{
19+
value = @in.readDouble2();
20+
}
21+
22+
public Double2 getDouble2()
23+
{
24+
return value;
25+
}
26+
27+
28+
public override bool isNull()
29+
{
30+
return value.isNull();
31+
}
32+
33+
34+
public override void setNull()
35+
{
36+
value = new Double2(-double.MaxValue, -double.MaxValue);
37+
}
38+
39+
public double getReal() {
40+
return value.x;
41+
}
42+
43+
public double getImage(){
44+
return value.y;
45+
}
46+
47+
public override Number getNumber()
48+
{
49+
throw new Exception("Imcompatible data type");
50+
}
51+
52+
public override object getObject()
53+
{
54+
throw new NotImplementedException();
55+
}
56+
57+
public override void setObject(object value)
58+
{
59+
throw new NotImplementedException();
60+
}
61+
public override Object getTemporal()
62+
{
63+
throw new Exception("Imcompatible data type");
64+
}
65+
66+
public override DATA_CATEGORY getDataCategory()
67+
{
68+
return DATA_CATEGORY.BINARY;
69+
}
70+
public override DATA_TYPE getDataType()
71+
{
72+
return DATA_TYPE.DT_COMPLEX;
73+
}
74+
75+
public override String getString()
76+
{
77+
if (isNull())
78+
{
79+
return "";
80+
}
81+
else
82+
{
83+
return value.x.ToString() + (value.y >= 0 ? "+" : "") + value.y.ToString() + "i";
84+
}
85+
}
86+
87+
public bool equals(Object o)
88+
{
89+
if (!(o is BasicComplex) || o == null)
90+
return false;
91+
else
92+
return value.equals(((BasicComplex)o).value);
93+
}
94+
95+
public override void writeScalarToOutputStream(ExtendedDataOutput @out)
96+
{
97+
@out.writeDouble2(value);
98+
}
99+
100+
public Double2 getValue()
101+
{
102+
return value;
103+
}
104+
105+
public override int hashBucket(int buckets)
106+
{
107+
return value.hashBucket(buckets);
108+
}
109+
110+
public override bool Equals(object o)
111+
{
112+
if (!(o is BasicComplex) || o == null)
113+
{
114+
return false;
115+
}
116+
else
117+
{
118+
return getValue().equals(((BasicComplex)o).getValue());
119+
}
120+
}
121+
122+
public override int GetHashCode()
123+
{
124+
return value.GetHashCode();
125+
}
126+
}
127+
}

src/data/BasicComplexMatrix.cs

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
using dolphindb.io;
2+
using System;
3+
using System.Collections.Generic;
4+
5+
namespace dolphindb.data
6+
{
7+
8+
public class BasicComplexMatrix : AbstractMatrix
9+
{
10+
private BasicComplexVector value;
11+
12+
public BasicComplexMatrix(int rows, int columns) : base(rows, columns)
13+
{
14+
this.value = new BasicComplexVector(rows * columns);
15+
}
16+
17+
public BasicComplexMatrix(int rows, int columns, IList<Double2[]> list) : base(rows, columns)
18+
{
19+
List<Double2> tmp = new List<Double2>();
20+
foreach (Double2[] data in list)
21+
{
22+
tmp.AddRange(data);
23+
}
24+
if (tmp.Count != rows * columns)
25+
{
26+
throw new Exception("the total size of list must be equal to rows * columns");
27+
}
28+
value = new BasicComplexVector(tmp);
29+
}
30+
31+
public BasicComplexMatrix(ExtendedDataInput @in) : base(@in)
32+
{
33+
}
34+
35+
public override bool isNull(int row, int column)
36+
{
37+
return value.isNull(getIndex(row, column));
38+
}
39+
40+
public override void setNull(int row, int column)
41+
{
42+
value.setNull(getIndex(row, column));
43+
}
44+
45+
public override IScalar get(int row, int column)
46+
{
47+
return this.value.get(getIndex(row, column));
48+
}
49+
50+
public void set(int row, int column, IScalar value)
51+
{
52+
this.value.set(getIndex(row, column), value);
53+
}
54+
55+
public override DATA_CATEGORY getDataCategory()
56+
{
57+
return DATA_CATEGORY.BINARY;
58+
}
59+
60+
public override DATA_TYPE getDataType()
61+
{
62+
return DATA_TYPE.DT_COMPLEX;
63+
}
64+
65+
public override Type getElementClass()
66+
{
67+
return typeof(BasicComplex);
68+
}
69+
70+
protected internal override void readMatrixFromInputStream(int rows, int columns, ExtendedDataInput @in)
71+
{
72+
this.value = new BasicComplexVector(rows * columns);
73+
value.deserialize(0, rows * columns, @in);
74+
}
75+
76+
protected internal override void writeVectorToOutputStream(ExtendedDataOutput @out)
77+
{
78+
this.value.writeVectorToOutputStream(@out);
79+
}
80+
}
81+
82+
}

0 commit comments

Comments
 (0)