protected internal AbstractMatrix(ExtendedDataInput @in) { byte hasLabels = @in.readByte(); BasicEntityFactory factory = null; DATA_TYPE[] types = Enum.GetValues(typeof(DATA_TYPE)) as DATA_TYPE[]; if (hasLabels > 0) { factory = new BasicEntityFactory(); } short flag; int form; int type; if ((hasLabels & 1) == 1) { //contain row labels flag = @in.readShort(); form = flag >> 8; type = flag & 0xff; if (form != (int)DATA_FORM.DF_VECTOR) { throw new IOException("The form of matrix row labels must be vector"); } if (type < 0 || type >= types.Length) { throw new IOException("Invalid data type for matrix row labels: " + type); } rowLabels = (IVector)factory.createEntity(DATA_FORM.DF_VECTOR, types[type], @in); } if ((hasLabels & 2) == 2) { //contain columns labels flag = @in.readShort(); form = flag >> 8; type = flag & 0xff; if (form != (int)DATA_FORM.DF_VECTOR) { throw new IOException("The form of matrix columns labels must be vector"); } if (type < 0 || type >= types.Length) { throw new IOException("Invalid data type for matrix column labels: " + type); } columnLabels = (IVector)factory.createEntity(DATA_FORM.DF_VECTOR, types[type], @in); } flag = @in.readShort(); type = flag & 0xff; if (type < 0 || type >= types.Length) { throw new IOException("Invalid data type for matrix: " + type); } _rows = @in.readInt(); _columns = @in.readInt(); readMatrixFromInputStream(_rows, _columns, @in); }
public BasicChunkMeta(ExtendedDataInput @in) { @in.readShort(); //skip the length of the data path = @in.readString(); id = new sbyte[16]; @in.readFully(id); version = @in.readInt(); size_Renamed = @in.readInt(); flag = @in.readByte(); sites = new List <>(); int copyCount = @in.readByte(); for (int i = 0; i < copyCount; ++i) { sites.Add(@in.readString()); } }
public BasicSystemEntity(ExtendedDataInput @in, DATA_TYPE type) : base("") { this.type = type; if (type == DATA_TYPE.DT_FUNCTIONDEF) { @in.readByte(); } base.setValue(@in.readString()); }
protected internal override void readMatrixFromInputStream(int rows, int columns, ExtendedDataInput @in) { int size = rows * columns; values = new byte[size]; for (int i = 0; i < size; ++i) { values[i] = @in.readByte(); } }
public override void deserialize(int start, int count, ExtendedDataInput @in) { if (start + count > values.Count) { values.AddRange(new byte[start + count - values.Count]); } for (int i = 0; i < count; ++i) { values[start + i] = @in.readByte(); } }
protected internal BasicBooleanVector(DATA_FORM df, ExtendedDataInput @in) : base(df) { int rows = @in.readInt(); int cols = @in.readInt(); int size = rows * cols; values = new byte[size]; for (int i = 0; i < size; ++i) { values[i] = @in.readByte(); } }
protected internal BasicByteVector(DATA_FORM df, ExtendedDataInput @in) : base(df) { int rows = @in.readInt(); int cols = @in.readInt(); int size = rows * cols; values = new List <byte>(size); values.AddRange(new byte[size]); for (int i = 0; i < size; ++i) { values[i] = @in.readByte(); } }
public IVector Decompress(IEntityFactory factory, ExtendedDataInput input, bool extended, bool isLittleEndian) { int compressedBytes = input.readInt(); //((LittleEndianDataInputStream)input).skipBytes(7); for (int i = 0; i < 7; ++i) { input.readByte(); } int compression = input.readByte(); int dataType = input.readByte(); int unitLength = input.readByte(); //((LittleEndianDataInputStream)input).skipBytes(6); for (int i = 0; i < 2; ++i) { input.readByte(); } int etra = input.readInt(); int elementCount = input.readInt(); if (dataType < (int)DATA_TYPE.DT_BOOL_ARRAY) { etra = 1; } input.readInt(); ExtendedDataInput decompressedIn = DecoderFactory.get(compression).Decompress(input, compressedBytes - 20, unitLength, elementCount, etra, isLittleEndian); bool extend = dataType >= 128; if (dataType >= 128) { dataType -= 128; } DATA_TYPE dt = (DATA_TYPE)dataType; return((IVector)factory.createEntity(DATA_FORM.DF_VECTOR, dt, decompressedIn, extend)); }
public BasicByte(ExtendedDataInput @in) { value = @in.readByte(); }