public BasicIPAddr(ExtendedDataInput @in) : base(@in) { }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicSystemEntity(@in, DATA_TYPE.DT_RESOURCE)); }
public BasicTimestamp(ExtendedDataInput @in) : base(@in) { }
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 BasicArrayVector(DATA_TYPE type, ExtendedDataInput @in) : base(DATA_FORM.DF_VECTOR) { this.type = type; int rows = @in.readInt(); int cols = @in.readInt(); rowIndices = new List <int>(new int[rows]); DATA_TYPE valueType = type - 64; valueVec = (AbstractVector)BasicEntityFactory.instance().createVectorWithDefaultValue(valueType, cols); this.baseUnitLength_ = valueVec.getUnitLength(); int rowsRead = 0; int rowsReadInBlock = 0; int prevIndex = 0; int totalBytes = 0; while (rowsRead < rows) { //read block header int blockRows = @in.readShort(); int countBytes = @in.readChar(); @in.skipBytes(1); //read array of count totalBytes = blockRows * countBytes; rowsReadInBlock = 0; int offect = 0; while (offect < totalBytes) { int len = Math.Min(BUF_SIZE, totalBytes - offect); @in.readFully(buf, 0, len); int curRows = len / countBytes; if (countBytes == 1) { for (int i = 0; i < curRows; i++) { int curRowCells = buf[i]; rowIndices[rowsRead + rowsReadInBlock + i] = prevIndex + curRowCells; prevIndex += curRowCells; } } else if (countBytes == 2) { for (int i = 0; i < curRows; ++i) { int curRowCells = BitConverter.ToInt16(buf, i * 2); rowIndices[rowsRead + rowsReadInBlock + i] = prevIndex + curRowCells; prevIndex += curRowCells; } } else { for (int i = 0; i < curRows; ++i) { int curRowCells = BitConverter.ToInt32(buf, i * 4); rowIndices[rowsRead + rowsReadInBlock + i] = prevIndex + curRowCells; prevIndex += curRowCells; } } rowsReadInBlock += curRows; offect += len; } //read array of values int rowStart = rowsRead == 0 ? 0 : rowIndices[rowsRead - 1]; int valueCount = rowIndices[rowsRead + rowsReadInBlock - 1] - rowStart; valueVec.deserialize(rowStart, valueCount, @in); rowsRead += rowsReadInBlock; } }
public BasicFloatMatrix(ExtendedDataInput @in) : base(@in) { }
public IEntity createEntity(DATA_FORM form, DATA_TYPE type, ExtendedDataInput @in) { if (form == DATA_FORM.DF_TABLE) { return(new BasicTable(@in)); } else if (form == DATA_FORM.DF_CHART) { //return new BasicChart(@in); return(null); } else if (form == DATA_FORM.DF_DICTIONARY) { return(new BasicDictionary(type, @in)); } else if (form == DATA_FORM.DF_SET) { return(new BasicSet(type, @in)); } else if (form == DATA_FORM.DF_CHUNK) { //return new BasicChunkMeta(@in); return(null); } else if (type == DATA_TYPE.DT_ANY && form == DATA_FORM.DF_VECTOR) { return(new BasicAnyVector(@in)); } else if (type == DATA_TYPE.DT_VOID && form == DATA_FORM.DF_SCALAR) { @in.readBoolean(); return(new Void()); } else { int index = (int)type; if (factories[index] == null) { throw new IOException("Data type " + type.ToString() + " is not supported yet."); } else if (form == DATA_FORM.DF_VECTOR) { return(factories[index].createVector(@in)); } else if (form == DATA_FORM.DF_SCALAR) { return(factories[index].createScalar(@in)); } else if (form == DATA_FORM.DF_MATRIX) { return(factories[index].createMatrix(@in)); } else if (form == DATA_FORM.DF_PAIR) { return(factories[index].createPair(@in)); } else { throw new IOException("Data form " + form.ToString() + " is not supported yet."); } } }
public BasicByte(ExtendedDataInput @in) { value = @in.readByte(); }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicBoolean(@in)); }
public IMatrix createMatrix(ExtendedDataInput @in) { return(new BasicBooleanMatrix(@in)); }
public BasicByteMatrix(ExtendedDataInput @in) : base(@in) { }
public BasicSecond(ExtendedDataInput @in) : base(@in) { }
protected internal abstract void readMatrixFromInputStream(int rows, int columns, ExtendedDataInput @in);
public IMatrix createMatrix(ExtendedDataInput @in) { return(new BasicNanoTimeMatrix(@in)); }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicTimestamp(@in)); }
public BasicDateTime(ExtendedDataInput @in) : base(@in) { }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicMinute(@in)); }
public override void deserialize(int start, int count, ExtendedDataInput @in) { throw new NotImplementedException(); }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicSecond(@in)); }
public BasicNanoTimeMatrix(ExtendedDataInput @in) : base(@in) { }
public IMatrix createMatrix(ExtendedDataInput @in) { return(new BasicSecondMatrix(@in)); }
public BasicDictionary(DATA_TYPE valueType, ExtendedDataInput @in) { this.valueType = valueType; BasicEntityFactory factory = new BasicEntityFactory(); DATA_TYPE[] types = Enum.GetValues(typeof(DATA_TYPE)) as DATA_TYPE[]; //read key vector short flag = @in.readShort(); int form = flag >> 8; int type = flag & 0xff; bool extended = type >= 128; if (type >= 128) { type -= 128; } if (form != (int)DATA_FORM.DF_VECTOR) { throw new IOException("The form of dictionary keys must be vector"); } if (type < 0 || type >= types.Length) { throw new IOException("Invalid key type: " + type); } keyType = types[type]; IVector keys = (IVector)factory.createEntity(DATA_FORM.DF_VECTOR, types[type], @in, extended); //read value vector flag = @in.readShort(); form = flag >> 8; type = flag & 0xff; extended = type >= 128; if (type >= 128) { type -= 128; } if (form != (int)DATA_FORM.DF_VECTOR) { throw new IOException("The form of dictionary values must be vector"); } if (type < 0 || type >= types.Length) { throw new IOException("Invalid value type: " + type); } IVector values = (IVector)factory.createEntity(DATA_FORM.DF_VECTOR, types[type], @in, extended); if (keys.rows() != values.rows()) { throw new IOException("The key size doesn't equate to value size."); } int size = keys.rows(); int capacity = (int)(size / 0.75); dict = new Dictionary <IScalar, IEntity>(capacity); if (values.getDataType() == DATA_TYPE.DT_ANY) { BasicAnyVector entityValues = (BasicAnyVector)values; for (int i = 0; i < size; ++i) { dict[keys.get(i)] = entityValues.getEntity(i); } } else { for (int i = 0; i < size; ++i) { dict[keys.get(i)] = values.get(i); } } }
public IVector createVector(ExtendedDataInput @in) { return(new BasicTimeVector(DATA_FORM.DF_VECTOR, @in)); }
public BasicBooleanMatrix(ExtendedDataInput @in) : base(@in) { }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicNanoTime(@in)); }
public BasicMonthMatrix(ExtendedDataInput @in) : base(@in) { }
public IVector createPair(ExtendedDataInput @in) { return(new BasicNanoTimeVector(DATA_FORM.DF_PAIR, @in)); }
protected internal BasicTimestampVector(DATA_FORM df, ExtendedDataInput @in) : base(df, @in) { }
public IScalar createScalar(ExtendedDataInput @in) { return(new BasicSystemEntity(@in, DATA_TYPE.DT_FUNCTIONDEF)); }