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

com.xxdb.route.HashDomain Maven / Gradle / Ivy

There is a newer version: 3.00.2.2
Show newest version
package com.xxdb.route;

import java.util.ArrayList;
import java.util.List;

import com.xxdb.data.Entity;
import com.xxdb.data.Entity.DATA_TYPE;
import com.xxdb.data.Scalar;
import com.xxdb.data.Utils;
import com.xxdb.data.Vector;

public class HashDomain implements Domain{
	private int buckets;
	private Entity.DATA_TYPE type;
	private Entity.DATA_CATEGORY cat;

	public HashDomain(int buckets, Entity.DATA_TYPE type, Entity.DATA_CATEGORY cat){
		this.buckets = buckets;
		this.type = type;
		this.cat = cat;
	}
	
	@Override
	public List getPartitionKeys(Vector partitionCol) {
		if (partitionCol.getDataCategory() != this.cat)
			throw new RuntimeException("Data category incompatible.");
		if (this.cat == Entity.DATA_CATEGORY.TEMPORAL && this.type != partitionCol.getDataType())
			partitionCol = (Vector)Utils.castDateTime(partitionCol, this.type);

		int rows = partitionCol.rows();
		ArrayList keys = new ArrayList(rows);
		for(int i=0; i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy