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

com.xxdb.route.ListDomain 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.HashMap;
import java.util.List;
import java.util.Map;

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

public class ListDomain implements Domain {
	private Entity.DATA_TYPE type;
	private Entity.DATA_CATEGORY cat;
	private Map dict;

	public ListDomain(Vector list, Entity.DATA_TYPE type, Entity.DATA_CATEGORY cat){
		this.type = type;
		this.cat = cat;
		if(list.getDataType() != Entity.DATA_TYPE.DT_ANY)
			throw new RuntimeException("The input list must be a tuple.");
		this.dict = new HashMap();
		BasicAnyVector values = (BasicAnyVector)list;
		int partitions = values.rows();
		for(int i=0; i getPartitionKeys(Vector partitionCol) {
		if(partitionCol.getDataCategory() != this.cat)
			throw new RuntimeException("Data category incompatible.");
		if (this.cat == Entity.DATA_CATEGORY.TEMPORAL && 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