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

com.scudata.dw.StructManager 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;

/**
 * ?ṹ??????
 */
import java.util.ArrayList;

import com.scudata.dm.DataStruct;

public final class StructManager {
	private ArrayList dsList; // ???е????ݽṹ
	private transient DataStruct prevDs; // ǰһ???????ֶε????ݽṹ
	private transient int prevDsID = -1; // ???ݽṹ?ı?ʶ??????dsList?е?????
	
	public StructManager() {
		dsList = new ArrayList();
	}
	
	public StructManager(ArrayList list) {
		this.dsList = list;
	}
	
	public ArrayList getStructList() {
		return dsList;
	}
	
	public int getDataStructID(DataStruct ds) {
		if (prevDs != null && prevDs.isCompatible(ds)) {
			return prevDsID;
		}
		
		ArrayList dsList = this.dsList;
		for (int i = 0, size = dsList.size(); i < size; ++i) {
			if (ds.isCompatible(dsList.get(i))) {
				prevDs = ds;
				prevDsID = i;
				return i;
			}
		}
		
		prevDs = ds;
		prevDsID = dsList.size();
		dsList.add(ds);
		return prevDsID;
	}

	public DataStruct getDataStruct(int id) {
		return dsList.get(id);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy