-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bbf73d
commit 6b37910
Showing
44 changed files
with
7,495 additions
and
4,797 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
using dolphindb.io; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace dolphindb.data | ||
{ | ||
|
||
public class BasicDecimal128Matrix : AbstractMatrix | ||
{ | ||
private BasicDecimal128Vector value; | ||
|
||
public BasicDecimal128Matrix(int rows, int columns, int scale) : base(rows, columns) | ||
{ | ||
this.value = new BasicDecimal128Vector(rows * columns, scale); | ||
} | ||
|
||
public BasicDecimal128Matrix(int rows, int columns, IList<decimal[]> list, int scale) : base(rows, columns) | ||
{ | ||
List<decimal> tmp = new List<decimal>(); | ||
foreach (decimal[] data in list) | ||
{ | ||
tmp.AddRange(data); | ||
} | ||
if (tmp.Count != rows * columns) | ||
{ | ||
throw new Exception("the total size of list must be equal to rows * columns"); | ||
} | ||
value = new BasicDecimal128Vector(tmp, scale); | ||
} | ||
|
||
public BasicDecimal128Matrix(int rows, int columns, IList<string[]> list, int scale) : base(rows, columns) | ||
{ | ||
List<string> tmp = new List<string>(); | ||
foreach (string[] data in list) | ||
{ | ||
tmp.AddRange(data); | ||
} | ||
if (tmp.Count != rows * columns) | ||
{ | ||
throw new Exception("the total size of list must be equal to rows * columns"); | ||
} | ||
value = new BasicDecimal128Vector(tmp, scale); | ||
} | ||
|
||
public BasicDecimal128Matrix(ExtendedDataInput @in) : base(@in) | ||
{ | ||
} | ||
|
||
public virtual void setDecimal(int row, int column, decimal value) | ||
{ | ||
this.value.setDecimal(getIndex(row, column), value); | ||
} | ||
|
||
public virtual decimal getDecimal(int row, int column) | ||
{ | ||
return value.getDecimal(getIndex(row, column)); | ||
} | ||
|
||
public void setString(int row, int column, string value) | ||
{ | ||
this.value.set(getIndex(row, column), value); | ||
} | ||
|
||
public override bool isNull(int row, int column) | ||
{ | ||
return value.isNull(getIndex(row, column)); | ||
} | ||
|
||
public override void setNull(int row, int column) | ||
{ | ||
value.setNull(getIndex(row, column)); | ||
} | ||
|
||
public override IScalar get(int row, int column) | ||
{ | ||
return this.value.get(getIndex(row, column)); | ||
} | ||
|
||
public void set(int row, int column, IScalar value) | ||
{ | ||
this.value.set(getIndex(row, column), value); | ||
} | ||
|
||
public override DATA_CATEGORY getDataCategory() | ||
{ | ||
return DATA_CATEGORY.DENARY; | ||
} | ||
|
||
public override DATA_TYPE getDataType() | ||
{ | ||
return DATA_TYPE.DT_DECIMAL128; | ||
} | ||
|
||
public override Type getElementClass() | ||
{ | ||
return typeof(BasicDecimal128); | ||
} | ||
|
||
protected internal override void readMatrixFromInputStream(int rows, int columns, ExtendedDataInput @in) | ||
{ | ||
int scale = @in.readInt(); | ||
this.value = new BasicDecimal128Vector(rows * columns, scale); | ||
value.deserialize(0, rows * columns, @in); | ||
} | ||
|
||
protected internal override void writeVectorToOutputStream(ExtendedDataOutput @out) | ||
{ | ||
this.value.writeVectorToOutputStream(@out); | ||
} | ||
|
||
public int getScale() | ||
{ | ||
return value.getScale(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
using dolphindb.io; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace dolphindb.data | ||
{ | ||
|
||
|
||
public class BasicDecimal32Matrix : AbstractMatrix | ||
{ | ||
private BasicDecimal32Vector value; | ||
|
||
public BasicDecimal32Matrix(int rows, int columns, int scale) : base(rows, columns) | ||
{ | ||
this.value = new BasicDecimal32Vector(rows * columns, scale); | ||
} | ||
|
||
public BasicDecimal32Matrix(int rows, int columns, IList<decimal[]> list, int scale) : base(rows, columns) | ||
{ | ||
List<decimal> tmp = new List<decimal>(); | ||
foreach (decimal[] data in list) | ||
{ | ||
tmp.AddRange(data); | ||
} | ||
if (tmp.Count != rows * columns) | ||
{ | ||
throw new Exception("the total size of list must be equal to rows * columns"); | ||
} | ||
value = new BasicDecimal32Vector(tmp, scale); | ||
} | ||
|
||
public BasicDecimal32Matrix(int rows, int columns, IList<string[]> list, int scale) : base(rows, columns) | ||
{ | ||
List<string> tmp = new List<string>(); | ||
foreach (string[] data in list) | ||
{ | ||
tmp.AddRange(data); | ||
} | ||
if(tmp.Count != rows * columns) | ||
{ | ||
throw new Exception("the total size of list must be equal to rows * columns"); | ||
} | ||
value = new BasicDecimal32Vector(tmp, scale); | ||
} | ||
|
||
public BasicDecimal32Matrix(ExtendedDataInput @in) : base(@in) | ||
{ | ||
} | ||
|
||
public virtual void setDecimal(int row, int column, decimal value) | ||
{ | ||
this.value.setDecimal(getIndex(row, column), value); | ||
} | ||
|
||
public virtual decimal getDecimal(int row, int column) | ||
{ | ||
return value.getDecimal(getIndex(row, column)); | ||
} | ||
|
||
public void setString(int row, int column, string value) | ||
{ | ||
this.value.set(getIndex(row, column), value); | ||
} | ||
|
||
public override bool isNull(int row, int column) | ||
{ | ||
return value.isNull(getIndex(row, column)); | ||
} | ||
|
||
public override void setNull(int row, int column) | ||
{ | ||
value.setNull(getIndex(row, column)); | ||
} | ||
|
||
public override IScalar get(int row, int column) | ||
{ | ||
return this.value.get(getIndex(row, column)); | ||
} | ||
|
||
public void set(int row, int column, IScalar value) | ||
{ | ||
this.value.set(getIndex(row, column), value); | ||
} | ||
|
||
public override DATA_CATEGORY getDataCategory() | ||
{ | ||
return DATA_CATEGORY.DENARY; | ||
} | ||
|
||
public override DATA_TYPE getDataType() | ||
{ | ||
return DATA_TYPE.DT_DECIMAL32; | ||
} | ||
|
||
public override Type getElementClass() | ||
{ | ||
return typeof(BasicDecimal32); | ||
} | ||
|
||
protected internal override void readMatrixFromInputStream(int rows, int columns, ExtendedDataInput @in) | ||
{ | ||
int scale = @in.readInt(); | ||
this.value = new BasicDecimal32Vector(rows * columns, scale); | ||
value.deserialize(0, rows * columns, @in); | ||
} | ||
|
||
protected internal override void writeVectorToOutputStream(ExtendedDataOutput @out) | ||
{ | ||
this.value.writeVectorToOutputStream(@out); | ||
} | ||
|
||
public int getScale() | ||
{ | ||
return value.getScale(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.