All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.scudata.dw.compress.RefColumn Maven / Gradle / Ivy

Go to download

SPL(Structured Process Language) A programming language specially for structured data computing.

There is a newer version: 20241126
Show newest version
package com.scudata.dw.compress;

import java.io.IOException;
import java.util.ArrayList;

import com.scudata.dw.BufferReader;

public class RefColumn extends Column {
	// ???ݰ???洢??ÿ????Column.BLOCK_RECORD_COUNT????¼
	private ArrayList blockList = new ArrayList(1024);
	private int lastRecordCount = Column.BLOCK_RECORD_COUNT; // ???һ??ļ?¼??
	
	public void addData(Object r) {
		if (lastRecordCount < Column.BLOCK_RECORD_COUNT) {
			Object []block = blockList.get(blockList.size() - 1);
			block[lastRecordCount++] = r;
		} else {
			Object []block = new Object[Column.BLOCK_RECORD_COUNT];
			block[0] = r;
			blockList.add(block);
			lastRecordCount = 1;
		}
	}
	
	// ȡ??row?е?????
	public Object getData(int row) {
		// row?кţ???1??ʼ????
		row--;
		Object []block = blockList.get(row / Column.BLOCK_RECORD_COUNT);
		return block[row % Column.BLOCK_RECORD_COUNT];
	}

	public Column clone() {
		return new RefColumn();
	}
	
	public void appendData(BufferReader br) throws IOException {
		addData(br.readObject());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy